Skip to content

fix: version fall back when package metadata is unavailable#434

Merged
kingosticks merged 1 commit into
mopidy:mainfrom
adamcik:version-local-fallback
Jun 23, 2026
Merged

fix: version fall back when package metadata is unavailable#434
kingosticks merged 1 commit into
mopidy:mainfrom
adamcik:version-local-fallback

Conversation

@adamcik

@adamcik adamcik commented Jun 22, 2026

Copy link
Copy Markdown
Member

I'm running things with nix these days, which runs without git, which means version might fail. In that case it is better to fallback to a dummy version IMO.

@adamcik adamcik force-pushed the version-local-fallback branch from 52a822a to 13d1b79 Compare June 22, 2026 22:13
@kingosticks kingosticks merged commit 90b4245 into mopidy:main Jun 23, 2026
6 of 8 checks passed
@jodal

jodal commented Jun 24, 2026

Copy link
Copy Markdown
Member

I think we could consider removing __version__ from all of our packages. importlib.metadata.version() is the right way to look up a package version in 2026.

@adamcik

adamcik commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

Sure, but the problem I had is that if that is pulling from git, and we have code that calls version I get in trouble. As typically I'll setup nix flake check which then runs pytest or whatever else in a hermetic env with just minimal deps and no copy of .git.

But if version() was only being called here and nowhere else it effectively solves the problem for me

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.

3 participants