Skip to content

feat: support omitting source in version table when path is declared#301

Merged
frostming merged 3 commits intopdm-project:mainfrom
waketzheng:feat-file-version-pattern
Apr 2, 2026
Merged

feat: support omitting source in version table when path is declared#301
frostming merged 3 commits intopdm-project:mainfrom
waketzheng:feat-file-version-pattern

Conversation

@waketzheng
Copy link
Copy Markdown
Contributor

Description

[project]
dynamic = ['version']

[tool.pdm.version]
path = 'mypkg/__init__.py'

This clearly indicates that the version is dynamically read from the local file mypkg/init.py.
In this case, the source key becomes redundant.

Motivation

hatch support both __version__ and VERSION, and an optional key pattern

I’m not concerned about VERSION or pattern, but being able to omit source is very useful.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 29, 2026

Deploy Preview for pdm-backend-docs ready!

Name Link
🔨 Latest commit 08de77d
🔍 Latest deploy log https://app.netlify.com/projects/pdm-backend-docs/deploys/69cd35400488270008181616
😎 Deploy Preview https://deploy-preview-301--pdm-backend-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@waketzheng
Copy link
Copy Markdown
Contributor Author

@frostming Could you please take a look at this PR? Can it be merged?

@waketzheng waketzheng force-pushed the feat-file-version-pattern branch from 66bb390 to d9939a4 Compare March 31, 2026 11:18
Comment thread src/pdm/backend/hooks/version/__init__.py Outdated
@frostming frostming merged commit 6bb08c3 into pdm-project:main Apr 2, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants