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
31 changes: 0 additions & 31 deletions .github/actions/build-package/action.yaml

This file was deleted.

101 changes: 56 additions & 45 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,62 @@
name: release

on:
permissions:
contents: read

on:
push:
tags:
- '*'
- "*"

jobs:
release-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/build-package
with:
python-version: '3.11'

- name: Set up a fresh environment and run tests
run: |
python -m venv venv
source venv/bin/activate
pip install dist/*.tar.gz
pip install dist/*.whl
pip install -e '.[test,estimate-area]'
pytest

release:
runs-on: ubuntu-22.04
needs: release-test

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Compare tags
run: |
PKG_VERSION=$(python -c "import pathlib, tomllib; data = tomllib.loads(pathlib.Path('pyproject.toml').read_text()); print(data['project']['version'])")
echo "Checking that package version [v$PKG_VERSION] matches release tag [${{ github.ref_name }}]"
[ "${{ github.ref_type }}" = "tag" ] && [ "${{ github.ref_name }}" = "v$PKG_VERSION" ]

- uses: ./.github/actions/build-package
with:
python-version: '3.11'

- name: Run deployment
run:
twine upload dist/* -r pypi -u __token__ -p ${{ secrets.PYPI_PASSWORD }}
release-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"

- name: Build package
run: uv build

- name: Set up a fresh environment and run tests
run: |
uv venv
uv pip install dist/*.tar.gz
uv pip install dist/*.whl
uv pip install -e '.[test,estimate-area]'
uv run pytest

release:
runs-on: ubuntu-22.04
needs: release-test
steps:
- uses: actions/checkout@v4

- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"

- name: Compare tags
run: |
PKG_VERSION=$(python -c "import pathlib, tomllib; data = tomllib.loads(pathlib.Path('pyproject.toml').read_text()); print(data['project']['version'])")
echo "Checking that package version [v$PKG_VERSION] matches release tag [${{ github.ref_name }}]"
[ "${{ github.ref_type }}" = "tag" ] && [ "${{ github.ref_name }}" = "v$PKG_VERSION" ]

- name: Build package
run: uv build

- name: Install Twine
run: |
uv venv
uv pip install twine

- name: Validate deployment
run: uv run twine check dist/*

- name: Run deployment
run: uv run twine upload dist/* -r pypi -u __token__ -p ${{ secrets.PYPI_PASSWORD }}
20 changes: 10 additions & 10 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Unit test

permissions:
contents: read

on:
push:
branches: ["**"]
Expand All @@ -17,27 +20,24 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e '.[estimate-area]'
pip install pytest pytest-cov pre-commit codecov
run: uv sync --frozen --all-extras --all-groups

- name: Show Python and pytest versions
run: |
python --version
pytest --version
uv run python --version
uv run pytest --version

- name: Run pre-commit checks
run: pre-commit run --all-files
run: uv run pre-commit run --all-files

- name: Run tests with coverage
run: pytest --cov --cov-config=.coveragerc --cov-report=xml
run: uv run pytest --cov --cov-config=.coveragerc --cov-report=xml

- name: List all files in current directory
run: ls -la
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

=======

# 2.2.0 (2026-01-06)
- Use UV

# 2.1.0 (2025-12-24)
- Replace black with ruff

Expand Down
24 changes: 12 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ Hi there! Welcome to the tilesets-cli contributing document. Issues, comments, a

## Installation

First, clone the repo and `cd` into the folder:
Install uv (https://docs.astral.sh/uv/) and then clone the repo and `cd` into the folder:

```bash
# clone
git clone git@github.com:mapbox/tilesets-cli.git
cd tilesets-cli

# virtual env (optional)
mkvirtualenv tilesets-cli
# install deps (creates .venv)
uv sync --group dev

# install deps
pip install -e '.[test]'
# include optional estimate-area dependencies
uv sync --group dev --extra estimate-area

# confirm installation was successful
tilesets --help
tilesets --version
uv run tilesets --help
uv run tilesets --version
```

## Pre-commit hooks

We use [pre-commit hooks](https://pre-commit.com/) to auto-format and validate code before committing. `pre-commit` is included with the `[test]` extras, but you must run:
We use [pre-commit hooks](https://pre-commit.com/) to auto-format and validate code before committing. `pre-commit` is included with the `dev` dependency group, but you must run:

```bash
$ pre-commit install
$ uv run pre-commit install
```
within the repo to have the actions specified in `.pre-commit-config.yaml` registered.

Expand All @@ -47,14 +47,14 @@ Releases to PyPi are handled via Github Actions and GitHub tags. Once changes ha

## Tests

All tests are runnable with pytest. pytest is not installed by default and can be installed with the pip test extras
All tests are runnable with pytest. pytest is installed via the `dev` dependency group:

```shell
pip install -e '.[test]'
uv sync --group dev
```

Running tests

```
pytest
uv run pytest
```
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "mapbox-tilesets"
version = "2.1.0"
version = "2.2.0"
description = "CLI for interacting with and preparing data for the Mapbox Tilesets API"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
Loading