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

.dev suffix not correctly recognized as a prerelease in pdm #3282

Closed
1 task
tyong920 opened this issue Nov 13, 2024 · 3 comments
Closed
1 task

.dev suffix not correctly recognized as a prerelease in pdm #3282

tyong920 opened this issue Nov 13, 2024 · 3 comments
Labels
🐛 bug Something isn't working 🤔 waiting for feedback Requires more information to clarify the issue

Comments

@tyong920
Copy link

tyong920 commented Nov 13, 2024

Describe the bug

When using pdm, I noticed that versions with a .dev suffix (e.g., prefect 3.1.3.dev1) are not correctly identified as prerelease versions. From examining the code, it appears that the current logic only recognizes versions with {a|b|rc}N suffixes as prereleases. This means that .dev versions are mistakenly treated as stable releases, which can cause issues when managing dependencies.

To reproduce

  1. Add a dependency with a .dev version, such as prefect 3.1.3.dev1
  2. Attempt to constrain updates to stable releases only
  3. Observe that .dev versions are not treated as prereleases.

Expected Behavior

Versions with a .dev suffix should be identified as prerelease versions, similar to versions with {a|b|rc}N suffixes, to ensure consistency and prevent unstable versions from being installed when only stable releases are desired.

Environment Information

PDM version:
2.20.1
Python Interpreter:
/home/projects/p-g/.venv/bin/python (3.12)
Project Root:
/home/projects/p-g
Local Packages:

{
"implementation_name": "cpython",
"implementation_version": "3.12.4",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_release": "5.4.0-150-generic",
"platform_system": "Linux",
"platform_version": "#167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023",
"python_full_version": "3.12.4",
"platform_python_implementation": "CPython",
"python_version": "3.12",
"sys_platform": "linux"
}

pdm -v output

No response

Additional Context

No response

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.
@tyong920 tyong920 added the 🐛 bug Something isn't working label Nov 13, 2024
@frostming
Copy link
Collaborator

frostming commented Nov 14, 2024

  • Add a dependency with a .dev version, such as prefect 3.1.3.dev1
  • Attempt to constrain updates to stable releases only
  • Observe that .dev versions are not treated as prereleases.

I don't understand these steps, can you make it clear with commands? How did you add the dependency and how did you constrain updates to stable releases only? @tyong920

Basically if a prerelease has been locked in the lock file, following updates will respect and allow prereleases.

@frostming frostming added the 🤔 waiting for feedback Requires more information to clarify the issue label Nov 14, 2024
@tyong920
Copy link
Author

tyong920 commented Nov 14, 2024

@frostming Thank you very much for your prompt response and insightful feedback!

Bingo! Your note, “Basically, if a prerelease has been locked in the lock file, following updates will respect and allow prereleases”, was exactly on point. Following this advice led me to identify the actual root cause: a transitive dependency in our project directly specifies dependencies = ["prefect>=3.0.0rc1"], which permits prerelease versions and is the underlying reason for the unexpected .dev version installations.

Thanks again for your valuable input, which helped clarify this situation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🤔 waiting for feedback Requires more information to clarify the issue
Projects
None yet
Development

No branches or pull requests

2 participants