Skip to content

Commit

Permalink
Update setup.py
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Kronopt committed Feb 9, 2019
1 parent cd2fd19 commit 702b507
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ help:
@echo "docs-build - build MkDocs HTML documentation"
@echo "docs-test - live test the current documentation"
@echo "docs-release - push built docs to gh-pages branch of github repo (git should exist on PATH)"
@echo "release - package and upload a release"
@echo "sdist - package"
@echo "sdist-test - look for errors on the source distribution package"
@echo "release - package and upload a release"

clean: clean-build clean-pyc

Expand Down Expand Up @@ -50,9 +51,13 @@ docs-test:
docs-release:
mkdocs gh-deploy --verbose

release: clean sdist
twine upload dist/*

sdist: clean
python setup.py sdist bdist_wheel
ls -l dist

sdist-test:
twine check dist/*
twine upload --repository-url https://test.pypi.org/legacy/ dist/*

release: clean sdist
twine upload dist/*
7 changes: 5 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-r requirements-dev27.txt
pylint==2.1.* # style
twine==1.12.* # pypi tools
pylint==2.1.* # style
twine==1.12.* # pypi tools
pyOpenSSL==19.0.* # twine dependency
readme_renderer[md]==24.* # command 'twine check'
wheel==0.32.* # command 'setup.py sdist bdist_wheel'
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
beckett==0.8.* # main functionality
fcache==0.4.* # disk-based cache
requests==2.20.* # used by beckett (bumped to avoid CVE-2018-18074)
beckett==0.8.* # main functionality
fcache==0.4.* # disk-based cache
requests==2.20.* # used by beckett (bumped to avoid CVE-2018-18074)
31 changes: 14 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
#!/usr/bin/env python
# coding: utf-8

import os
import sys
import pokepy


try:
from setuptools import setup
except ImportError:
from distutils.core import setup

if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()

with open('README.md') as readme_md, open('docs/history.md') as history_md:
with open('README.md') as readme_md, open('docs/history.md') as history_md,\
open('requirements.txt') as requirements_txt:
readme = readme_md.read()
history = history_md.read()
requirements = [req[:req.find('#')].rstrip() for req in requirements_txt.readlines()]

setup(
name='pokepy',
version='0.5.0',
description='A Python wrapper for PokéAPI',
version=pokepy.__version__,
description='A Python wrapper for PokéAPI (https://pokeapi.co)',
long_description=readme + '\n\n' + history,
author='Paul Hallett',
author_email='[email protected]',
license=pokepy.__license__,
author=pokepy.__author__,
author_email=pokepy.__email__,
url='https://github.com/PokeAPI/pokepy',
packages=[
'pokepy',
],
project_urls={'Documentation': 'https://pokeapi.github.io/pokepy/'},
packages=['pokepy'],
package_dir={'pokepy': 'pokepy'},
include_package_data=True,
install_requires=["beckett==0.8.0", "fcache==0.4.7", "requests==2.20.0"],
license="BSD",
install_requires=requirements,
zip_safe=False,
keywords='pokepy',
keywords='pokepy PokéAPI',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
Expand All @@ -47,4 +43,5 @@
'Programming Language :: Python :: 3.7',
],
test_suite='tests',
tests_require=['requests-mock==1.5.*'],
)

0 comments on commit 702b507

Please sign in to comment.