Open IaroslavR opened 4 years ago
That's right, but the docs dependencies won't be pinned then. Read the Docs builds your project with pip, and pip uses Poetry to build a wheel, not for installing. The wheel does not include version pins.
The idea to read pyproject.toml from docs/conf.py for metadata is interesting. Do you have an example? If you install your package for building docs, you could also use importlib.metadata
for that, though.
Many projects use extras for development dependencies, but I'm not a fan of that. I think extras are best used for optional user-facing features. Extras force you to install the package itself, even though you don't need it for many development tasks (e.g. linting, type-checking, code formatting, other static analysis, docs building if you don't need autodoc).
Do you have an example?
https://github.com/IaroslavR/multiconsumers-queue/blob/master/docs/conf.py
That's right, but the docs dependencies won't be pinned then.
See docs build log for the repo above https://readthedocs.org/api/v2/build/10913417.txt Looks like all deps pinned
Reading the package metadata in docs/conf.py
is a great idea! 🚀
As I said earlier, take a look at importlib.metadata. It allows you to read the package metadata directly from your installed package, the way every other packaging tool sees it, using only the standard library, without any need for parsing.
To use it, you also need to configure Read the Docs to use Python 3.8 via .readthedocs.yml
.
Looks like all deps pinned
I was really hoping I would be wrong 😄But the deps are not pinned. Direct dependencies are constrained to major versions, as specified in pyproject.toml. Indirect dependencies ("subdependencies") are constrained by whatever depends on them, if at all. None of the dependencies are locked to a specific version.
Took me a while to find the right pip invocation in the log file, so I pasted it below:
Yep, I see. By idea we can install it from conf.py
this way, with the help of install_with_constraints
trick from your noxfile.py
, but IMO it's a overkill for the most of doc build tasks :)
Hi @cjolowicz ,
Thanks for creating this resource! I've learned a lot from reading your blog posts and the hypermodern-python website.
I recently stumbled upon this comment describing another strategy for integrating poetry dependencies into a readthedocs build. I haven't tried it myself yet, but I think it might read the versions from poetry's lock file? Would this be a viable option?
Hi. Thank you for this great " Hypermodern Python" series.
With setup like this:
we can
pyproject.toml
fromdocs/conf.py
for metadatapyproject.toml
"as is" without additionaldocs/requirements.txt
file