Skip to content

refactor: Centralize version in pyproject.toml#32

Merged
mverteuil merged 2 commits intomainfrom
fix/version-consistency
Feb 23, 2026
Merged

refactor: Centralize version in pyproject.toml#32
mverteuil merged 2 commits intomainfrom
fix/version-consistency

Conversation

@mverteuil
Copy link
Owner

Summary

  • Add __version__ to birdnetpi package using importlib.metadata
  • Update ConfigManager.CURRENT_VERSION to reference birdnetpi.__version__
  • Update manage_translations CLI to reference birdnetpi.__version__
  • Normalize version to PEP 440 format (2.0.0a0)

Why

Previously, the version was hardcoded in three places:

  • pyproject.toml
  • src/birdnetpi/config/manager.py
  • src/birdnetpi/cli/manage_translations.py

This caused inconsistencies and required manual updates in multiple files for each release.

Now there's a single source of truth (pyproject.toml), and all other code references it via birdnetpi.__version__.

Test plan

  • Pre-commit passes
  • Version correctly read at runtime
  • CI passes

- Add __version__ to birdnetpi package using importlib.metadata
- Update ConfigManager to reference birdnetpi.__version__
- Update manage_translations CLI to reference birdnetpi.__version__
- Normalize version to PEP 440 format (2.0.0a0)

This eliminates hardcoded version strings and ensures consistency
across the codebase by having a single source of truth.
The previous commit incorrectly used birdnetpi.__version__ (2.0.0a0)
as the config schema version, but no version handler exists for
alpha/beta versions. The version handler files define the schema
version (2.0.0), which is separate from the package release version.

This change:
- Removes CURRENT_VERSION class attribute that pulled from __version__
- Adds current_version property that uses registry.get_current_version()
- Updates references from self.CURRENT_VERSION to self.current_version
- Updates release checklist to reflect version handler as source of truth

The version handler files (e.g., v2_0_0.py) are now the single source
of truth for configuration schema versions.
@mverteuil mverteuil merged commit 532faf4 into main Feb 23, 2026
4 checks passed
@mverteuil mverteuil deleted the fix/version-consistency branch February 23, 2026 21:33
mverteuil added a commit that referenced this pull request Feb 23, 2026
- Add version header validation to _check_pot_freshness
- Add entry flags validation (python-format, no-python-format, etc.)
- Extract helper functions for version, msgid, and flag checking
- Update POT and PO files to use correct version (2.0.0a0)
- Update tests to use proper POT header template with version

The check command now validates:
- msgid completeness (existing)
- Header version matches package version (new)
- Entry flags match freshly extracted POT (new)

This ensures the translation workflow produces consistent results
and catches version mismatches introduced by PR #32.
mverteuil added a commit that referenced this pull request Feb 23, 2026
- Add version header validation to _check_pot_freshness
- Add entry flags validation (python-format, no-python-format, etc.)
- Extract helper functions for version, msgid, and flag checking
- Update POT and PO files to use correct version (2.0.0a0)
- Update tests to use proper POT header template with version

The check command now validates:
- msgid completeness (existing)
- Header version matches package version (new)
- Entry flags match freshly extracted POT (new)

This ensures the translation workflow produces consistent results
and catches version mismatches introduced by PR #32.
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.

1 participant