Skip to content

Commit 7437456

Browse files
committed
migrate from setup.py to pyproject.toml, keep a simple wrapper
1 parent fc8e21b commit 7437456

3 files changed

Lines changed: 57 additions & 78 deletions

File tree

pyproject.toml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[build-system]
2+
requires = ["setuptools>=65.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "opencage"
7+
version = "3.2.0"
8+
description = "Wrapper module for the OpenCage Geocoder API"
9+
readme = "README.md"
10+
requires-python = ">=3.9"
11+
license = {text = "BSD"}
12+
authors = [{name = "OpenCage GmbH", email = "info@opencagedata.com"}]
13+
keywords = ["geocoding", "geocoder"]
14+
classifiers = [
15+
"Environment :: Web Environment",
16+
"Development Status :: 5 - Production/Stable",
17+
"Intended Audience :: Developers",
18+
"License :: OSI Approved :: BSD License",
19+
"Operating System :: OS Independent",
20+
"Programming Language :: Python :: 3 :: Only",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
25+
"Programming Language :: Python :: 3.13",
26+
"Programming Language :: Python :: 3.14",
27+
"Topic :: Scientific/Engineering :: GIS",
28+
"Topic :: Utilities",
29+
]
30+
dependencies = [
31+
"Requests>=2.31.0",
32+
"backoff>=2.2.1",
33+
"tqdm>=4.66.4",
34+
"certifi>=2024.07.04",
35+
"aiohttp>=3.10.5",
36+
]
37+
38+
[project.optional-dependencies]
39+
dev = [
40+
"responses>=0.25.7",
41+
"flake8>=7.0.0",
42+
"pytest>=7.4.0",
43+
"pytest-asyncio>=0.21.0",
44+
]
45+
46+
[project.scripts]
47+
opencage = "opencage.command_line:main"
48+
49+
[project.urls]
50+
Repository = "https://github.com/OpenCageData/python-opencage-geocoder"
51+
Download = "https://github.com/OpenCageData/python-opencage-geocoder/tarball/3.2.0"

setup.py

Lines changed: 3 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,6 @@
11
#!/usr/bin/env python
2+
"""Backwards-compatible setup.py shim. All config is in pyproject.toml."""
23

3-
import os
4-
import sys
5-
from setuptools import setup, find_packages
4+
from setuptools import setup
65

7-
# if you are not using vagrant, just delete os.link directly,
8-
# The hard link only saves a little disk space, so you should not care
9-
if os.environ.get('USER', '') == 'vagrant':
10-
del os.link
11-
12-
13-
ROOT_DIR = os.path.dirname(__file__)
14-
SOURCE_DIR = os.path.join(ROOT_DIR)
15-
16-
if sys.version_info < (3, 8):
17-
raise RuntimeError(
18-
"opencage requires Python 3.8 or newer"
19-
"Use older opencage 1.x for Python 2.7 or 3.7"
20-
)
21-
22-
# try for testing
23-
try:
24-
with open(os.path.join(SOURCE_DIR, 'README.md'), encoding="utf-8") as f:
25-
LONG_DESCRIPTION = f.read()
26-
except FileNotFoundError:
27-
LONG_DESCRIPTION = ""
28-
29-
setup(
30-
name="opencage",
31-
version="3.2.0",
32-
description="Wrapper module for the OpenCage Geocoder API",
33-
long_description=LONG_DESCRIPTION,
34-
long_description_content_type='text/markdown',
35-
author="OpenCage GmbH",
36-
author_email="info@opencagedata.com",
37-
url="https://github.com/OpenCageData/python-opencage-geocoder/",
38-
download_url="https://github.com/OpenCageData/python-opencage-geocoder/tarball/3.2.0",
39-
license="BSD",
40-
entry_points={
41-
'console_scripts': [
42-
'opencage=opencage.command_line:main'
43-
]
44-
},
45-
packages=find_packages(),
46-
include_package_data=True,
47-
zip_safe=False,
48-
keywords=['geocoding', 'geocoder'],
49-
classifiers=[
50-
'Environment :: Web Environment',
51-
"Development Status :: 5 - Production/Stable",
52-
'Intended Audience :: Developers',
53-
'License :: OSI Approved :: BSD License',
54-
'Operating System :: OS Independent',
55-
"Programming Language :: Python :: 3 :: Only",
56-
'Programming Language :: Python :: 3.9',
57-
'Programming Language :: Python :: 3.10',
58-
'Programming Language :: Python :: 3.11',
59-
'Programming Language :: Python :: 3.12',
60-
'Programming Language :: Python :: 3.13',
61-
'Programming Language :: Python :: 3.14',
62-
'Topic :: Scientific/Engineering :: GIS',
63-
'Topic :: Utilities'
64-
],
65-
install_requires=[
66-
'Requests>=2.31.0',
67-
'backoff>=2.2.1',
68-
'tqdm>=4.66.4',
69-
'certifi>=2024.07.04',
70-
'aiohttp>=3.10.5'
71-
],
72-
test_suite='pytest',
73-
tests_require=[
74-
'responses>=0.25.7',
75-
'flake8>=7.0.0',
76-
'pytest>=7.4.0'
77-
],
78-
)
6+
setup()

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[tox]
2-
envlist = py38,py39,py310,py311,py312,py313,lint
2+
envlist = py39,py310,py311,py312,py313,py314,lint
33

44
[gh]
55
python =
6+
3.14 = py314
67
3.13 = py313
78
3.12 = py312
89
3.11 = py311
910
3.10 = py310
1011
3.9 = py39
11-
3.8 = py38
1212

1313
[testenv]
1414
deps =
@@ -26,4 +26,4 @@ deps =
2626
flake8>=7.0.0
2727
pytest
2828
commands =
29-
flake8 opencage examples/demo.py setup.py test
29+
flake8 opencage examples/demo.py test

0 commit comments

Comments
 (0)