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

Support per-package --prerelease option #774

Closed
agoose77 opened this issue Dec 3, 2021 · 3 comments · Fixed by #779
Closed

Support per-package --prerelease option #774

agoose77 opened this issue Dec 3, 2021 · 3 comments · Fixed by #779
Labels
⭐ enhancement Improvements for existing features

Comments

@agoose77
Copy link
Contributor

agoose77 commented Dec 3, 2021

Is your feature request related to a problem? Please describe.

Poetry provides the user with the ability to specify --prerelease on a per poetry add basis. This is likely more useful than a per-project setting, because (in my experience) most of the time it's only certain packages that should be pre-releases.

Describe the solution you'd like

A --prerelease option for pdm add which allows the user to install pre-releases for the given dependencies. This would require an entry in tool.pdm, e.g. tool.pdm.pre-dependences to store this for future resolutions.

@agoose77 agoose77 added the ⭐ enhancement Improvements for existing features label Dec 3, 2021
@frostming
Copy link
Collaborator

frostming commented Dec 7, 2021

This would require an entry in tool.pdm, e.g. tool.pdm.pre-dependences to store this for future resolutions.

I have a different idea to implement this. We may not need any extra table, --prerelease can be a one-off flag only applicable in pdm add that controls which version is to be pinned in the pyproject.toml.

Say we want to add a package foo whose latest stable is 1.0.0 while the latest prerelease is 1.1.0b1

pdm add foo
# results in:
dependencies = ["foo~=1.0"]
pdm add --prerelease foo
# results in:
dependencies = ["foo>=1.1.0b1,<2.0"]

Because in PEP 440, ~=1.0 doesn't allow prereleases while >=1.1.0b1,<2.0 does. The prerelease flag is indeed saved in the version specifier, we don't need to save it elsewhere.

However, this won't work if you want any future prereleases to be picked but there are only stable releases currently. For example, you add with pdm add --prerelease foo, and there is no prerelease now, but if a new prerelease is published you want to update to that version running pdm update.

@agoose77
Copy link
Contributor Author

agoose77 commented Dec 7, 2021

@frostming this would work!

Maybe there would also be an option for --prerelease with pdm update as well?

@prudnikov
Copy link

Is there any way to make it work with

[tool.pdm.resolution]
allow-prereleases = false

I mean, in the prod environment, I don't want to install pre-releases of 3rd party packages. But I have a dependency from apache-airflow, which in turn depend opentelemetry-semantic-conventions==0.48b0 through other intermediate dependencies. And this package can't be resolved. I can add it to

[tool.pdm.resolution.overrides]
opentelemetry-semantic-conventions = "==0.48b0"

but still can't be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Improvements for existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants