Skip to content

Derive __version__ from package metadata - #799

Merged
milton-minervino merged 2 commits into
MAIF:developfrom
milton-minervino:fix/version-metadata
Oct 9, 2026
Merged

milton-minervino merged 2 commits into
MAIF:developfrom
milton-minervino:fix/version-metadata

Conversation

@milton-minervino

@milton-minervino milton-minervino commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

pyproject.toml now uses setuptools-scm for dynamic versioning, but shapash/__version__.py still hard-coded VERSION = (2, 9, 0). As a result, shapash.__version__ stayed at 2.9.0 whatever version was actually built and published.

Changes

  • shapash/__version__.py: read the version with importlib.metadata.version("shapash"), so it always matches the version setuptools-scm puts on the wheel. When the package isn't installed (running from a source tree), it falls back to "0+unknown".
  • tests/unit_tests/utils/test_load_smartpredictor.py: the major/minor version-mismatch tests now patch shapash_version to a fixed value instead of reading the installed version, so they behave the same whether or not shapash is installed.
  • add unit test test_version.py to cover the file.

Impact

  • The SmartPredictor manifest (shapash_version) and its load-time compatibility check now use the real version instead of the stale 2.9.0.
  • The post-publish smoke test (python -c "import shapash; print(shapash.__version__)") now prints the version that was actually released.
  • The "0+unknown" fallback can't be parsed as a version, so in an uninstalled tree the compatibility check is skipped. A fallback like "0.0.0" would have raised a false "Major version mismatch" error there.

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.14%. Comparing base (e9acf55) to head (ca0e498).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #799      +/-   ##
===========================================
+ Coverage    80.13%   80.14%   +0.01%     
===========================================
  Files           59       59              
  Lines         7406     7410       +4     
  Branches      1557     1557              
===========================================
+ Hits          5935     5939       +4     
  Misses         902      902              
  Partials       569      569              
Files with missing lines Coverage Δ
shapash/__version__.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@milton-minervino
milton-minervino merged commit 5341b2b into MAIF:develop Oct 9, 2026
1 check passed
@milton-minervino
milton-minervino deleted the fix/version-metadata branch October 9, 2026 13:31
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