From 84cea27b240cf101a2c240e6e917c64b8982c8c7 Mon Sep 17 00:00:00 2001 From: Daniel Pressler Date: Fri, 31 Jul 2026 10:16:09 -0700 Subject: [PATCH 1/2] Add GitHub workflows --- .github/dependabot.yml | 10 +++++ .github/workflows/pypi.yml | 51 ++++++++++++++++++++++++ .github/workflows/tests.yml | 77 +++++++++++++++++++++++++++++++++++++ noxfile.py | 4 +- 4 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/pypi.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e2c01cb --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + groups: + actions-versions: + patterns: + - "*" diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..17c5a95 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,51 @@ +name: Publish to PyPI + +on: workflow_dispatch + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Set up Python + uses: actions/setup-python@v7 + with: + python-version: "3.x" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v7 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: Publish to PyPI + if: startsWith(github.ref, 'refs/tags/v') + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/sarkit-processing + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v8 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..7f14f44 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,77 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Tests + +on: + push: + pull_request: + branches: [ "main" ] + +jobs: + lint_and_docs: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v7 + with: + lfs: false # Save GitHub LFS bandwidth + + - name: Setup PDM and Python + uses: pdm-project/setup-pdm@v4 + with: + python-version: 3.14 + - name: Install dependencies + run: | + pdm lock -G :all + pdm sync --no-default -G test + - name: Lint + run: pdm run nox -s lint + + + min_env_tests: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + + steps: + - name: checkout + uses: actions/checkout@v7 + with: + lfs: false # Save GitHub LFS bandwidth + - name: Setup PDM and Python + uses: pdm-project/setup-pdm@v4 + with: + python-version: 3.12 + - name: Install dependencies + run: | + pdm lock -G :all --strategy direct_minimal_versions + pdm sync --no-default -G test + - name: Run tests + run: pdm run nox -s test + + + current_env_tests: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + + steps: + - name: checkout + uses: actions/checkout@v7 + with: + lfs: false # Save GitHub LFS bandwidth + - name: Setup PDM and Python + uses: pdm-project/setup-pdm@v4 + with: + python-version: 3.14 + - name: Install dependencies + run: | + pdm lock -G :all + pdm sync --no-default -G test + - name: Run tests + run: pdm run nox -s test diff --git a/noxfile.py b/noxfile.py index cb05a38..ce4e4e6 100644 --- a/noxfile.py +++ b/noxfile.py @@ -13,14 +13,14 @@ @nox.session def format(session): - session.run_install("pdm", "sync", external=True) + session.run_install("pdm", "sync", "-G", "lint", external=True) session.run("ruff", "check", "--fix") session.run("ruff", "format") @nox.session def lint(session): - session.run_install("pdm", "sync", "-G", "all", external=True) + session.run_install("pdm", "sync", "-G", "lint", external=True) session.run("ruff", "check") session.run( "ruff", From a1146f7172576930eb8d826a229ce0c6414a53fe Mon Sep 17 00:00:00 2001 From: Daniel Pressler Date: Fri, 31 Jul 2026 13:40:04 -0700 Subject: [PATCH 2/2] try to mollify the windows testing --- sarkit_processing/_geometry_utils.py | 3 ++- tests/test_coords.py | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/sarkit_processing/_geometry_utils.py b/sarkit_processing/_geometry_utils.py index 2943b11..692403e 100644 --- a/sarkit_processing/_geometry_utils.py +++ b/sarkit_processing/_geometry_utils.py @@ -110,7 +110,8 @@ def read_coordinates(filename_or_string): try: with open(filename_or_string, "r") as file: contents = file.read() - except (OSError, FileNotFoundError): + except (OSError, FileNotFoundError, ValueError): + # at some point, smart_open[http] on windows was raising a ValueError pass return decode_coordinates(contents) diff --git a/tests/test_coords.py b/tests/test_coords.py index 04900e0..19f482b 100644 --- a/tests/test_coords.py +++ b/tests/test_coords.py @@ -160,7 +160,7 @@ def test_cli(example_sicd, tmp_path): "skp", "coords", "--sicd", - example_sicd, + str(example_sicd), "--to-cs", "rowcol", geojson_str, @@ -178,7 +178,7 @@ def test_cli(example_sicd, tmp_path): "sarkit_processing", "coords", "--sicd", - xml_file, + str(xml_file), "--to-cs", "rowcol", "-", @@ -199,10 +199,10 @@ def test_cli(example_sicd, tmp_path): "sarkit_processing", "coords", "--sicd", - example_sicd, + str(example_sicd), "--to-cs", "rowcol", - geojson_file, + str(geojson_file), ], capture_output=True, check=True, @@ -225,7 +225,7 @@ def test_cli(example_sicd, tmp_path): "sarkit_processing", "coords", "--sicd", - example_sicd, + str(example_sicd), "--to-cs", "xrowycol", geojson_str, @@ -247,7 +247,7 @@ def test_cli(example_sicd, tmp_path): "sarkit_processing", "coords", "--sicd", - example_sicd, + str(example_sicd), "--from-cs", "lonlathae", "--to-cs", @@ -272,7 +272,7 @@ def test_cli(example_sicd, tmp_path): "sarkit_processing", "coords", "--sicd", - example_sicd, + str(example_sicd), "--from-cs", "ecef", "--to-cs", @@ -297,7 +297,7 @@ def test_cli(example_sicd, tmp_path): "sarkit_processing", "coords", "--sicd", - example_sicd, + str(example_sicd), "--from-cs", "lonlathae", "--to-cs", @@ -323,7 +323,7 @@ def test_cli_empty(example_sicd): "sarkit_processing", "coords", "--sicd", - example_sicd, + str(example_sicd), "--from-cs", "ecef", "--to-cs",