Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/constraints-oldest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Dependency floor for local Python 3.9 compatibility checks. Keep these pins
# together: Torch 2.0 predates NumPy 2's ABI and its Lightning stack has a
# narrower compatibility range than current releases.
numpy<2
torch==2.0.0
torchvision==0.15.1
pytorch-lightning==2.0.9
torchmetrics==1.2.1
31 changes: 25 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,32 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install test runner
run: python -m pip install --upgrade pip pytest
- name: Install CPU PyTorch
run: |
python -m pip install --upgrade pip
python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
- name: Install package
run: python -m pip install --no-deps -e .
run: |
python -m pip install -e '.[dev,cog]'
- name: Syntax check
run: python -m compileall opensr_utils setup.py demo.py tests
run: python -m compileall opensr_utils setup.py tests examples
- name: Shell syntax check
run: bash -n run_batch.sh
- name: Import tests
run: pytest -q
- name: Behavior and CPU integration tests
run: >-
python -m pytest -q
--cov=opensr_utils
--cov-branch
--cov-report=term-missing
--cov-report=xml:coverage-3.12.xml
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-3.12
path: coverage-3.12.xml
if-no-files-found: ignore
- name: Check test quality
run: >-
python -m ruff check opensr_utils tests examples setup.py
&& python -m ruff format --check opensr_utils tests examples setup.py
73 changes: 56 additions & 17 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,64 @@ name: Publish Python Package

on:
release:
types: [created]
types: [published]

permissions:
contents: read

concurrency:
group: pypi-${{ github.event.release.tag_name }}
cancel-in-progress: false

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build distributions
run: python -m build
- name: Validate distributions and release version
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
python -m twine check --strict dist/*
python - <<'PY'
import os
from email.parser import BytesParser
from pathlib import Path
from zipfile import ZipFile

wheel, = Path("dist").glob("*.whl")
with ZipFile(wheel) as archive:
metadata_path, = (
name for name in archive.namelist()
if name.endswith(".dist-info/METADATA")
)
metadata = BytesParser().parsebytes(archive.read(metadata_path))
expected_tag = f"v{metadata['Version']}"
if os.environ["RELEASE_TAG"] != expected_tag:
raise SystemExit(f"Release tag must match package version: {expected_tag}")
PY
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: python-package-${{ github.event.release.tag_name }}
path: dist/*
if-no-files-found: error
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_NON_INTERACTIVE: "1"
run: python -m twine upload dist/*
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ images_other/
inference.py
inf_1.py
inf_2.py
TODO.md
demo_local.py
demo.py
.ruff_cache/

# images
*.tif
Expand Down Expand Up @@ -77,6 +81,7 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
coverage-*.xml
*.cover
.hypothesis/
.pytest_cache/
Expand Down
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ authors:

repository-code: 'https://github.com/ESAOpenSR/opensr-utils'
url: 'https://opensr.eu/'
version: 1.2.0
doi: '10.5281/zenodo.17599310'
date-released: 2025-11-12
version: 2.1.0
doi: '10.5281/zenodo.17599309'
date-released: 2026-10-22

keywords:
- super-resolution
Expand Down
22 changes: 18 additions & 4 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
Copyright 2024 ESA OpenSR
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Copyright (c) 2024 ESA OpenSR

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include run_batch.sh
recursive-include examples *.py *.md
recursive-include tests *.py *.md
include .github/constraints-oldest.txt
exclude demo.py
Loading
Loading