Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop dependency on jaraco.context (+backports) #15

Closed
wants to merge 1 commit into from

Conversation

Avasam
Copy link
Contributor

@Avasam Avasam commented Jul 22, 2024

It seems overkill to pull in jaraco.context and its dependencies just for that one function.
This should also allows removing both jaraco.context and backports from setuptools's vendored dependencies as they were both only transitive from jaraco.context

Relates to:

@Avasam Avasam force-pushed the Drop-dependency-on-jaraco.context branch from a0ea72a to 00c2384 Compare July 22, 2024 02:50
@Avasam Avasam changed the title Drop dependency on jaraco.context Drop dependency on jaraco.context (+backports) Jul 23, 2024
Copy link
Owner

@jaraco jaraco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the proposal.

My intention with authoring ExceptionTrap was to provide a way to model in a one line expression (once Python 3.8 is dropped) what's done in four lines plus two new blocks plus two return values and two literals. I'd hope over time to re-use this pattern in more places, rather than limit the usage of it (and then implicitly put a constraint that it can't be expanded).

Of course it's possible to write primitive, imperative code, but I'm aiming to elevate the ecosystem by providing re-usable sophisticated abstractions like ExceptionTrap. This abstraction was inspired by the popular RaisesContext used by pytest, but generalized to be useful in a non-test context.

I think I'd be more inclined to remove jaraco.context.tarfile, which creates the dependency on backports.tarfile, or move it to another library, but that approach too doesn't generalize well - it implies that every bit of functionality that depends on some other library should itself be split out into a separate library in order to limit the number of transitive dependencies.

This proposed change also implies that compose and method_cache should also be inlined as imperative behavior in order to remove the dependency on jaraco.functools, a slippery slope to "just don't have any dependencies and re-implement the minimum subset of the behaviors you need in each and every project."

Since I want to reduce code duplication, I'm declining this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants