From e46bdf276c81d362f50c87f85e21a916a5636b7a Mon Sep 17 00:00:00 2001 From: b-long Date: Mon, 8 Sep 2025 19:56:09 -0400 Subject: [PATCH 1/8] chore: prevent TestPyPI publishing <= 0.3.2 --- .github/workflows/release-please.yaml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index d7c425a..d2cef6d 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -75,12 +75,34 @@ jobs: run: | uv run python -c 'import otdf_python; print("Package imported successfully")' - - name: Store version + # While we improve the release process, prevent publishing to TestPyPI for versions <= 0.3.2 + - name: Store version and determine if should publish to TestPyPI + id: check_version shell: bash run: | PROJECT_VERSION=$(uv version --short) echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV + # Remove any alpha/beta/rc suffixes for comparison + CLEAN_VERSION=$(echo "$PROJECT_VERSION" | sed 's/[a-zA-Z].*//') + echo "clean_version=$CLEAN_VERSION" >> $GITHUB_OUTPUT + + # Convert versions to comparable format (e.g., "0.3.2" -> "000300020000") + version_to_number() { + echo "$1" | awk -F. '{ printf("%04d%04d%04d\n", $1,$2,$3); }' + } + + CURRENT_NUM=$(version_to_number "$CLEAN_VERSION") + THRESHOLD_NUM=$(version_to_number "0.3.2") + + if [ "$CURRENT_NUM" -gt "$THRESHOLD_NUM" ]; then + echo "should_publish=true" >> $GITHUB_OUTPUT + echo "Version $PROJECT_VERSION (clean: $CLEAN_VERSION) is > 0.3.2, will publish to TestPyPI" + else + echo "should_publish=false" >> $GITHUB_OUTPUT + echo "Version $PROJECT_VERSION (clean: $CLEAN_VERSION) is <= 0.3.2, skipping TestPyPI publish" + fi + # For develop branch: trigger TestPyPI build (both alpha and stable releases go to TestPyPI from develop) # Publish with "trusted publisher" mechanism: @@ -89,7 +111,7 @@ jobs: # Requires GHA token permission (above in YAML) and PyPI management: # https://test.pypi.org/manage/project/otdf-python/settings/publishing/ - name: Publish package distributions to TestPyPI - if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/chore/update-docs-and-release-process' + if: (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/chore/update-docs-and-release-process') && steps.check_version.outputs.should_publish == 'true' uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ From f2d56d378be662ef1de3089b60446c2e413ccd29 Mon Sep 17 00:00:00 2001 From: b-long Date: Tue, 9 Sep 2025 12:31:42 -0400 Subject: [PATCH 2/8] chore: update .pre-commit-config.yaml --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index de489ad..efbe70b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,4 +40,4 @@ repos: hooks: - id: conventional-pre-commit stages: [commit-msg,post-rewrite] - args: [--verbose,--scopes=feat,fix,docs,style,test,chore,ci] + args: [--verbose,--scopes="feat,fix,docs,style,test,chore,ci"] From 8534a7f2f33a13522215168b3c83ba07dc08996d Mon Sep 17 00:00:00 2001 From: b-long Date: Tue, 9 Sep 2025 12:36:04 -0400 Subject: [PATCH 3/8] chore: align versions --- .release-please-manifest.json | 4 ++-- otdf-python-proto/pyproject.toml | 2 +- otdf-python-proto/src/otdf_python_proto/__init__.py | 2 +- otdf-python-proto/uv.lock | 2 +- pyproject.toml | 2 +- src/otdf_python/cli.py | 2 +- tests/test_cli.py | 2 +- uv.lock | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9bcd485..2ba2825 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,4 +1,4 @@ { - ".": "0.3.1", - "otdf-python-proto": "0.3.1" + ".": "0.3.2", + "otdf-python-proto": "0.3.2" } diff --git a/otdf-python-proto/pyproject.toml b/otdf-python-proto/pyproject.toml index f120b6e..69a6318 100644 --- a/otdf-python-proto/pyproject.toml +++ b/otdf-python-proto/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "otdf-python-proto" -version = "0.3.1" +version = "0.3.2" description = "Generated protobuf files for OpenTDF Python SDK" readme = "README.md" authors = [ diff --git a/otdf-python-proto/src/otdf_python_proto/__init__.py b/otdf-python-proto/src/otdf_python_proto/__init__.py index 3bfcae0..86c022e 100644 --- a/otdf-python-proto/src/otdf_python_proto/__init__.py +++ b/otdf-python-proto/src/otdf_python_proto/__init__.py @@ -5,7 +5,7 @@ and other OpenTDF services. """ -__version__ = "0.3.1" +__version__ = "0.3.2" # Import submodules to make them available from . import authorization diff --git a/otdf-python-proto/uv.lock b/otdf-python-proto/uv.lock index d410e13..e9684c4 100644 --- a/otdf-python-proto/uv.lock +++ b/otdf-python-proto/uv.lock @@ -481,7 +481,7 @@ wheels = [ [[package]] name = "otdf-python-proto" -version = "0.3.0" +version = "0.3.2" source = { editable = "." } dependencies = [ { name = "connect-python", extra = ["compiler"] }, diff --git a/pyproject.toml b/pyproject.toml index aa396f2..3aa1103 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "otdf-python" -version = "0.3.1" +version = "0.3.2" description = "Unofficial OpenTDF SDK for Python" readme = "README.md" authors = [ diff --git a/src/otdf_python/cli.py b/src/otdf_python/cli.py index a612ec5..a8df80b 100644 --- a/src/otdf_python/cli.py +++ b/src/otdf_python/cli.py @@ -22,7 +22,7 @@ # Version - get from project metadata -__version__ = "0.3.0" +__version__ = "0.3.2" # Set up logging diff --git a/tests/test_cli.py b/tests/test_cli.py index e056ad6..afd9a70 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -35,7 +35,7 @@ def test_cli_version(): ) assert result.returncode == 0 assert "OpenTDF Python SDK" in result.stdout - assert "0.3.0" in result.stdout + assert "0.3.2" in result.stdout def test_cli_encrypt_help(): diff --git a/uv.lock b/uv.lock index ecda95b..b6c48c5 100644 --- a/uv.lock +++ b/uv.lock @@ -686,7 +686,7 @@ wheels = [ [[package]] name = "otdf-python" -version = "0.3.1" +version = "0.3.2" source = { editable = "." } dependencies = [ { name = "connect-python", extra = ["compiler"] }, From 08dba5823228454a0d98ab4f01ae0f89f30b04ab Mon Sep 17 00:00:00 2001 From: b-long Date: Tue, 9 Sep 2025 12:37:11 -0400 Subject: [PATCH 4/8] chore: ensure future version alignment --- .release-please-config.json | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.release-please-config.json b/.release-please-config.json index 885f1d0..67235db 100644 --- a/.release-please-config.json +++ b/.release-please-config.json @@ -12,19 +12,12 @@ "pyproject.toml", "src/otdf_python/cli.py", "tests/test_cli.py", - "RELEASES.md", + "otdf-python-proto/pyproject.toml", { "path": "uv.lock", "type": "toml", "jsonpath": "$.package[?(@.name.value=='otdf-python')].version" - } - ] - }, - "otdf-python-proto": { - "release-type": "python", - "package-name": "otdf-python-proto", - "extra-files": [ - "otdf-python-proto/pyproject.toml", + }, { "path": "otdf-python-proto/uv.lock", "type": "toml", From e03a6cf18b20ace86ea6a028e0b9b6b6158bae22 Mon Sep 17 00:00:00 2001 From: b-long Date: Tue, 9 Sep 2025 14:02:40 -0400 Subject: [PATCH 5/8] chore: comment unused GHA step --- .github/workflows/build-python.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-python.yaml b/.github/workflows/build-python.yaml index 5d9d0c6..28a4a8e 100644 --- a/.github/workflows/build-python.yaml +++ b/.github/workflows/build-python.yaml @@ -34,9 +34,9 @@ jobs: echo "wheel_path=$wheel_path" >> $GITHUB_OUTPUT shell: bash - - name: Upload wheel as artifact - uses: actions/upload-artifact@v4 - with: - name: python-wheel - path: dist/*.whl - overwrite: true + # - name: Upload wheel as artifact + # uses: actions/upload-artifact@v4 + # with: + # name: python-wheel + # path: dist/*.whl + # overwrite: true From 2f4b384a34c75a93e851266e6fb47877e410043c Mon Sep 17 00:00:00 2001 From: b-long Date: Wed, 10 Sep 2025 09:07:51 -0400 Subject: [PATCH 6/8] chore: simplify version parsing --- .github/workflows/release-please.yaml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index d2cef6d..ca2fd29 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -45,19 +45,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Check if alpha release - id: check_alpha - run: | - # Get the version from the main package - VERSION=$(cat .release-please-manifest.json | jq -r '."."') - echo "version=$VERSION" >> $GITHUB_OUTPUT - if [[ "$VERSION" =~ [0-9]+\.[0-9]+\.[0-9]+a[0-9]+ ]]; then - echo "is_alpha=true" >> $GITHUB_OUTPUT - echo "Alpha version detected: $VERSION" - else - echo "is_alpha=false" >> $GITHUB_OUTPUT - echo "Stable version detected: $VERSION" - fi + - name: Install uv @@ -83,6 +71,14 @@ jobs: PROJECT_VERSION=$(uv version --short) echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV + if [[ "$PROJECT_VERSION" =~ [0-9]+\.[0-9]+\.[0-9]+a[0-9]+ ]]; then + echo "is_alpha=true" >> $GITHUB_OUTPUT + echo "Alpha version detected: $PROJECT_VERSION" + else + echo "is_alpha=false" >> $GITHUB_OUTPUT + echo "Stable version detected: $PROJECT_VERSION" + fi + # Remove any alpha/beta/rc suffixes for comparison CLEAN_VERSION=$(echo "$PROJECT_VERSION" | sed 's/[a-zA-Z].*//') echo "clean_version=$CLEAN_VERSION" >> $GITHUB_OUTPUT From b450223be66b2030879c076e13b66d18bb63af64 Mon Sep 17 00:00:00 2001 From: b-long Date: Wed, 10 Sep 2025 09:35:50 -0400 Subject: [PATCH 7/8] chore: add tomli for Python < 3.11 --- pyproject.toml | 1 + uv.lock | 2 ++ 2 files changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 3aa1103..2c9dac0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ dev = [ "pytest>=8.4.1", "respx>=0.21.1", "ruff>=0.12.10", + "tomli>=2.2.1 ; python_full_version < '3.11'", ] [tool.pytest.ini_options] diff --git a/uv.lock b/uv.lock index b6c48c5..7c3a904 100644 --- a/uv.lock +++ b/uv.lock @@ -707,6 +707,7 @@ dev = [ { name = "pytest" }, { name = "respx" }, { name = "ruff" }, + { name = "tomli", marker = "python_full_version < '3.11'" }, ] [package.metadata] @@ -729,6 +730,7 @@ dev = [ { name = "pytest", specifier = ">=8.4.1" }, { name = "respx", specifier = ">=0.21.1" }, { name = "ruff", specifier = ">=0.12.10" }, + { name = "tomli", marker = "python_full_version < '3.11'", specifier = ">=2.2.1" }, ] [[package]] From f569857dbeb5fc9d90dca235b2ad575072556915 Mon Sep 17 00:00:00 2001 From: b-long Date: Wed, 10 Sep 2025 09:39:24 -0400 Subject: [PATCH 8/8] fix: get version dynamically in 'test_cli.py' --- .release-please-config.json | 1 - tests/test_cli.py | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.release-please-config.json b/.release-please-config.json index 67235db..7c010ff 100644 --- a/.release-please-config.json +++ b/.release-please-config.json @@ -11,7 +11,6 @@ "extra-files": [ "pyproject.toml", "src/otdf_python/cli.py", - "tests/test_cli.py", "otdf-python-proto/pyproject.toml", { "path": "uv.lock", diff --git a/tests/test_cli.py b/tests/test_cli.py index afd9a70..ae53009 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -35,7 +35,20 @@ def test_cli_version(): ) assert result.returncode == 0 assert "OpenTDF Python SDK" in result.stdout - assert "0.3.2" in result.stdout + + with open(Path(__file__).parent.parent / "pyproject.toml", "rb") as f: + # Use tomli for Python < 3.11, tomllib for 3.11+ + if sys.version_info < (3, 11): + import tomli + + pyproject = tomli.load(f) + else: + import tomllib + + pyproject = tomllib.load(f) + expected_version = pyproject["project"]["version"] + + assert expected_version in result.stdout def test_cli_encrypt_help():