-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
4.1.1: build_sphinx
fails when module sourvce code is not in <module_name/>
directory
#9517
Comments
No. Sphinx and
BTW, this case tries to load the target distribution via
|
First I've been thinking that this is about pkg_resources.DistributionNotFound: The 'anyio' distribution was not found and is required by the application I have no idea how to solve that exact case. Can someone point at least some direction in which solution of that issue could be? Is is correct what that module is trying to so? |
IMHO adding the source directory to The "proper" way to handle this is to install the module before running Sphinx. This is one of the main reasons why putting the source files into a separate Here's some links regarding https://hynek.me/articles/testing-packaging/ |
+1 to installing the package before running Sphinx. Besides, I don't get the excitement about |
This is why when I've realised that |
IMO problem with all those standardisation is that none of them are trying to take care of building documentation :( For some reasons looking on the code of those modules which already migrated to And about using [1] just short demonstration what that approach offers with my already +550 python modules packages with documentation as man pages): [tkloczko@barrel SRPMS]$ man python-
Display all 232 possibilities? (y or n)
python-amqp python-GitPython.tex python-paste python-sphinxcontrib-asyncio
python-anytree python-greenlet python-path python-sphinxcontrib-autoprogram
python-argcomplete python-h2 python-pillow python-sphinxcontrib-bibtex
python-arrow python-hacking python-platformdirs python-sphinxcontrib-httpdomain
python-"asgi python-hpack python-pluggy python-sphinxcontrib-programoutput
python-aspectlib python-httplib2 python-polib python-sphinxcontrib-trio
python-astor python-hyperframe python-prb python-sphinxcopybutton
python-astroid python-hyperlink python-priority python-sphinxext-opengraph
python-async_generator python-hypothesis python-productmd-compose python-sphinx-inline-tabs
python-atomicwrites python-ifaddr python-productmd-composeinfo python-sphinx-removed-in
python-attrs python-importlib-metadata python-productmd-discinfo python-sphinx_rtd_theme
python-augeas python-inflect python-productmd-images python-sphinx-tabs
python-autodocsumm python-ipykernel python-productmd-rpms python-sphinx-typlog-theme
python-babel python-ipythonparallel python-productmd-terminology python-sphobjinv
python-backcall python-itsdangerous python-productmd-treeinfo python-sqlparse
python-backports.entry-points-selectable python-jaraco-classes python-prompt_toolkit python-stdlib-list
python-benchmark python-jaraco-collections python-ptyprocess python-stem
python-betamax python-jaraco-envs python-purl python-sure
python-billiard python-jaraco-functools python-py python-sybil
python-bleach python-jaraco.itertools python-pyasn1 python-systemd
python-blinker python-jaraco-packaging python-pybtex-docutils python-terminado
python-boto3 python-jaraco-path python-pycodestyle python-testpath
python-botocore python-jaraco-text python-pyfakefs python-testrepository
python-bottle python-jedi python-pyftpdlib python-test_server
python-breathe python-Jinja python-pygal python-testtools
python-build python-jinja2_pluralize python-pygments python-tidy
python-cachetools python-jmespath python-pyhamcrest python-tinycss2
python-case python-jupyter_client python-pylama python-tornado
python-cffi python-jupyter_core python-pylint python-traitlets
python-characteristic python-kiwi python-pymeeus python-transaction
python-chardet python-kombu python-pynacl python-trio
python-click python-lark python-pyopenssl python-trustme
python-click-log python-latexcodec python-pyrad python-twisted
python-contextlib2 python-lazy-object-proxy python-pyrsistent python-uritemplate
python-convertdate python-libevdev python-pyscss python-urllib3
python-coveragepy python-linkify-it-py python-pytest python-validators
python-coveralls python-lockfile python-pytest-checkdocs python-vine
python-cppy python-lxml python-pytest-cov python-virtualenv
python-cssselect2 python-mako python-pytest-regressions python-waitress
python-cython python-markupsafe python-pytest-runner python-wcwidth
python-dateutil python-mdit-py-plugins python-pytest-xprocess python-webcolors
python-dictdiffer python-mistune python-python-sphinx-contribspelling python-webencodings
python-dpkt python-more-itertools python-pyudev python-webob
python-dulwich python-msgpack python-pyxattr python-websocket-client
python-elementpath python-multidict python-pyxdg python-websockets
python-evdev python-mypy python-rdflib python-webtest
python-eventlet python-myst-parser python-requests-mock python-werkzeug
python-execnet python-nbclient python-requests_toolbelt python-wheel
python-faker python-nbformat python-rich python-Whoosh
python-fields python-netaddr python-rsa python-wrapt
python-flake8 python-nose2 python-rst.linker python-WSGIProxy2
python-flask python-notebook python-scons python-wsproto
python-flask-sqlalchemy python-olefile python-scripttest python-xmlschema
python-flit python-openstackdocstheme python-semantic-version python-yamlloader
python-fonttools python-outcome python-service-identity python-yarl
python-gcovr python-paramiko python-smartypants python-zeroconf
python-gidocgen python-parso python-smmap.tex python-zipp
python-gitdb python-parver python-sniffio python-zope-event In other words I've already reached more than only POC stage of that kind of approach and I'm now more and more worry that more modules will be dropping |
The only way to resolve this is installing AFAIK, fetching the version from the package metadata is a well-known technique to define the version of the package only on
IMO, the users of Sphinx can choose how they build their documentation. I guess zopefundation chooses |
There are several things in @kloczek comment:
My only concern is that, by making the setuptools integration too sophisticated, Sphinx also has a significant maintenance burden, for a functionality that will be used by a decreasing number of projects (since |
To be honest recently I've been thinking about kind of scenario in which
Another missing bit IMO is related to other data file. Some projects uses some additional json, text or gettext .mo files. So far looks like none of the PEP specifications takes care of how to deal with those files (please correct me if I'm wrong). Next part is documentation. IMO building documentation or provide non-empty list of test units should be optional.
As the person who is building every day tenths to sometimes even thousands packages exact day (sometimes only to confirm that still build is OK in constantly evolving build env) I would expect that that python build framework will take total control of build, install and check stages allowing to fire exact of those stages separately (today I've noticed that recently tox definitions which up to now was used to mainly test project as well by default calls build documentation (example: just released new version of If Additionally pair of project.toml/setup.cfg should possible to query to see actual set of build dependencies. This would allow automatically updated packaging description dependencies or perform some automatic actions if build dependencies would change between versions. Output in for example json format would be really welcome and could be as well useful to plug easy any other possible automation ( I think that this would allow provide enough interface used automatically by Comments? |
I have no idea if this is specified in PEPs. In any case, setuptools has
With modern packaging tools, one can do all these things without depending on a specific backend:
And then, these tools have existed for a while:
So, in my opinion treating setuptools in a special way is not in line with current developments in modern Python packaging. Quite the opposite.
That's a sane aspiration! To achieve it, in my opinion we need to depend less on setuptools, not more. |
In any case, I doubt this is the right place to have this conversation. I just wanted to chime in because I've been seeing a lot of issues being filed for the setuptools integration of Sphinx. Ultimately it's the maintainers decision to prioritize them or not, and on the other hand I am not here to convince anyone to change their workflow :) Feel free to mark these comments as off-topic, since they are only tangentially related with the issue at hand. |
So far none of the modules which I saw used |
To be honest I really do not understand why to generate stub/minimal setup.py consisting from: from setuptools import setup
setup() is necessary to call pip. This is like ignition of the engine of the largest harvester to thresh only one grain.
Issue is that sdist and .whl files are useless on building documentation or any other operations (you cannot use sdist/,whl well as input to test module). All what it can be done is unpack those archives and than all is possible. [tkloczko@barrel SPECS]$ rpm -E %py3_install_wheel
\
/usr/bin/python3 -m pip install -I dist/%{1} --root /home/tkloczko/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64 --no-deps --no-index --no-warn-script-location
/usr/bin/rm -rfv /home/tkloczko/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/bin/__pycache__
for distinfo in /home/tkloczko/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/lib/python3.8/site-packages/*.dist-info /home/tkloczko/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/lib64/python3.8/site-packages/*.dist-info; do
if [ -f ${distinfo}/direct_url.json ]; then
/usr/bin/rm -fv ${distinfo}/direct_url.json
/usr/bin/sed -i '/direct_url.json/d' ${distinfo}/RECORD
fi
done
And where in that procedure is possibility to plug build and install documentation? For now my template approach of building and installing python module in 95% looks like below: %build
%py3_build
%py3_build_sphinx_man
%install
%py3_install
%__install build/sphinx/man/*.3 -Dt %{buildroot}%{_mandir}/man3
%check
%pytest With [tkloczko@barrel SPECS]$ rpm -E %py3_build_sphinx_man
\
PBR_VERSION=%{version} \
SETUPTOOLS_SCM_PRETEND_VERSION=%{version} \
SPHINXOPTS="-j48" \
/usr/bin/python3 setup.py build_sphinx -b man --build-dir build/sphinx Please don't get me wrong. I'm not trying to complain. I'm still assuming that I'm not fully understand sentence repeated as answer on many of my questions that "setuptools is buggy". And again .. I'm not trying complain. As I'm working on all necessary rpm and Solaris IPS packages python modules ONLY a little longer than half year (to be homnest more like 8-9 months already) [1] I'm still assuming that I do not fully understand why all python OSS developers are going to abandon something WHICH IS WORKING in case of +98% of all python modules and start using something which is COMPLETLY useless on operations so elementary/basic like predictable build and install documentation. Please correct me if I'm wrong and point on exact setuptool ticket(s) which caused that some people started thinking about adding that additional abstraction layer with PEP517, build, install which more or less is trying somehow to wipe out setuptools. Why if setuptools was and/or still is somehow buggy no one is able to fix that? "Quid est veritas?"🤔 [1] during that time I was able to finish about ~570 python modules spec files which I'm using to build Linux rpm and Solaris IPS packages (using pkgbuild written in perl and some clever |
Yes, you do not fully understand. setuptools is not going anywhere - in fact, it's being actively maintained. They added a layer of abstraction on top of it so people could use different backends for different needs, because it turns out that There Is No Silver Bullet™. This is a good thing, not a bad thing. As you said earlier:
Regardless of whether this happens or not, you will have more and more problems if you keep relying on projects using As a final remark, I think you should reconsider including walls of text about automake, jokes about "maniac homosexual guys", sentences full of all caps (which is bad netiquette, as it is considered equivalent to shouting or yelling), and such. I found your last comment very distressing to read, and I personally don't want to continue engaging in these terms. |
This link does not provide anything new about what I still do not understand.
This link contains details about how to still use setuptools with project.toml.
Off topic: More people would know all that if they will have at least a bit broader history education in elementary schools like I had and as still it is in Poland. By that, I don't want to say that I'm somehow better. I wish only to say that knowledge is a real power that may change context .. and understanding of some situations. Today I'm living in the UK (already 11 years) and when I met first time one of my best friends (he is from Taiwan) I told him a joke about people from China (why they do have not straight eyes). All Brits around us were shocked (yeah .. some political correctness idiocy is really killing brits), and he .. he was almost rolling on the floor because he never heard that joke🤣😂 Quoting Ricky Gervais from the Oscar nominations ceremony "Remember. These are only jokes .. we all going to die". I think this may explain some context why I quoted that joke. At the end of the day, all we need to solve some everyday problem is the pinch of rationality .. only this and nothing more😊 So going back to the subject (sorry for probably to long explanation) still I don't know how NewWay™️ could improve building documentation because looks like that new procedure do not care to much (if not at all) about such bits like documentation. New procedure seems is mostly about add new module format metadata (part of which are checksums), some standardisation about dependencies definition and possibility to use other that setuptools backed. Sorry for that I throwing all those questions but all that NewWay™️ combined with forced SCM based builds is 100% orthogonal. At least for now It adds only complexity and nothing more. |
This is not a good place to discuss the standardization of the packaging. So nobody can't conclude this discussion. What we can determine is only what Sphinx should do. IMO, it's not so wrong to add a new option to append the build-lib path to sys.path to build_sphinx. But it will not work without setuptools. So it does not mean we can use it on every project everywhere. It's a different topic. |
I've started moving away from use setuptools<>sphinx integration as more and more modules have no setup.py file and I've started using straight Feel free to close that ticket. |
Thank you for your comment. Closing this now. |
Describe the bug
Example agronholm/anyio#354
Currently many modules relocates its own source code to
src/
directory. In most of the casessetup.py build_sphinx
fails because looks likebuild_sphinx
assumes that source code will be in `<module_name/> in project root directory.Q: what should be kind of generic solution in such cases?
How to Reproduce
Expected behavior
sphinx-build should build documentation.
Your project
N/A
Screenshots
OS
Linux/x86_64
Python version
3.8.11
Sphinx version
4.1.1
Sphinx extensions
N/A
Extra tools
N/A
Additional context
I think that this is partially related to more generic case described in #9378
adding
build/lib
andbuild/lib-<os>.<arch>
tosys.path
could IMO solve both cases when module consist of DSOs are build and actual source code of the module is not<module_name/>
directory.The text was updated successfully, but these errors were encountered: