Skip to content

Commit 00cebac

Browse files
authored
Modernize packaging (#206)
* Replace setup.py with pyproject.toml * Bump minimum Python version to 3.10 * Refresh CI harness * Adjust versioning mechanics * Update README
1 parent 3f7584d commit 00cebac

File tree

11 files changed

+77
-103
lines changed

11 files changed

+77
-103
lines changed

.github/workflows/test.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ jobs:
99
test:
1010
strategy:
1111
matrix:
12-
include:
13-
- python-version: 3.8
14-
os: ubuntu-22.04
15-
- python-version: 3.9
16-
os: ubuntu-22.04
12+
os: ["ubuntu-22.04"]
13+
python-version: ["3.10", "3.11", "3.12"]
1714

1815
runs-on: ${{ matrix.os }}
1916

@@ -27,9 +24,9 @@ jobs:
2724

2825
- name: Install dependencies
2926
run: |
30-
python -m pip install --upgrade pip setuptools
31-
pip install "importlib-metadata==4.8.3"
32-
pip install -r requirements.txt -e .[test]
27+
python -m pip install --upgrade pip
28+
pip install -e '.[estimate-area]'
29+
pip install pytest pytest-cov pre-commit codecov
3330
3431
- name: Show Python and pytest versions
3532
run: |
@@ -46,7 +43,7 @@ jobs:
4643
run: ls -la
4744

4845
- name: Upload coverage to GitHub (optional, internal)
49-
if: matrix.python-version == '3.8'
46+
if: matrix.python-version == '3.10'
5047
uses: actions/upload-artifact@v4
5148
with:
5249
name: coverage-report

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
=======
44

5+
# 2.0.0 (2025-12-23)
6+
- Migrates metadata to pyproject.toml
7+
- Drops support for Python versions < 3.10
8+
59
# 1.14.0 (2025-04-23)
610
- Added command `tilesets upload-changeset` that uploads a changeset file.
711
- Added command `tilesets publish-changesets` that publishes changesets for a incrementally updatable tileset.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ After which you can add these changes and commit again. Note that failing pre-co
5656

5757
Releases to PyPi are handled via Github Actions and GitHub tags. Once changes have been merged to master:
5858

59-
1. Update the version in mapbox_tilesets/__init__.py
59+
1. Update the version in `pyproject.toml`
6060
2. Update the changelog
6161
3. Commit changes to **your branch**. For example `git commit -am '0.2.0' && git push origin HEAD`
6262
4. Get a review and merge your changes to master.

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,18 @@ CLI for interacting with and preparing data for the [Mapbox Tiling Service](http
1414

1515
## Requirements
1616

17-
- Python >= 3.6 (can be installed via virtualenv)
18-
- Recommended: [virtualenv](https://virtualenv.pypa.io/) / [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/)
17+
- Python >= 3.10
1918

20-
## Basic installation
21-
22-
`pip install mapbox-tilesets` will install everything but [`estimate-area`](#estimate-area).
19+
`pip install mapbox-tilesets` will install everything but the [`estimate-area`](#estimate-area) command.
2320

2421
## Installing optional `estimate-area` command
2522

2623
If you are using an x86 Mac or Linux machine, run:
27-
`pip install 'mapbox-tilesets[estimate-area]'`
28-
29-
Otherwise, you will need to install some dependencies.
24+
`pip install 'mapbox-tilesets[estimate-area]'`. Otherwise, you will need to install some dependencies.
3025

3126
### arm64 MacOS
3227

33-
If you're on an arm64 Mac (e.g., with an M1 chip), you'll need to install [GDAL](https://gdal.org/) first. On Mac, a simple way is to use [Homebrew](https://brew.sh/):
28+
If you're on an Arm64 Mac, you'll need to install [GDAL](https://gdal.org/) first. On Mac, a simple way is to use [Homebrew](https://brew.sh/):
3429

3530
```sh
3631
$ brew install gdal
@@ -507,4 +502,4 @@ Publishes changesets for a tileset that supports incremental updates. This comma
507502

508503
```shell
509504
tilesets publish-changesets <tileset_id> --changeset /path/to/changeset.json
510-
```
505+
```

mapbox_tilesets/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
"""mapbox_tilesets package"""
22

3-
__version__ = "1.14.0"
3+
from importlib.metadata import PackageNotFoundError, version as _pkg_version
4+
5+
try:
6+
__version__ = _pkg_version("mapbox-tilesets")
7+
except PackageNotFoundError:
8+
# Fallback for development mode
9+
__version__ = "0.0.0.dev"

mapbox_tilesets/errors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def __init__(self, message):
1717
message: str
1818
Error description
1919
"""
20+
super().__init__(message)
2021
self.message = message
2122

2223

@@ -25,7 +26,7 @@ class TilesetNameError(TilesetsError):
2526

2627
def __init__(self, tileset_id):
2728
self.tileset_id = tileset_id
28-
self.message = "Invalid Tileset ID"
29+
super().__init__("Invalid Tileset ID")
2930

3031
def __str__(self):
3132
return "{tileset_id} -> {message}".format(

pyproject.toml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[build-system]
2+
requires = ["setuptools>=68", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "mapbox-tilesets"
7+
version = "2.0.0"
8+
description = "CLI for interacting with and preparing data for the Mapbox Tilesets API"
9+
readme = "README.md"
10+
requires-python = ">=3.10"
11+
license = { file = "LICENSE.md" }
12+
authors = [{ name = "Mapbox", email = "[email protected]" }]
13+
keywords = ["mapbox", "tilesets", "cli", "geojson", "vector tiles"]
14+
classifiers = [
15+
"Programming Language :: Python :: 3",
16+
"Programming Language :: Python :: 3 :: Only",
17+
"License :: OSI Approved :: BSD License",
18+
"Operating System :: OS Independent",
19+
]
20+
21+
dependencies = [
22+
"click>=8.1",
23+
"cligj>=0.7",
24+
"requests>=2.32",
25+
"requests-toolbelt>=1.0",
26+
"jsonschema>=4.18,<5",
27+
"mercantile>=1.1",
28+
"geojson>=3.0",
29+
"numpy>=1.23,<2",
30+
]
31+
32+
[project.optional-dependencies]
33+
estimate-area = ["supermercado>=0.2.0"]
34+
35+
[project.scripts]
36+
tilesets = "mapbox_tilesets.scripts.cli:cli"
37+
38+
[tool.pytest.ini_options]
39+
addopts = "-q --strict-markers --disable-warnings"
40+
testpaths = ["tests"]
41+
42+
[tool.setuptools]
43+
packages = ["mapbox_tilesets", "mapbox_tilesets.scripts"]
44+
45+
[dependency-groups]
46+
dev = [
47+
"pytest>=8",
48+
"pytest-cov>=4",
49+
"build>=1.2",
50+
"pre-commit>=3.5",
51+
"black==22.3.0",
52+
]

requirements.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

setup.cfg

Whitespace-only changes.

setup.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)