From 7ca8dad1b9e452f0fff2b67e62d5dda7911616b9 Mon Sep 17 00:00:00 2001 From: jsj Date: Sat, 21 Dec 2024 18:30:31 +0100 Subject: [PATCH 1/3] add spacing for readability --- .github/workflows/ci.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c478e52..18d4cc2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,22 +10,28 @@ on: jobs: test: runs-on: ubuntu-latest + strategy: matrix: python-version: ['3.10', '3.11', '3.12'] + steps: - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e .[dev] + - name: Run lint run: | ruff check + - name: Run tests run: | pytest \ No newline at end of file From 612991ebf8088efe338da9c49fa6db489b517959 Mon Sep 17 00:00:00 2001 From: jsj Date: Sat, 21 Dec 2024 18:30:58 +0100 Subject: [PATCH 2/3] proper version --- pyproject.toml | 1 - src/msfabricutils/__init__.py | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 70b50dd..f68b2db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,6 @@ dev = [ ] [tool.setuptools_scm] -version_file = "msfabricutils/_version.py" [tool.ruff] line-length = 100 diff --git a/src/msfabricutils/__init__.py b/src/msfabricutils/__init__.py index 16754ad..65d8dd9 100644 --- a/src/msfabricutils/__init__.py +++ b/src/msfabricutils/__init__.py @@ -1,3 +1,5 @@ +from importlib.metadata import PackageNotFoundError, version + from msfabricutils.common.fabric_duckdb_connection import FabricDuckDBConnection from msfabricutils.core import ( get_fabric_bearer_token, @@ -18,7 +20,9 @@ "get_workspaces", ) + try: - from ._version import version as __version__ # type: ignore -except ImportError: + __version__ = version("msfabricutils") +except PackageNotFoundError: + # package is not installed __version__ = "0.0.0" From fcb62f6b50095eb656e8c2bc109702a24976908c Mon Sep 17 00:00:00 2001 From: jsj Date: Sat, 21 Dec 2024 18:31:44 +0100 Subject: [PATCH 3/3] try dynamic versioning --- .github/workflows/build_and_release.yaml | 38 ++++++++++++------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build_and_release.yaml b/.github/workflows/build_and_release.yaml index 9908128..ca12ba0 100644 --- a/.github/workflows/build_and_release.yaml +++ b/.github/workflows/build_and_release.yaml @@ -1,7 +1,9 @@ name: Build and Upload to PyPI on: - workflow_dispatch: + push: + tags: + - "v*" jobs: build-and-upload: @@ -13,6 +15,9 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Print tag + run: echo ${{ github.ref_name }} + - name: Set up Python uses: actions/setup-python@v5 with: @@ -32,25 +37,20 @@ jobs: run: | pip install pytest pytest -vvvv - - - name: Extract version from pyproject.toml - id: get_version - run: | - echo "VERSION=$(python -c 'import toml; pyproject = toml.load("pyproject.toml"); print(pyproject["project"]["version"])')" >> $GITHUB_ENV - name: Build package run: python -m build --wheel - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: dist - version: ${{ env.VERSION }} - - - name: Create a Release - uses: elgohr/Github-Release-Action@v5 - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - title: Release v${{ env.VERSION }} - tag: v${{ env.VERSION }} \ No newline at end of file + # - name: Publish to PyPI + # uses: pypa/gh-action-pypi-publish@release/v1 + # with: + # packages-dir: dist + # version: ${{ github.ref_name }} + + # - name: Create a Release + # uses: elgohr/Github-Release-Action@v5 + # env: + # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # title: Release ${{ github.ref_name }} + # tag: ${{ github.ref_name }}