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
58 changes: 28 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,56 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
python-version: ['3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.*"
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .["test"]

- name: Run tests
run: python -m pytest --cov tilebench --cov-report xml --cov-report term-missing
uv sync

- name: run pre-commit
- name: Run pre-commit
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
run: |
python -m pip install pre-commit
pre-commit run --all-files
uv run pre-commit run --all-files

- name: Run tests
run: uv run pytest --cov tilebench --cov-report xml --cov-report term-missing

- name: Upload Results
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v5
with:
file: ./coverage.xml
files: ./coverage.xml
flags: unittests
name: ${{ matrix.python-version }}
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

publish:
needs: [tests]
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.LATEST_PY_VERSION }}
uses: actions/setup-python@v5
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.*"
enable-cache: true
python-version: ${{ env.LATEST_PY_VERSION }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install hatch
python -m hatch build
uv sync --group deploy

- name: Set tag version
id: tag
Expand All @@ -78,28 +75,29 @@ jobs:
- name: Set module version
id: module
run: |
echo "version=$(hatch --quiet version)" >> $GITHUB_OUTPUT
echo "version=$(uv run hatch --quiet version)" >> $GITHUB_OUTPUT

- name: Show version
run: |
echo "${{ steps.tag.outputs.version }}"
echo "${{ steps.module.outputs.version }}"

- name: publish
- name: Build and publish
if: ${{ steps.tag.outputs.version }} == ${{ steps.module.outputs.version}}
env:
HATCH_INDEX_USER: ${{ secrets.PYPI_USERNAME }}
HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m hatch publish
uv run hatch build
uv run hatch publish

publish-docker:
needs: [tests]
if: github.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.12.1
rev: v0.24
hooks:
- id: validate-pyproject

Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
## Unreleased

## 0.17.0 (2025-11-17)

* switch to official python base image over `bitnami`
* switch to preferred `ENV` setting in Dockerfile
* switch to UV for development
* set minimum python version to `>=3.11`

## 0.16.0 (2025-04-30)

Expand Down
14 changes: 10 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,28 @@

Issues and pull requests are more than welcome: https://github.com/developmentseed/tilebench/issues

**dev install**
We recommand using [`uv`](https://docs.astral.sh/uv) as project manager for development.

See https://docs.astral.sh/uv/getting-started/installation/ for installation

### dev install

```bash
git clone https://github.com/developmentseed/tilebench.git
cd tilebench
python -m pip install -e ".[dev,test]"

uv sync
```

You can then run the tests with the following command:

```sh
python -m pytest --cov tilebench --cov-report term-missing -s -vv
uv run pytest --cov tilebench --cov-report term-missing -s -vv
```

This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *black* ("uncompromising Python code formatter") and mypy when committing new code.

```bash
$ pre-commit install
uv run pre-commit install
uv run pre-commit run --all-files
```
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PYTHON_VERSION=3.11
ARG PYTHON_VERSION=3.13

FROM python:${PYTHON_VERSION}
RUN apt update && apt upgrade -y \
Expand Down
36 changes: 14 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "tilebench"
description = "Inspect HEAD/LIST/GET requests withing Rasterio"
requires-python = ">=3.8"
requires-python = ">=3.11"
license = {file = "LICENSE"}
authors = [
{name = "Vincent Sarago", email = "vincent@developmentseed.com"},
Expand All @@ -12,8 +12,6 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
Expand All @@ -25,22 +23,23 @@ dependencies = [
"jinja2>=3.0,<4.0.0",
"loguru",
"rasterio>=1.3.8",
"rio-tiler>=7.0,<8.0",
"rio-tiler>=7.0",
"uvicorn[standard]",
]

[project.optional-dependencies]
test = [
[dependency-groups]
dev = [
"pytest",
"pytest-cov",
"pytest-asyncio",
"requests",
"vsifile",
]
dev = [
"pre-commit",
"bump-my-version",
]
deploy = [
"hatch",
]

[project.urls]
Homepage = 'https://github.com/developmentseed/tilebench'
Expand All @@ -65,25 +64,18 @@ substitutions = [
{pattern = '@@', replacement = '@'},
]

[build-system]
requires = ["hatchling", "hatch-fancy-pypi-readme>=22.5.0"]
build-backend = "hatchling.build"

[tool.hatch.version]
path = "tilebench/__init__.py"

[tool.hatch.build.targets.sdist]
exclude = [
"/tests",
"Dockerfile",
".pytest_cache",
".history",
".github",
".bumpversion.cfg",
".flake8",
".gitignore",
".pre-commit-config.yaml",
]
only-include = ["tilebench/"]

[build-system]
requires = ["hatchling", "hatch-fancy-pypi-readme>=22.5.0"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
only-include = ["tilebench/"]

[tool.isort]
profile = "black"
Expand Down
Loading