Skip to content
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

There is no option to make Pybuilder use pre-release versions of modules when resolving dependencies with pip #849

Open
lormico opened this issue Feb 11, 2022 · 5 comments

Comments

@lormico
Copy link
Contributor

lormico commented Feb 11, 2022

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?

@arcivanov
Copy link
Member

Thanks, that's a good feature to add. I'll see if I can squeeze this in this weekend.

@lormico
Copy link
Contributor Author

lormico commented Feb 11, 2022

Thanks a lot!

@arcivanov
Copy link
Member

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.

@arcivanov
Copy link
Member

@lormico did it work? 😄

@lormico
Copy link
Contributor Author

lormico commented Feb 11, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants