Skip to content

Commit 12e609e

Browse files
committed
Unify package metadata and tool configuration
Executable `setup.py` configuration has generally fallen out of favor, with declarative project configuration files like `setup.cfg` and `pyproject.toml` becoming more popular. The following files are subsumed by this change: * `.coveragerc` * `MANIFEST.in` * `apiron/VERSION` (thanks in part to `importlib_metadata`!) * `pytest.ini` * `requirements.txt` * `tox.ini` It also reduces `setup.py` to its minimal form. I think I would've preferred to cut over to `pyproject.toml` if we could, but [coverage does not yet support it](nedbat/coveragepy#699). This also means the configuration for `black` still sits in `pyproject.toml`, because _it_ doesn't support `setup.cfg`. Fortunately, the content of `setup.cfg` should be relatively portable to `pyproject.toml` when the time comes.
1 parent d90ea33 commit 12e609e

12 files changed

+82
-96
lines changed

.coveragerc

-10
This file was deleted.

.github/CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ To test `apiron`, check out the repository and:
3535
```
3636
$ cd /path/to/apiron/
3737
$ pyenv virtualenv 3.7.3 apiron # pick your favorite virtual environment tool
38-
$ pyenv local apiron:3.7.3:3.6.8:3.5.7:3.4.3 # use any Python versions you want to test
39-
(apiron:3.7.3:3.6.8:3.5.7:3.4.3) $ pip install -r dev-requirements.txt
40-
(apiron:3.7.3:3.6.8:3.5.7:3.4.3) $ python -m tox
38+
$ pyenv local apiron:3.8-dev:3.7.3:3.6.8:3.5.7:3.4.3 # use any Python versions you want to test
39+
(apiron:3.8-dev:3.7.3:3.6.8:3.5.7:3.4.3) $ pip install -r dev-requirements.txt
40+
(apiron:3.8-dev:3.7.3:3.6.8:3.5.7:3.4.3) $ python -m tox
4141
```
4242

4343
## Code formatting

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
- stage: lint
3131
install:
3232
- pip install -r dev-requirements.txt
33-
- pip install black pyflakes
3433
script:
3534
- pyflakes apiron tests
3635
- black --check apiron tests

MANIFEST.in

-6
This file was deleted.

apiron/VERSION

-1
This file was deleted.

dev-requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
-r requirements.txt
2-
1+
black==19.3b0
2+
pyflakes==2.1.1
33
pytest==4.2.0
44
pytest-cov==2.6.1
55
sphinx==1.7.6

docs/conf.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# documentation root, use os.path.abspath to make it absolute, like shown here.
1414
#
1515
import datetime
16+
import importlib_metadata
1617
import os
1718
import sys
1819

@@ -28,10 +29,7 @@
2829
copyright = '{} {}'.format(CURRENT_YEAR, ORG)
2930
author = ORG
3031

31-
VERSION_FILEPATH = os.path.join(REPO, 'apiron', 'VERSION')
32-
33-
with open(VERSION_FILEPATH) as version_file:
34-
RELEASE_VERSION = version_file.readlines()[0].strip()
32+
RELEASE_VERSION = importlib_metadata.version('apiron')
3533

3634
# The short X.Y version
3735
version = RELEASE_VERSION

pytest.ini

-14
This file was deleted.

requirements.txt

-1
This file was deleted.

setup.cfg

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
[metadata]
2+
name = apiron
3+
version = 3.0.0
4+
description = apiron helps you cook a tasty client for RESTful APIs. Just don't wash it with SOAP.
5+
author = Ithaka Harbors, Inc.
6+
author_email = [email protected]
7+
url = https://github.com/ithaka/apiron
8+
license = MIT
9+
license_file = LICENSE
10+
long_description = file: README.md
11+
long_description_content_type = text/markdown
12+
classifiers =
13+
Development Status :: 5 - Production/Stable
14+
Intended Audience :: Developers
15+
Topic :: Internet :: WWW/HTTP
16+
Topic :: Software Development :: Libraries :: Python Modules
17+
Programming Language :: Python
18+
Programming Language :: Python :: 3.4
19+
Programming Language :: Python :: 3.5
20+
Programming Language :: Python :: 3.6
21+
Programming Language :: Python :: 3.7
22+
Programming Language :: Python :: 3.8
23+
Programming Language :: Python :: 3
24+
Programming Language :: Python :: 3 :: Only
25+
License :: OSI Approved :: MIT License
26+
27+
[options]
28+
packages = find:
29+
install_requires =
30+
requests>=2.11.1,<3
31+
32+
[options.packages.find]
33+
exclude =
34+
tests*
35+
36+
######################
37+
# Tool configuration #
38+
######################
39+
40+
[coverage:run]
41+
branch = True
42+
source = .
43+
omit =
44+
*/tests/*
45+
setup.py
46+
47+
[coverage:report]
48+
show_missing = True
49+
skip_covered = True
50+
51+
52+
[tool:pytest]
53+
norecursedirs =
54+
apiron
55+
apiron.egg-info
56+
build
57+
dist
58+
docs
59+
.git
60+
.github
61+
.idea
62+
.tox
63+
.pytest_cache
64+
65+
addopts = -ra -q --cov=apiron --cov-config=.coveragerc
66+
67+
[tox:tox]
68+
envlist = py34,py35,py36,py37,py38
69+
70+
[testenv]
71+
deps = -rdev-requirements.txt
72+
commands =
73+
pytest

setup.py

+2-47
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,2 @@
1-
import os
2-
from setuptools import setup, find_packages
3-
4-
with open('README.md') as readme_file:
5-
README = readme_file.read()
6-
7-
with open('requirements.txt') as requirements_file:
8-
REQUIREMENTS = [line.rstrip() for line in requirements_file if line != '\n']
9-
10-
with open('apiron/VERSION') as version_file:
11-
VERSION = version_file.readlines()[0].strip()
12-
13-
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
14-
15-
setup(
16-
name='apiron',
17-
version=VERSION,
18-
author='Ithaka Harbors, Inc.',
19-
author_email='[email protected]',
20-
url='https://github.com/ithaka/apiron',
21-
license='MIT',
22-
23-
description='apiron helps you cook a tasty client for RESTful APIs. Just don\'t wash it with SOAP.',
24-
long_description=README,
25-
long_description_content_type='text/markdown',
26-
27-
packages=find_packages(),
28-
include_package_data=True,
29-
30-
install_requires=REQUIREMENTS,
31-
32-
classifiers=[
33-
'Development Status :: 5 - Production/Stable',
34-
'Intended Audience :: Developers',
35-
'Topic :: Internet :: WWW/HTTP',
36-
'Topic :: Software Development :: Libraries :: Python Modules',
37-
'Programming Language :: Python',
38-
'Programming Language :: Python :: 3.4',
39-
'Programming Language :: Python :: 3.5',
40-
'Programming Language :: Python :: 3.6',
41-
'Programming Language :: Python :: 3.7',
42-
'Programming Language :: Python :: 3.8',
43-
'Programming Language :: Python :: 3',
44-
'Programming Language :: Python :: 3 :: Only',
45-
'License :: OSI Approved :: MIT License',
46-
],
47-
)
1+
from setuptools import setup
2+
setup()

tox.ini

-7
This file was deleted.

0 commit comments

Comments
 (0)