Skip to content

Commit 702b507

Browse files
committed
Update setup.py
- Makefile: - - Added sdist-test command - requirements: - - Added pyOpenSSL (needed for twine) - - Added readme_renderer[md] (needed for twine check) - - Added wheel (needed for source distribution) - setup.py: - - Removed 'publish' logic - - Added reading of requirements.txt logic - - Info available in the pokepy package is read directly from it instead of typed manually (version, license, author, author_email) - - Added project_urls - - Added tests_require
1 parent cd2fd19 commit 702b507

4 files changed

Lines changed: 31 additions & 26 deletions

File tree

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ help:
1010
@echo "docs-build - build MkDocs HTML documentation"
1111
@echo "docs-test - live test the current documentation"
1212
@echo "docs-release - push built docs to gh-pages branch of github repo (git should exist on PATH)"
13-
@echo "release - package and upload a release"
1413
@echo "sdist - package"
14+
@echo "sdist-test - look for errors on the source distribution package"
15+
@echo "release - package and upload a release"
1516

1617
clean: clean-build clean-pyc
1718

@@ -50,9 +51,13 @@ docs-test:
5051
docs-release:
5152
mkdocs gh-deploy --verbose
5253

53-
release: clean sdist
54-
twine upload dist/*
55-
5654
sdist: clean
5755
python setup.py sdist bdist_wheel
5856
ls -l dist
57+
58+
sdist-test:
59+
twine check dist/*
60+
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
61+
62+
release: clean sdist
63+
twine upload dist/*

requirements-dev.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
-r requirements-dev27.txt
2-
pylint==2.1.* # style
3-
twine==1.12.* # pypi tools
2+
pylint==2.1.* # style
3+
twine==1.12.* # pypi tools
4+
pyOpenSSL==19.0.* # twine dependency
5+
readme_renderer[md]==24.* # command 'twine check'
6+
wheel==0.32.* # command 'setup.py sdist bdist_wheel'

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
beckett==0.8.* # main functionality
2-
fcache==0.4.* # disk-based cache
3-
requests==2.20.* # used by beckett (bumped to avoid CVE-2018-18074)
1+
beckett==0.8.* # main functionality
2+
fcache==0.4.* # disk-based cache
3+
requests==2.20.* # used by beckett (bumped to avoid CVE-2018-18074)

setup.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,36 @@
11
#!/usr/bin/env python
22
# coding: utf-8
33

4-
import os
5-
import sys
4+
import pokepy
65

76

87
try:
98
from setuptools import setup
109
except ImportError:
1110
from distutils.core import setup
1211

13-
if sys.argv[-1] == 'publish':
14-
os.system('python setup.py sdist upload')
15-
sys.exit()
16-
17-
with open('README.md') as readme_md, open('docs/history.md') as history_md:
12+
with open('README.md') as readme_md, open('docs/history.md') as history_md,\
13+
open('requirements.txt') as requirements_txt:
1814
readme = readme_md.read()
1915
history = history_md.read()
16+
requirements = [req[:req.find('#')].rstrip() for req in requirements_txt.readlines()]
2017

2118
setup(
2219
name='pokepy',
23-
version='0.5.0',
24-
description='A Python wrapper for PokéAPI',
20+
version=pokepy.__version__,
21+
description='A Python wrapper for PokéAPI (https://pokeapi.co)',
2522
long_description=readme + '\n\n' + history,
26-
author='Paul Hallett',
27-
author_email='hello@phalt.co',
23+
license=pokepy.__license__,
24+
author=pokepy.__author__,
25+
author_email=pokepy.__email__,
2826
url='https://github.com/PokeAPI/pokepy',
29-
packages=[
30-
'pokepy',
31-
],
27+
project_urls={'Documentation': 'https://pokeapi.github.io/pokepy/'},
28+
packages=['pokepy'],
3229
package_dir={'pokepy': 'pokepy'},
3330
include_package_data=True,
34-
install_requires=["beckett==0.8.0", "fcache==0.4.7", "requests==2.20.0"],
35-
license="BSD",
31+
install_requires=requirements,
3632
zip_safe=False,
37-
keywords='pokepy',
33+
keywords='pokepy PokéAPI',
3834
classifiers=[
3935
'Development Status :: 4 - Beta',
4036
'Intended Audience :: Developers',
@@ -47,4 +43,5 @@
4743
'Programming Language :: Python :: 3.7',
4844
],
4945
test_suite='tests',
46+
tests_require=['requests-mock==1.5.*'],
5047
)

0 commit comments

Comments
 (0)