Skip to content

Commit 23ede13

Browse files
committed
Packaging cleaning
o
1 parent 50a7adf commit 23ede13

File tree

2 files changed

+37
-45
lines changed

2 files changed

+37
-45
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
develop:
2+
pip install -e .[test]
3+
test:
4+
py.test -vvx

setup.py

Lines changed: 33 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,65 @@
11
"""Pyscopg and asyncpg helpers to work with PostGIS."""
22

3-
import glob
4-
from setuptools import setup, find_packages, Extension
5-
from codecs import open # To use a consistent encoding
6-
from os import path
73
import sys
4+
from pathlib import Path
85

9-
HERE = path.abspath(path.dirname(__file__))
10-
11-
# Get the long description from the relevant file
12-
with open(path.join(HERE, 'README.md'), encoding='utf-8') as f:
13-
long_description = f.read()
14-
15-
16-
def is_pkg(line):
17-
return line and not line.startswith(('--', 'git', '#'))
6+
from setuptools import Extension, find_packages, setup
187

198

209
def list_modules(dirname):
21-
filenames = glob.glob(path.join(dirname, '*.py'))
22-
23-
module_names = []
24-
for name in filenames:
25-
module, ext = path.splitext(path.basename(name))
26-
if module != '__init__':
27-
module_names.append(module)
28-
29-
return module_names
10+
paths = Path(dirname).glob("*.py")
11+
return [p.stem for p in paths if p.stem != "__init__"]
3012

3113

3214
try:
3315
from Cython.Distutils import build_ext
16+
3417
CYTHON = True
3518
except ImportError:
36-
sys.stdout.write('\nNOTE: Cython not installed. python-postgis will '
37-
'still work fine, but may run a bit slower.\n\n')
19+
sys.stdout.write(
20+
"\nNOTE: Cython not installed. python-postgis will "
21+
"still work fine, but may run a bit slower.\n\n"
22+
)
3823
CYTHON = False
3924
cmdclass = {}
4025
ext_modules = []
4126
else:
4227
ext_modules = [
43-
Extension('postgis.' + ext, [path.join('postgis', ext + '.py')])
44-
for ext in list_modules(path.join(HERE, 'postgis'))]
28+
Extension("postgis." + ext, [str(Path("postgis") / f"{ext}.py")])
29+
for ext in list_modules(Path("postgis"))
30+
]
4531

46-
cmdclass = {'build_ext': build_ext}
32+
cmdclass = {"build_ext": build_ext}
4733

4834

4935
VERSION = (1, 0, 4)
5036

5137
setup(
52-
name='postgis',
38+
name="postgis",
5339
version=".".join(map(str, VERSION)),
5440
description=__doc__,
55-
long_description=long_description,
56-
url="https://github.com/yohanboniface/python-postgis",
57-
author='Yohan Boniface',
58-
author_email='yohan.boniface@data.gouv.fr',
59-
license='WTFPL',
60-
41+
long_description=Path("README.md").read_text(),
42+
url="https://github.com/tilery/python-postgis",
43+
author="Yohan Boniface",
44+
author_email="yohanboniface@free.fr",
45+
license="WTFPL",
6146
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
6247
classifiers=[
63-
'Development Status :: 4 - Beta',
64-
65-
'Intended Audience :: Developers',
66-
'Topic :: Scientific/Engineering :: GIS',
67-
68-
'Programming Language :: Python :: 3',
69-
'Programming Language :: Python :: 3.5',
70-
'Programming Language :: Python :: 3.6',
48+
"Development Status :: 4 - Beta",
49+
"Intended Audience :: Developers",
50+
"Topic :: Scientific/Engineering :: GIS",
51+
"Programming Language :: Python :: 3",
52+
"Programming Language :: Python :: 3.5",
53+
"Programming Language :: Python :: 3.6",
54+
"Programming Language :: Python :: 3.7",
55+
"Programming Language :: Python :: 3.8",
7156
],
72-
keywords='psycopg postgis gis asyncpg',
73-
packages=find_packages(exclude=['tests']),
74-
extras_require={'test': ['pytest'], 'docs': 'mkdocs'},
57+
keywords="psycopg postgis gis asyncpg",
58+
packages=find_packages(exclude=["tests"]),
59+
extras_require={
60+
"test": ["pytest", "pytest-asyncio", "psycopg2", "asyncpg"],
61+
"docs": "mkdocs",
62+
},
7563
include_package_data=True,
7664
cmdclass=cmdclass,
7765
ext_modules=ext_modules,

0 commit comments

Comments
 (0)