Skip to content

feat: expose package version from metadata#398

Open
haosenwang1018 wants to merge 1 commit intoilluin-tech:mainfrom
haosenwang1018:chore/export-version-from-metadata
Open

feat: expose package version from metadata#398
haosenwang1018 wants to merge 1 commit intoilluin-tech:mainfrom
haosenwang1018:chore/export-version-from-metadata

Conversation

@haosenwang1018
Copy link

Summary

  • add __version__ in colpali_engine.__init__
  • resolve the version using importlib.metadata.version("colpali_engine")
  • add a safe fallback (0.0.0) when metadata is unavailable

Why

This provides a stable, standard way to introspect the installed package version at runtime.

Testing

  • additive change only
  • import surface remains backward-compatible

Copy link
Collaborator

@ManuelFay ManuelFay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Collaborator

@ManuelFay ManuelFay Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things:

  1. I would assume you need the pypy distribution name right ? so colpali-engine and not colpali_engine

  2. 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 * 

@ManuelFay ManuelFay requested a review from pdesgarets March 4, 2026 14:21
@ManuelFay
Copy link
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 ?

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