Skip to content

Querying installed version using importlib.metadata - #3532

Merged
leowerneck merged 1 commit into
IMAP-Science-Operations-Center:devfrom
vineetbansal:vb/issue3531
Oct 2, 2026
Merged

leowerneck merged 1 commit into
IMAP-Science-Operations-Center:devfrom
vineetbansal:vb/issue3531

Conversation

@vineetbansal

Copy link
Copy Markdown
Collaborator

Closes #3531.

The backend poetry_dynamic_versioning.backend is doing the right thing and generating the correct version in the METADATA file. So the entire dance with the _version.py can simply be removed, and the importlib.metadata module used to query this version at runtime.

A test has been added to ensure the correct version (non-zero) is reported after installation.

I've tested the logs produced by imap_cli's processing and they're spitting out the correct version as well.

@leowerneck leowerneck left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Nice solution! Moving it to __init__.py makes it look much less hacky than what I proposed.

@leowerneck
leowerneck merged commit 4b14732 into IMAP-Science-Operations-Center:dev Oct 2, 2026
22 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.

Eliminate generation and packaging of _version.py altogether

2 participants