feat: expose package version from metadata#398
Open
haosenwang1018 wants to merge 1 commit intoilluin-tech:mainfrom
Open
feat: expose package version from metadata#398haosenwang1018 wants to merge 1 commit intoilluin-tech:mainfrom
haosenwang1018 wants to merge 1 commit intoilluin-tech:mainfrom
Conversation
ManuelFay
requested changes
Mar 4, 2026
Collaborator
ManuelFay
left a comment
There was a problem hiding this comment.
I made a few comments. Overall, not too sure on what's the standard way to do expose the version, @pdesgarets happy to have your input
|
|
||
| from .models import * | ||
|
|
||
| try: |
Collaborator
There was a problem hiding this comment.
A few things:
-
I would assume you need the pypy distribution name right ? so colpali-engine and not colpali_engine
-
the other imports surely need to be under, it feels like there could be some dangerous behavior in the future if any model files use some branching based on versions.
Proposed fix:
from importlib.metadata import PackageNotFoundError, version
try:
__version__ = version("colpali-engine")
except PackageNotFoundError:
__version__ = "0.0.0"
from .models import *
Collaborator
|
@haosenwang1018 what is the point here ? Since you can check the package version yourself based on the code you propose ? Any point to having this be directly integrated ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
__version__incolpali_engine.__init__importlib.metadata.version("colpali_engine")0.0.0) when metadata is unavailableWhy
This provides a stable, standard way to introspect the installed package version at runtime.
Testing