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 the distutils/setuptools integration an opt-in for projects #9595
Comments
Recent conversation on the topic (that got derailed, anyway) on one of such issues #9517 (comment) . I should have opened a new issue about it, thanks @pradyunsg. +1 from me. |
+1 to this. An alternative low effort solution would be to simply deprecate and eventually remove this feature entirely in favor of a direct |
I was about to open a new issue, but I'll continue the conversation here instead. Paul Ganssle has written it better than I could: https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html
|
Now Sphinx uses setuptools to search 3rd party builders and themes via About |
This is for entry points, right? Those can be replaced with importlib.metadata and its backport, which are also much faster, use less memory and (>= 3.8) is a part of the standard library. |
Sounds good. As a first step, we should replace pkg_resources by importlib.metadata and its backport lib. Then we can consider how to deprecate dependency of setuptools. |
I've opened #10007 to get rid of |
Here's the list of reasons I can think of, to drop the
|
There's broadly two options here, as I see it:
My earlier suggestion of moving the code from Sphinx to a separate package was... not a good one. Other than being incompatible with projects that followed the documented guidance, it also doesn't achieve the main goal: it still does not make it opt-in at the project level -- the hook can still be registered without the project opting in, by installing this package in the build environment. The whole premise of this issue is that it shouldn't be possible for a redistributor to build documentation through this integration for projects that have not opted in explicitly for this integration. Option 1 makes the opt-in happen explicitly, as documented. Option 2 removes the possibility of opting in, by removing the functionality entirely. |
I've opened #10008, in case we want to go with option 2. :) |
If this was one of my projects, I'd be inclined to do a deprecation cycle, issue warnings etc. It looks like Sphinx is developed more semver style, where breaking things in major versions is OK. Given that, I'd be inclined to remove it in the next major version. |
Our deprecation policy is here: https://github.com/sphinx-doc/sphinx/blob/4.x/doc/internals/release-process.rst#deprecation-policy |
Sounds fair, if we do want to go with option 2 (drop the functionality)! If we went with option 1 (stop the automated registration of the |
As a first step of the deprecation, we should keep the compatibility (without warnings). If my understanding is correct, option 1 affects users, right? |
Broadly speaking, yes: option 1 would mean |
I'm not sure the advantage of option 1 compared with the current implementation. IMO, it does not help the removal of the |
…gration Close #9595: Deprecate setuptools integration
The setuptools integration is deprecated and will be removed in Sphinx 7. A |
Is your feature request related to a problem? Please describe.
Sphinx currently injects a "magical"
setup.py build_sphinx
command into setuptools-based projects. While this is likely be useful for some user workflows, recently this has been a major source of confusion in the Python ecosystem, due to some folks who are repackaging a substantial number of open source Python packages.These repackagers have assumed that all Python projects that use setuptools and Sphinx also use this integration -- which is not true. Most users are not aware of this integration and do not use it or support it. By making projects explicitly opt-in to this integration, it would help avoid such confusion and problems due to repackagers trying to build documentation using this integration and that not working -- since it's not a way that the specific project supports for building documentation (eg: if they use any non-setuptools build backend).
Further, this also puts setuptools in a uniquely priviledged position with Sphinx -- something that Python packaging tooling has been actively working to avoid and move away from (see pyproject.toml based builds, introduced in PEP 517 / PEP 518).
Describe the solution you'd like
Move the setuptools integration into a separate package on PyPI. We can also add it as an optional dependency of Sphinx (via the extras mechanism), so that users who want this can use
sphinx[setuptools]
in their requirements.txt orpip install
invocations.Describe alternatives you've considered
Not doing anything, which... works. 🤷🏽♂️
I think this is suboptimal though -- see https://github.com/search?q=build_sphinx+is%3Aissue&type=issues -- there are many issues filed on the premise that this integration means that projects should actively support this, which is a generally harmful suggestion to make IMO. These assumptions break down for non-setuptools-based projects as well.
Additional context
I guess, it's worth noting that a certain individual has been filed 100s of issues against various Python projects regarding this exact issue -- demanding that the entire ecosystem support this integration as a way to build their documentation (see the search above).
The text was updated successfully, but these errors were encountered: