diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 7d4ccf7..34286d8 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -17,6 +17,21 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.11' + + - name: Get version from tag + id: get_version + run: | + VERSION=${GITHUB_REF#refs/tags/v} + echo "VERSION=$VERSION" + echo "VERSION=$VERSION" >> $GITHUB_ENV + shell: bash + + - name: Update version in __init__.py + run: | + sed '/__version__ =/d' python/src/piquant/__init__.py > python/src/piquant/__init__.py.tmp + mv python/src/piquant/__init__.py.tmp python/src/piquant/__init__.py + echo "__version__ = \"$VERSION\"" >> python/src/piquant/__init__.py + shell: bash - name: Install build tools run: | diff --git a/python/pyproject.toml b/python/pyproject.toml index 0ab47d9..8720d70 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pypiquant" -version = "0.1.0" +dynamic = ["version"] authors = [ {name = "Mario Sieg", email = "mario.sieg.64@gmail.com"}, ] @@ -24,6 +24,9 @@ dev = ["pytest","torch","numpy","pre-commit","ruff", "matplotlib", "twine"] line-length = 120 target-version = "py38" +[tool.setuptools.dynamic] +version = {attr = "piquant.__version__"} + [tool.ruff.lint] ignore = ["F403"] select = ["ANN"]