There is no option to make Pybuilder use pre-release versions of modules when resolving dependencies with pip
I am using Pybuilder to develop a project that depends on a library that is being developed concurrently.
In the requirements.txt file I am imposing a condition like this:
sample-library~=0.2.0
Currently, the only 0.2.0 version available on our PyPI clone is 0.2.0.dev20220210180228.
I can install the project's dependencies via pip using the --pre option, but I can't use this feature with Pybuilder: using the python.install_dependencies plugin and the pyb install_dependencies command, this is the output I get:
[INFO] Going to execute task install_dependencies
[INFO] Processing plugin packages 'flake8~=4.0' to be installed with {'upgrade': True}
[INFO] Processing plugin packages 'pypandoc~=1.4' to be installed with {'upgrade': True}
[INFO] Processing plugin packages 'setuptools>=38.6.0' to be installed with {'upgrade': True}
[INFO] Processing plugin packages 'twine>=1.15.0' to be installed with {'upgrade': True}
[INFO] Processing plugin packages 'unittest-xml-reporting~=3.0.4' to be installed with {'upgrade': True}
[INFO] Processing plugin packages 'wheel>=0.34.0' to be installed with {'upgrade': True}
[INFO] Installing all dependencies
[INFO] Processing dependency packages 'requirements.txt' to be installed with {}
------------------------------------------------------------
BUILD FAILED - Unable to install dependency packages into <project-dir>\.venv. Please see '<project-dir>\target\logs\install_dependencies\install_batch' for full details:
Looking in indexes: http://<our-pypi-instance>/repository/pypi-group/simple
ERROR: Could not find a version that satisfies the requirement sample-library~=0.2.0 (from versions: 0.1.0, 0.2.0.dev20220210180228)
ERROR: No matching distribution found for sample-library~=0.2.0
Would it be possible to add an option to pyb that allows pip to be internally invoked with the --pre option?
Thanks, that's a good feature to add. I'll see if I can squeeze this in this weekend.
Thanks a lot!
That said, that particular dependency cannot translate to the actual dependency expression. For example, if I add use_prerelease=True to the project.depends_on() it cannot be translated into the setuptools metadata, as the --pre is the feature of the installer and not the dependency metadata.
What you can do even now, I think, is try to use an expression like <1.0.0.dev0 and then this may cause pip to match 0.0.2.dev1234 without the --pre.
@lormico did it work? :smile:
I want to thank you first for the heads up about the setuptools metadata :)
Unfortunately, setting the requirement expression as <1.0.0.dev0 didn't work, as the sample-library that gets installed is the one with version 0.1.0. Using ~=0.2.0.dev0 though did the trick.