Skip to content

Commit

Permalink
Update package specs, build process, supported Python (#64)
Browse files Browse the repository at this point in the history
* Add pyproject.toml

* Use hatch for PyPI publishing

* Update version

* Use pytest and update tested Python versions

* Update docs to include custom/HIPAA endpoints

* Update GH actions for Python versions
  • Loading branch information
bennylope authored Oct 30, 2024
1 parent 077a486 commit 94eed72
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 72 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Publish package to PyPI

on:
on:
push:
branches: [master]
release:
Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
+++++++++++++++++++

Expand Down Expand Up @@ -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)
+++++++++++++++++++
Expand Down
15 changes: 15 additions & 0 deletions docs/geocode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Geocoding
=========


Single address geocoding
========================

Expand Down Expand Up @@ -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.
65 changes: 65 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"}
]
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"]
1 change: 0 additions & 1 deletion requirements-docs.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

52 changes: 0 additions & 52 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/geocodio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = "Ben Lopatin"
__email__ = "[email protected]"
__version__ = "1.4.0"
__version__ = "1.5.0"


from geocodio.client import GeocodioClient # noqa
Expand Down
12 changes: 6 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 94eed72

Please sign in to comment.