diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 66a0d77..e89834b 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,7 +1,7 @@ steps: - label: ":building_construction: build everything" command: - - python setup.py sdist bdist_wheel + - python -m build - pip install dist/*.whl - pip install -r requirements-dev.txt - make zipdocs @@ -9,59 +9,30 @@ steps: docker#v1.4.0: image: "${ECR}/ci-tools:latest" workdir: /app - artifact_paths: + artifact_paths: - dist/* - docs/build/docs.zip - wait - - label: ":pytest: run tests (:python: 3.8)" + - label: ":pytest: run tests (:python: {{matrix.python}})" command: - ./.buildkite/test.sh plugins: artifacts#v1.2.0: download: "dist/*.whl" - docker#v1.4.0: - image: "python:3.8-alpine" - workdir: /app - shell: false - artifact_paths: "./pytest*.xml" - - - label: ":pytest: run tests (:python: 3.9)" - command: - - ./.buildkite/test.sh - plugins: - artifacts#v1.2.0: - download: "dist/*.whl" - docker#v1.4.0: - image: "python:3.9-alpine" - workdir: /app - shell: false - artifact_paths: "./pytest*.xml" - - - label: ":pytest: run tests (:python: 3.10)" - command: - - ./.buildkite/test.sh - plugins: - artifacts#v1.2.0: - download: "dist/*.whl" - docker#v1.4.0: - image: "python:3.10-alpine" - workdir: /app - shell: false - artifact_paths: "./pytest*.xml" - - - label: ":pytest: run tests (:python: 3.7)" - command: - - ./.buildkite/test.sh - plugins: - artifacts#v1.2.0: - download: "dist/*.whl" - docker#v1.4.0: - image: "python:3.7-alpine" + docker#v5.10.0: + image: "python:{{matrix.python}}-alpine" workdir: /app shell: false artifact_paths: "./pytest*.xml" + matrix: + setup: + python: + - "3.7" + - "3.8" + - "3.9" + - "3.10" # Record test failures - wait: ~ diff --git a/.gitignore b/.gitignore index 8750fbf..2c77bb3 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ __pycache__/ # Distribution / packaging .Python env/ +venv/ build/ develop-eggs/ dist/ @@ -65,5 +66,3 @@ target/ # MacOS .DS_Store - - diff --git a/docs/source/conf.py b/docs/source/conf.py index 0581432..f4ed30c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -12,14 +12,7 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys -import os -import shlex - -sys.path.append(os.path.join(os.path.dirname(__file__), "../..")) -sys.path.append(os.path.join(os.path.dirname(__file__), "../../koordinates")) -import koordinates -from koordinates import __version__ +import importlib.metadata # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -61,7 +54,8 @@ # built documents. # # The short X.Y version. -version = __version__ +version = importlib.metadata.version("koordinates") + # The full version, including alpha/beta/rc tags. release = version diff --git a/docs/source/user/contributing.rst b/docs/source/user/contributing.rst index 0044920..e4799d2 100644 --- a/docs/source/user/contributing.rst +++ b/docs/source/user/contributing.rst @@ -6,7 +6,7 @@ Koordinates welcomes bug reports and contributions by the community to this modu Testing ------- -The client includes a suite of unit and functional tests. These should be used to verify that your changes don't break existing functionality, and that compatibility is maintained across supported Python versions. `Tests run automatically on CircleCI `_ for branch commits and pull requests. +The client includes a suite of unit and functional tests. These should be used to verify that your changes don't break existing functionality, and that compatibility is maintained across supported Python versions. `Tests run automatically on Buildkite `_ for branch commits and pull requests. To run the tests you need to:: @@ -32,7 +32,7 @@ Preparations #. Close or update all tickets for the `next milestone on Github. `_. -#. Update the *minimum* required versions of dependencies in :file:`setup.py`. +#. Update the *minimum* required versions of dependencies in :file:`pyproject.toml`. Update the *exact* version of all entries in :file:`requirements.txt`. #. Run :command:`tox` from the project root. All tests for all supported Python versions must pass: @@ -42,7 +42,7 @@ Preparations $ tox [...] ________ summary ________ - py34: commands succeeded + py37: commands succeeded ... congratulations :) @@ -59,7 +59,7 @@ Preparations .. note:: - You will need to install dev dependancies in :file:`requirements-dev.txt` to build documentation. + You will need to install dev dependencies in :file:`requirements-dev.txt` to build documentation. #. Check the `Buildkite build `_ is passing. @@ -85,9 +85,9 @@ Build and release .. code-block:: bash - $ python setup.py sdist + $ python3 -m build $ ls dist/ - koordinates-0.0.0.tar.gz + koordinates-0.7.0-py3-none-any.whl koordinates-0.7.0.tar.gz Try installing them: @@ -98,8 +98,6 @@ Build and release $ /tmp/koordinates-sdist/bin/pip install dist/koordinates-0.0.0.tar.gz $ /tmp/koordinates-sdist/bin/python >>> import koordinates - >>> koordinates.__version__ - '0.0.0' #. Create or check your accounts for the `test server ` and `PyPI `_. Update your :file:`~/.pypirc` with your @@ -126,7 +124,7 @@ Build and release .. code-block:: bash - $ python setup.py sdist upload -r test + $ twine upload -r test dist/* $ rm -rf /tmp/koordinates-sdist # ensure clean state $ virtualenv /tmp/koordinates-sdist @@ -139,7 +137,7 @@ Build and release .. code-block:: bash - $ python setup.py sdist upload -r pypi + $ twine upload -r pypi dist/* $ rm -rf /tmp/koordinates-sdist # ensure clean state $ virtualenv /tmp/koordinates-sdist diff --git a/koordinates/__init__.py b/koordinates/__init__.py index ae77b75..725450a 100644 --- a/koordinates/__init__.py +++ b/koordinates/__init__.py @@ -6,8 +6,6 @@ :license: BSD, see LICENSE for more details. """ -__version__ = "0.6.0" - from .exceptions import ( KoordinatesException, ClientError, diff --git a/pyproject.toml b/pyproject.toml index 2054c17..3a2a4d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,51 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = ["setuptools>=61.0"] + +[project] +authors = [ + {name = "Koordinates Limited", email = "support@koordinates.com"}, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Scientific/Engineering :: GIS", +] +dependencies = [ + "python-dateutil>=2,<3", + "pytz", + "requests>=2.5,<3", + "requests-toolbelt", +] +description = "A Python client library for a number of Koordinates web APIs" +dynamic = ["readme"] +keywords = ["koordinates", "api"] +name = "koordinates" +requires-python = ">=3.7" +version = "0.7.0" + +[project.urls] +Source = "https://github.com/koordinates/python-client" + +[project.optional-dependencies] +dev = [ + "coverage>=3.7,<4", + "pytest>=3.3", + "responses>=0.3", +] + +[tool.setuptools] +packages = ["koordinates"] + +[tool.setuptools.dynamic] +readme = {file = "README.md", content-type = "text/markdown"} + [tool.black] -target-version = ['py34'] +target-version = ['py37'] diff --git a/requirements-dev.txt b/requirements-dev.txt index b5659b8..23904b3 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,6 @@ -r requirements-test.txt +build Babel~=2.7 Jinja2<3.1 MarkupSafe diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 24378bc..0000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[bdist_wheel] -universal=1 - -[metadata] -description-file = README.md diff --git a/setup.py b/setup.py deleted file mode 100755 index 95a70ba..0000000 --- a/setup.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -try: - from setuptools import setup -except ImportError: - from distutils.core import setup - -import re -from codecs import open - - -version = "" -with open("koordinates/__init__.py", "r") as fd: - version = re.search( - r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE - ).group(1) -with open("README.md", "r", "utf-8") as f: - readme = f.read() - -setup( - name="koordinates", - packages=[ - "koordinates", - ], - version=version, - description="A Python client library for a number of Koordinates web APIs", - long_description=readme, - long_description_content_type="text/markdown", - author="Koordinates Limited", - author_email="support@koordinates.com", - url="https://github.com/koordinates/python-client", - keywords="koordinates api", - license="BSD", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Scientific/Engineering :: GIS", - ], - python_requires=">=3.7", - install_requires=[ - "python-dateutil>=2,<3", - "pytz", - "requests>=2.5,<3", - "requests-toolbelt", - ], - tests_require=[ - "pytest>=3.3", - "responses>=0.3", - "coverage>=3.7,<4", - ], - zip_safe=False, -)