Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.
Defining setup.py dependencies using a URL#
For sqlite-utils issue 464 I implemented a fix to a tiny bug in a dependency in my own fork on GitHub.
I wanted to use my fork as a dependency when I ran my build on ReadTheDocs - but for that particular project the ReadTheDocs dependencies are installed using the equivalent of pip install '.[docs]' (by this configuration) - and that docs set of extra requirements was defined in my setup.py file like this:
1 extras_require={2 "test": ["pytest", "black", "hypothesis", "cogapp"],3 "docs": ["furo", "sphinx-autobuild", "codespell", "sphinx-copybutton"],4 "mypy": [5 "mypy",6 "types-click",7 "types-tabulate",8 "types-python-dateutil",9 "data-science-types",10 ],11 "flake8": ["flake8"],12 },Any branch on GitHub can be installed by pip by finding the URL to the zip export of that branch. In this case that URL is:
https://github.com/simonw/beanbag-docutils/archive/refs/heads/bytes-in-url.zip
I tried adding that into the list of strings defined for the "docs" bundle and got this error when I ran pip install -e '.[docs]':
1Complete output (1 lines):2 error in sqlite-utils setup command: 'extras_require' must be a dictionary3 whose values are strings or lists of strings containing valid project/version requirement specifiers.It turned out the solution was to use packagename @ URL instead, like this:
1 extras_require={2 "test": ["pytest", "black", "hypothesis", "cogapp"],3 "docs": [4 "furo",5 "sphinx-autobuild",6 "codespell",7 "sphinx-copybutton",8 "beanbag-docutils @ https://github.com/simonw/beanbag-docutils/archive/refs/heads/bytes-in-url.zip",9 ]