Skip to content

Single-source package version via setuptools dynamic versioning#850

Open
anevolbap wants to merge 1 commit into
pymc-labs:mainfrom
anevolbap:issue_155-dynamic_version
Open

Single-source package version via setuptools dynamic versioning#850
anevolbap wants to merge 1 commit into
pymc-labs:mainfrom
anevolbap:issue_155-dynamic_version

Conversation

@anevolbap

Copy link
Copy Markdown
Collaborator

Summary

Single-source the package version from causalpy/version.py using setuptools dynamic versioning. Removes the duplicate version = "0.8.0" from pyproject.toml.

Fixes #155

Changes

  • Replace static version in [project] with dynamic = ["version"]
  • Add [tool.setuptools.dynamic] section pointing to causalpy.version.__version__

Testing

  • pip install -e . resolves version correctly
  • python -c "import causalpy; print(causalpy.__version__)" returns 0.8.0
  • importlib.metadata.metadata('CausalPy')['Version'] returns 0.8.0
  • All pre-commit hooks pass (--all-files)
  • Full test suite passes (799 passed, 5 skipped)

Checklist

  • No new dependencies
  • Pre-commit hooks pass
  • Editable install works
  • Package metadata resolves correctly

@github-actions

Copy link
Copy Markdown
Contributor

👋 Welcome to CausalPy, @anevolbap!

Thank you for opening your first pull request! We're excited to have you contribute to the project. 🎉

Here are a few tips to help your PR get merged smoothly:

  • ✅ Make sure all CI checks pass (tests, linting, type checking)
  • 📝 Run prek run --all-files locally before pushing
  • 📖 Check our Contributing Guide for more details

A maintainer will review your changes soon. Thanks for helping make CausalPy better! 🚀


💼 LinkedIn Shoutout: Once your PR is merged, we'd love to give you a shoutout on LinkedIn to thank you for your contribution! If you're interested, just drop your LinkedIn profile URL in a comment below.

@read-the-docs-community

read-the-docs-community Bot commented Apr 15, 2026

Copy link
Copy Markdown

Documentation build overview

📚 causalpy | 🛠️ Build #33074668 | 📁 Comparing 8c7bed5 against latest (1cf3387)

  🔍 Preview build  

249 files changed · + 58 added · ± 190 modified · - 1 deleted

+ Added

± Modified

- Deleted

@codecov

codecov Bot commented Apr 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.51%. Comparing base (13af0ef) to head (5f5ca1a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #850   +/-   ##
=======================================
  Coverage   95.51%   95.51%           
=======================================
  Files          98       98           
  Lines       15868    15868           
  Branches      931      931           
=======================================
  Hits        15157    15157           
  Misses        504      504           
  Partials      207      207           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anevolbap anevolbap marked this pull request as draft April 16, 2026 10:59
@anevolbap anevolbap marked this pull request as ready for review April 25, 2026 20:02
@anevolbap

anevolbap commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator Author

@drbenvincent this is ready for review. CI fully green.

Heads-up on the approach choice: the #155 thread floated flit, setuptools-scm, and bump2version. This PR sticks with the existing setuptools backend and just adds [tool.setuptools.dynamic]. Minimal change, no backend migration. Both read paths verified: causalpy.__version__ and importlib.metadata.metadata('CausalPy')['Version'] return 0.8.0. Thanks!

@drbenvincent

Copy link
Copy Markdown
Collaborator

Thanks @anevolbap — this is a clean, well-scoped change for #155. CI is green but the last run is from late April and the branch is now ~39 commits behind main, so those checks no longer validate against current packaging. Could you sync the branch with main (merge or rebase) so CI re-runs against the latest? Once it's green I'll review and we can get this merged.

@anevolbap anevolbap force-pushed the issue_155-dynamic_version branch from 9d13f20 to 8c7bed5 Compare June 10, 2026 12:13
@anevolbap

anevolbap commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

> Thanks @anevolbap — this is a clean, well-scoped change for #155. CI is green but the last run is from late April and the branch is now ~39 commits behind main, so those checks no longer validate against current packaging. Could you sync the branch with main (merge or rebase) so CI re-runs against the latest? Once it's green I'll review and we can get this merged.

Green, ready to merge.

@drbenvincent

Copy link
Copy Markdown
Collaborator

Automated triage

Recommendation: review:high — no decision gate identified.

Why:

  • Changes pyproject.toml build configuration: replaces static version with dynamic = ["version"] pointing to causalpy/version.py.
  • Affects the PyPI release workflow and package metadata — a release/deployment change.
  • All CI checks pass, but PR is blocked (merge conflict).

Review focus:

  1. Verify that setuptools dynamic versioning correctly resolves the version in all packaging scenarios (sdist, wheel, editable install, pip).
  2. Check that the causalpy/version.py file exists and is not accidentally excluded from the package.
  3. Confirm the PyPI release CI workflow still works with dynamic versioning.

Confidence: high

@drbenvincent drbenvincent added the review:high High-impact change requiring thorough human review label Jul 14, 2026
@anevolbap anevolbap force-pushed the issue_155-dynamic_version branch from 8c7bed5 to 5f5ca1a Compare July 14, 2026 11:28
@anevolbap

anevolbap commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

Synced with main: rebased the single commit onto current main (clean, no conflicts) and re-ran CI. All checks pass. The two skipped jobs are the release-only Test PyPI / PyPI publish steps.

Verified the dynamic-versioning packaging paths:

  • python -m build produces causalpy-0.8.0.tar.gz and causalpy-0.8.0-py3-none-any.whl; sdist PKG-INFO and wheel METADATA both report Version: 0.8.0.
  • causalpy/version.py ships in both sdist and wheel (packages.find only excludes test*/docs*).
  • Fresh wheel install and pip install -e . both resolve importlib.metadata.version("CausalPy") == "0.8.0".
  • The release workflow build job (build sdist+wheel, install, import, version-check) passes. The Test PyPI / publish jobs are release-event-gated, so this PR exercises everything except the upload itself.

One note: the version comes from causalpy/version.py, not from git tags, so releases still need version.py bumped before tagging (same as today). The gain is that the wheel/sdist metadata version can no longer drift from causalpy.__version__, since both derive from that file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops DevOps related review:high High-impact change requiring thorough human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

try to get dynamic version in pyproject.toml

2 participants