sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.6k stars 2.12k forks source link

Releasing sphinx-contrib packages using implicit namespace packages #11495

Closed tjni closed 1 year ago

tjni commented 1 year ago

Is your feature request related to a problem? Please describe.

I am working on updating sphinx and sphinxcontrib packages in nixpkgs, which has its own quirks in its method for Python packaging. I don't fully understand why, but mixing packages that use setuptool's legacy namespace packages with those that use implicit namespace packages (e.g. sphinxcontrib-jquery, sphinxcontrib-applehelp) cause the latter to be considered missing when importing them.

I cannot reproduce this in a virtualenv, so it could be Nix specific, but it's also strange enough that I fear sinking tons of time into it if there's already a plan to migrate and release all the sphinxcontrib packages using either setuptools's or flit's support for implicit namespace packages. I am also willing to help with testing, PRs, or in any other way.

AA-Turner commented 1 year ago

Are you able to reproduce this outwith Nix?

tjni commented 1 year ago

I have not been able to reproduce this yet outside of Nix, so please treat this as a feature request instead of a bug report.

tjni commented 1 year ago

I do have a lead on what's happening and, to make a long story short, it seems to be due to behavior from a *-nspkg.pth file that setuptools generates in its legacy namespace packages path. It doesn't quite work when different packages, some which contain these files and some which do not, are installed in disjoint directories (which nix does, unlike a virtualenv). If this is a bug, it is one in setuptools. If it is hard to fix, we will probably work around it in nixpkgs.

With that said, I still am interested in releases of the sphinxcontrib modules that migrate away from this legacy setuptools code path that could let us clean up any potential workarounds, and willing to help in any way.

tjni commented 1 year ago

In case it's interesting to you, I described this in more detail in https://github.com/pypa/setuptools/discussions/3991.

tjni commented 1 year ago

I have an approach to fix this in nixpkgs by post-processing some of these packages to delete those nspkg.pth files. I would like to gradually rely less and less on that over time. Would you be amenable if I worked on migrating to implicit namespaces?

AA-Turner commented 1 year ago

Would you be amenable if I worked on migrating to implicit namespaces?

Yes, feel free to tag me.

A

AA-Turner commented 1 year ago

I have just made a new release of each of the first party sphinxcontrib packages, though the PyPI uploads are currently prevented by https://github.com/pypa/trove-classifiers/pull/150.

A

tjni commented 1 year ago

Thank you so much!

AA-Turner commented 1 year ago

Now released are:

All with PEP 420 packaging. All other sphinxcontrib packages are third party (though again feel free to tag me on issues for review).

A

tjni commented 1 year ago

Thank you very much again for all your help. It's really tedious work, and I appreciate it.