diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f1c0ff0..27fe549 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,11 +9,8 @@ jobs: test: strategy: matrix: - include: - - python-version: 3.8 - os: ubuntu-22.04 - - python-version: 3.9 - os: ubuntu-22.04 + os: ["ubuntu-22.04"] + python-version: ["3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} @@ -27,9 +24,9 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip setuptools - pip install "importlib-metadata==4.8.3" - pip install -r requirements.txt -e .[test] + python -m pip install --upgrade pip + pip install -e '.[estimate-area]' + pip install pytest pytest-cov pre-commit codecov - name: Show Python and pytest versions run: | @@ -46,7 +43,7 @@ jobs: run: ls -la - name: Upload coverage to GitHub (optional, internal) - if: matrix.python-version == '3.8' + if: matrix.python-version == '3.10' uses: actions/upload-artifact@v4 with: name: coverage-report diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a20483..33c15d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ======= +# 2.0.0 (2025-12-23) +- Migrates metadata to pyproject.toml +- Drops support for Python versions < 3.10 + # 1.14.0 (2025-04-23) - Added command `tilesets upload-changeset` that uploads a changeset file. - Added command `tilesets publish-changesets` that publishes changesets for a incrementally updatable tileset. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b537031..af4919c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,7 +56,7 @@ After which you can add these changes and commit again. Note that failing pre-co Releases to PyPi are handled via Github Actions and GitHub tags. Once changes have been merged to master: -1. Update the version in mapbox_tilesets/__init__.py +1. Update the version in `pyproject.toml` 2. Update the changelog 3. Commit changes to **your branch**. For example `git commit -am '0.2.0' && git push origin HEAD` 4. Get a review and merge your changes to master. diff --git a/README.md b/README.md index 32488d0..0f0dd86 100644 --- a/README.md +++ b/README.md @@ -14,23 +14,18 @@ CLI for interacting with and preparing data for the [Mapbox Tiling Service](http ## Requirements -- Python >= 3.6 (can be installed via virtualenv) -- Recommended: [virtualenv](https://virtualenv.pypa.io/) / [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) +- Python >= 3.10 -## Basic installation - -`pip install mapbox-tilesets` will install everything but [`estimate-area`](#estimate-area). +`pip install mapbox-tilesets` will install everything but the [`estimate-area`](#estimate-area) command. ## Installing optional `estimate-area` command If you are using an x86 Mac or Linux machine, run: -`pip install 'mapbox-tilesets[estimate-area]'` - -Otherwise, you will need to install some dependencies. +`pip install 'mapbox-tilesets[estimate-area]'`. Otherwise, you will need to install some dependencies. ### arm64 MacOS -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/): +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/): ```sh $ brew install gdal @@ -507,4 +502,4 @@ Publishes changesets for a tileset that supports incremental updates. This comma ```shell tilesets publish-changesets --changeset /path/to/changeset.json -``` \ No newline at end of file +``` diff --git a/mapbox_tilesets/__init__.py b/mapbox_tilesets/__init__.py index 1570161..e1514b6 100644 --- a/mapbox_tilesets/__init__.py +++ b/mapbox_tilesets/__init__.py @@ -1,3 +1,9 @@ """mapbox_tilesets package""" -__version__ = "1.14.0" +from importlib.metadata import PackageNotFoundError, version as _pkg_version + +try: + __version__ = _pkg_version("mapbox-tilesets") +except PackageNotFoundError: + # Fallback for development mode + __version__ = "0.0.0.dev" diff --git a/mapbox_tilesets/errors.py b/mapbox_tilesets/errors.py index 93f3ba9..523ec66 100644 --- a/mapbox_tilesets/errors.py +++ b/mapbox_tilesets/errors.py @@ -17,6 +17,7 @@ def __init__(self, message): message: str Error description """ + super().__init__(message) self.message = message @@ -25,7 +26,7 @@ class TilesetNameError(TilesetsError): def __init__(self, tileset_id): self.tileset_id = tileset_id - self.message = "Invalid Tileset ID" + super().__init__("Invalid Tileset ID") def __str__(self): return "{tileset_id} -> {message}".format( diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1b2c486 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,52 @@ +[build-system] +requires = ["setuptools>=68", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "mapbox-tilesets" +version = "2.0.0" +description = "CLI for interacting with and preparing data for the Mapbox Tilesets API" +readme = "README.md" +requires-python = ">=3.10" +license = { file = "LICENSE.md" } +authors = [{ name = "Mapbox", email = "maps-api-team@mapbox.com" }] +keywords = ["mapbox", "tilesets", "cli", "geojson", "vector tiles"] +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", +] + +dependencies = [ + "click>=8.1", + "cligj>=0.7", + "requests>=2.32", + "requests-toolbelt>=1.0", + "jsonschema>=4.18,<5", + "mercantile>=1.1", + "geojson>=3.0", + "numpy>=1.23,<2", +] + +[project.optional-dependencies] +estimate-area = ["supermercado>=0.2.0"] + +[project.scripts] +tilesets = "mapbox_tilesets.scripts.cli:cli" + +[tool.pytest.ini_options] +addopts = "-q --strict-markers --disable-warnings" +testpaths = ["tests"] + +[tool.setuptools] +packages = ["mapbox_tilesets", "mapbox_tilesets.scripts"] + +[dependency-groups] +dev = [ + "pytest>=8", + "pytest-cov>=4", + "build>=1.2", + "pre-commit>=3.5", + "black==22.3.0", +] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index d61b6ec..0000000 --- a/requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -boto3==1.23.10 -Click==8.0.2 -cligj==0.7.2 -numpy==1.19.5 -requests==2.27.1 -requests-toolbelt==0.9.1 -jsonschema==3.0.1 -jsonseq==1.0.0 -mercantile==1.1.6 -supermercado==0.2.0 -geojson===2.5.0 -urllib3==1.26.19 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index e69de29..0000000 diff --git a/setup.py b/setup.py deleted file mode 100755 index 05ea71c..0000000 --- a/setup.py +++ /dev/null @@ -1,62 +0,0 @@ -import os -from codecs import open as codecs_open -from setuptools import setup, find_packages - -from mapbox_tilesets import __version__ - -# Get the long description from the relevant file -with codecs_open("README.md", encoding="utf-8") as f: - long_description = f.read() - - -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() - - -setup( - name="mapbox-tilesets", - version=__version__, - description="CLI for interacting with and preparing data for the Tilesets API", - long_description=long_description, - long_description_content_type="text/markdown", - classifiers=[], - keywords="", - author="Mapbox", - author_email="sam@mapbox.com", - url="https://github.com/mapbox/tilesets-cli", - license="BSD-2", - packages=find_packages(exclude=["ez_setup", "examples", "tests"]), - install_requires=[ - "boto3", - "click~=8.0.2", - "cligj", - "numpy", - "requests", - "requests-toolbelt", - "jsonschema~=3.0", - "jsonseq~=1.0", - "mercantile~=1.1.6", - "geojson~=2.5.0", - ], - include_package_data=True, - zip_safe=False, - extras_require={ - "estimate-area": [ - "supermercado~=0.2.0", - ], - "test": [ - "codecov", - "pytest==6.2.5", - "pytest-cov", - "pre-commit", - "black==22.3.0", - "pep8", - "supermercado~=0.2.0", - "toml==0.10.2", - ], - }, - entry_points=""" - [console_scripts] - tilesets=mapbox_tilesets.scripts.cli:cli - """, -) diff --git a/tests/test_version_documentation.py b/tests/test_version_documentation.py deleted file mode 100644 index 12cadb4..0000000 --- a/tests/test_version_documentation.py +++ /dev/null @@ -1,7 +0,0 @@ -from mapbox_tilesets import __version__ - - -def test_versions(): - mod_version = __version__ - with open("./CHANGELOG.md") as src: - assert len([line in line for line in src if mod_version in line]) == 1