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

Make setuptools an optional dependency? #1040

Closed
akx opened this issue Oct 28, 2023 · 6 comments · Fixed by #1041
Closed

Make setuptools an optional dependency? #1040

akx opened this issue Oct 28, 2023 · 6 comments · Fixed by #1041

Comments

@akx
Copy link
Member

akx commented Oct 28, 2023

It's a bit rough that this forces setuptools on everyone that has babel in their dependency chain - is there a plan to remove it again eventually? Could this be made an optional feature?

Originally posted by @sigma67 in #1031 (comment)

@oprypin
Copy link
Contributor

oprypin commented Oct 28, 2023

OK so the issue is... the file "babel/messages/frontend.py" implements the setuptools commands integration and the command line interface of pybabel itself, and these two implementations are very tightly connected.

Sure it would be nice to make the setuptools commands integration optional, but:

  • It will be a breaking change for tools that still depend on it, no matter how unpopular this is by now.
  • A lot of code may end up being duplicated.

@oprypin
Copy link
Contributor

oprypin commented Oct 28, 2023

One weird approach to solving this would be to make a new package "babel-core" and move everything except "frontend" into that package. Annoying to maintain, though.

@sigma67
Copy link

sigma67 commented Oct 28, 2023

I think most people get babel through the immensely popular sphinx. Not sure if sphinx relies on setuptools functionality of babel.

I think both ideas you mentioned are viable from a user's perspective, either way it will be a breaking change. But it may be a good chance to rework the frontend?

@jpmckinney
Copy link

I use the babel CLI (extract-messages, update-catalog, compile-catalog).

What is the “setuptools commands integration”?

@oprypin
Copy link
Contributor

oprypin commented Oct 28, 2023

setup.py can be used as a "command runner" and this integration allows you to add convenience commands that invoke babel in a particular way.

See this commit (from a project that uses babel) that removes this integration because we don't use setup.py anymore.
mkdocs/mkdocs@12ee265#diff-2450391302526c6fb43e265d1253d6f5fa62ad38c7c8841090760cf9e6d940b3

Documentation:
https://github.com/python-babel/babel/blob/65de3dcf2dc217d6135eff999dc87a3861065e8d/docs/setup.rst

@akx
Copy link
Member Author

akx commented Oct 29, 2023

TBH, I think we can do with a fairly small translation/emulation layer so our underlying commands are runner-agnostic, and we have a setuptools wrapper for each of them, and a standalone CLI (argparse) wrapper for them. The latter is already done, really, it's just a matter of un-inheriting the current Commands from the setuptools Command base class and writing the wrapper that way...

@akx akx self-assigned this Oct 30, 2023
@akx akx closed this as completed in #1041 Nov 22, 2023
akx added a commit that referenced this issue Nov 22, 2023
…ncy (#1041)

* Decouple `pybabel` frontend from distutils/setuptools; remove dependency

* Add tox configuration for testing with setuptools too

* Use `__getattr__` for re-export

Fixes #1040

Co-authored-by: Oleh Prypin <oleh@pryp.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants