Fixed the bug where pdl.__version__ was not set #882
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It wasn't set previously because importlib searches for the distribution name and not the module's top-level name. Fallbacks are in place to revert to searching for 'pdl', and if that fails, it fallsback to the hardcoded version in _version.py
The value of
pdl.__version__
shows "0.6.0" in my Python package which depends onprompt-declaration-language
library.Notes
Unit-test
The unit-test added with this change doesn't pick up the public version. It returned
0.1.dev1051+ga202a3d
as the version, which is different from the one hardcoded in_version.py
file;0.1.dev1060+g3e3e31c.d20250408
.To avoid test failures, for now and in the near future, the checks I added were to make sure that
pdl.__version__
was notNone
, and that it started with"0.1.dev"
.Testing Done
Unit-test in my package:
The test passed.
Pre-commit in
prompt-declaration-language
libraryPytest in
prompt-declaration-language
libraryNOTE: Any
litellm
related tests fail.