diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d12045..3e437c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ name: Publish package to PyPI -on: +on: push: branches: [master] release: @@ -21,13 +21,13 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install hatch - name: Build and publish distribution if: (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')) || github.event_name == 'release' - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + env: + HATCH_INDEX_USER: ${{ secrets.PYPI_USERNAME }} + HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel - twine upload dist/* + hatch build + hatch publish diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e8df05e..a50802c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ "3.8", "3.9", "3.10", "3.11" ] + python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] steps: - uses: actions/checkout@v3 diff --git a/HISTORY.rst b/HISTORY.rst index 49692c8..8c7db17 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,13 @@ History ------- +1.5.0 (2024-10-31) ++++++++++++++++++++ + +* Drop support for Python 3.7 +* Add support for Python 3.12, 3.13 +* Update docs and build process + 1.4.0 (2023-07-08) +++++++++++++++++++ @@ -39,12 +46,12 @@ History +++++++++++++++++++ * Adds auto-loading of API version (thanks Unix-Code!) -* Default API calls to Version 1.6 (thanks MiniCodeMonkey!) +* Default API calls to Version 1.6 (thanks MiniCodeMonkey!) 0.11.1 (2019-11-07) +++++++++++++++++++ -* Default API calls to Version 1.4 (thanks cyranix!) +* Default API calls to Version 1.4 (thanks cyranix!) 0.11.0 (2019-10-19) +++++++++++++++++++ diff --git a/docs/geocode.rst b/docs/geocode.rst index f2354c3..5683375 100644 --- a/docs/geocode.rst +++ b/docs/geocode.rst @@ -2,6 +2,7 @@ Geocoding ========= + Single address geocoding ======================== @@ -136,3 +137,17 @@ preserves the list's index based lookup. request addresses. +API endpoints +============= + +By default the geocodio client will connect to ``api.geocodio.io``. + +Optionally, you can specify ``hipaa_enabled=True`` or a custom API endpoint +with ``custom_base_domain`` when initializing the client.:: + + >>> from geocodio import GeocodioClient + >>> hipaa_compliant_client = GeocodioClient(MY_KEY, hipaa_enabled=True) + >>> custom_endpoint_client = GeocodioClient(MY_KEY, custom_base_domain="api.acme.org") + +Most users will use the default API endpoint. See the Geocodio docs and/or +support for more information about the HIPAA compliant and custom endpoints. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bcea5ac --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,65 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "pygeocodio" +dynamic = ["version"] +description = "Python wrapper for Geocod.io API" +readme = "README.rst" +license = {text = "BSD"} +authors = [ + {name = "Ben Lopatin", email = "ben@benlopatin.com"} +] +keywords = ["geocodio"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "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", + "Topic :: Internet :: WWW/HTTP", +] +requires-python = ">=3.9" +dependencies = [ + "requests>=1.0.0", +] +[project.optional-dependencies] +tests = [ + "requests>=1.0.0", + "httpretty>=0.9.7", + "pytest>=7.0", + "pytest-cov>=4.0", +] +docs = [ + "Sphinx==7.0.1", +] + +[project.urls] +Homepage = "https://github.com/bennylope/pygeocodio" + +[tool.hatch.version] +path = "src/geocodio/__init__.py" + +[tool.hatch.build.targets.wheel] +packages = ["src/geocodio"] + +[tool.hatch.build.targets.sdist] +include = [ + "src/geocodio", + "README.rst", + "HISTORY.rst", +] + +[tool.pytest.ini_options] +minversion = "7.0" +addopts = "-ra -q" +testpaths = [ + "tests", +] +python_files = ["test_*.py", "*_test.py"] diff --git a/requirements-docs.txt b/requirements-docs.txt deleted file mode 100644 index 7628b13..0000000 --- a/requirements-docs.txt +++ /dev/null @@ -1 +0,0 @@ -Sphinx==7.0.1 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 8286bb2..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -requests>=1.0.0 -httpretty>=0.9.7 diff --git a/setup.py b/setup.py deleted file mode 100755 index 004acf9..0000000 --- a/setup.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import os -import sys - -from setuptools import setup, find_packages - -if sys.argv[-1] == "publish": - os.system("python setup.py sdist upload") - sys.exit() - - -with open("src/geocodio/__init__.py", "r") as module_file: - for line in module_file: - if line.startswith("__version__"): - version_string = line.split("=")[1] - version = version_string.strip().replace("\"", "") - -readme = open("README.rst").read() -history = open("HISTORY.rst").read().replace(".. :changelog:", "") - -setup( - name="pygeocodio", - version=version, - description="Python wrapper for Geocod.io API", - long_description=readme + "\n\n" + history, - author="Ben Lopatin", - author_email="ben@benlopatin.com", - url="https://github.com/bennylope/pygeocodio", - # packages=["geocodio"], - packages=find_packages(where="src"), - package_dir={"": "src"}, - include_package_data=True, - install_requires=["requests>=1.0.0"], - license="BSD", - zip_safe=False, - keywords="geocodio", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Internet :: WWW/HTTP", - ], - test_suite="tests", -) diff --git a/src/geocodio/__init__.py b/src/geocodio/__init__.py index ddac722..9567938 100755 --- a/src/geocodio/__init__.py +++ b/src/geocodio/__init__.py @@ -2,7 +2,7 @@ __author__ = "Ben Lopatin" __email__ = "ben@benlopatin.com" -__version__ = "1.4.0" +__version__ = "1.5.0" from geocodio.client import GeocodioClient # noqa diff --git a/tox.ini b/tox.ini index a09d6fc..b56fcea 100644 --- a/tox.ini +++ b/tox.ini @@ -1,21 +1,21 @@ [tox] -envlist = py38, py39, py310, py311, flake8 +envlist = py39, py310, py311, py312, py313, flake8 [gh-actions] python = - 3.7: py37 - 3.8: py38 3.9: py39 3.10: py310 3.11: py311 + 3.12: py312 + 3.13: py313 [testenv] setenv = PYTHONPATH = {toxinidir}:{toxinidir}/geocodio -commands = python setup.py test +allowlist_externals = pytest +commands = pytest {posargs:tests/} deps = - -r{toxinidir}/requirements.txt - + .[tests] [testenv:flake8] basepython=python3