Skip to content

Commit 8351971

Browse files
committed
update setuptools configuration
display version adding python 3.6 compatibility update python version add python 3.5 and 3.6
1 parent a9c1287 commit 8351971

File tree

5 files changed

+126
-97
lines changed

5 files changed

+126
-97
lines changed

.travis.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,23 @@
33

44
language: python
55

6+
python:
7+
- "2.7"
8+
- "3.3"
9+
- "3.4"
10+
- "3.5"
11+
- "3.6"
12+
613
env:
714
- TOXENV=py27
815
- TOXENV=py33
916
- TOXENV=py34
17+
- TOXENV=py35
18+
- TOXENV=py36
1019

11-
install: pip install tox
20+
install:
21+
- pip install -U setuptools
22+
- pip install tox
1223

1324
script: tox
1425

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ include LICENSE.txt
33

44
# Include the data files
55
recursive-include data *
6+
7+
# Include package data
8+
include sample/package_data.dat

sample/__init__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
1+
import pkg_resources
2+
from os import path
3+
from setuptools.config import read_configuration
4+
5+
6+
def _extract_version(package_name):
7+
try:
8+
return pkg_resources.get_distribution(package_name).version
9+
except pkg_resources.DistributionNotFound:
10+
_conf = read_configuration(
11+
path.join(
12+
path.dirname(path.dirname(__file__)),
13+
'setup.cfg'
14+
)
15+
)
16+
return _conf['metadata']['version']
17+
18+
19+
__version__ = _extract_version('pipenv')
20+
121

222
def main():
323
"""Entry point for the application script"""
24+
print("Sample version {}".format(__version__))
425
print("Call your main application code here")
26+
27+
28+
if __name__ == "__main__":
29+
print(__version__)

setup.cfg

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,88 @@
1+
[metadata]
2+
name = sample
3+
description = "A sample Python project"
4+
long_description = file: README.rst
5+
# Versions should comply with PEP440. For a discussion on single-sourcing
6+
# the version across setup.py and the project code, see
7+
# https://packaging.python.org/en/latest/single_source_version.html
8+
version = 1.2.0
9+
# Author details
10+
author = The Python Packaging Authority
11+
author_email = [email protected]
12+
# The project's main homepage.
13+
url = https://github.com/pypa/sampleproject
14+
# Choose your license
15+
license = MIT
16+
# What does your project relate to?
17+
keywords = sample, setuptools, development
18+
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
19+
# How mature is this project? Common values are
20+
# 3 - Alpha
21+
# 4 - Beta
22+
# 5 - Production/Stable
23+
# Indicate who your project is intended for
24+
# Pick your license as you wish (should match "license" above)
25+
# Specify the Python versions you support here. In particular, ensure
26+
# that you indicate whether you support Python 2, Python 3 or both.
27+
classifiers =
28+
Development Status :: 3 - Alpha
29+
Intended Audience :: Developers
30+
Topic :: Software Development :: Build Tools
31+
License :: OSI Approved :: MIT License
32+
Programming Language :: Python :: 2
33+
Programming Language :: Python :: 2.7
34+
Programming Language :: Python :: 3
35+
Programming Language :: Python :: 3.3
36+
Programming Language :: Python :: 3.4
37+
Programming Language :: Python :: 3.5
38+
Programming Language :: Python :: 3.6
39+
40+
[options]
41+
include_package_data = True
42+
# You can just specify the packages manually here if your project is
43+
# simple. Or you can use find.
44+
packages = find:
45+
# Alternatively, if you want to distribute just a my_module.py, uncomment
46+
# this:
47+
# py_modules=["my_module"],
48+
49+
# List run-time dependencies here. These will be installed by pip when
50+
# your project is installed. For an analysis of "install_requires" vs pip's
51+
# requirements files see:
52+
# https://packaging.python.org/en/latest/requirements.html
53+
install_requires =
54+
peppercorn
55+
56+
[options.extras_require]
57+
# List additional groups of dependencies here (e.g. development
58+
# dependencies). You can install these using the following syntax,
59+
# for example:
60+
# $ pip install -e .[dev,test]
61+
dev =
62+
check-manifest
63+
test =
64+
coverage
65+
66+
[options.entry_points]
67+
# To provide executable scripts, use entry points in preference to the
68+
# "scripts" keyword. Entry points provide cross-platform support and allow
69+
# pip to create the appropriate form of executable for the target platform.
70+
console_scripts =
71+
sample = sample:main
72+
73+
[options.packages.find]
74+
# Exclude specific packages
75+
exclude =
76+
contrib
77+
docs
78+
tests
79+
80+
[options.package_data]
81+
# If there are data files included in your packages that need to be
82+
# installed, specify them here. If using Python 2.6 or less, then these
83+
# have to be included in MANIFEST.in as well.
84+
sample = package_data.dat
85+
186
[bdist_wheel]
287
# This flag says that the code is written to work on both Python 2 and Python
388
# 3. If at all possible, it is good practice to do this. If you cannot, you

setup.py

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -6,108 +6,13 @@
66
"""
77

88
# Always prefer setuptools over distutils
9-
from setuptools import setup, find_packages
10-
# To use a consistent encoding
11-
from codecs import open
12-
from os import path
9+
from setuptools import setup
1310

14-
here = path.abspath(path.dirname(__file__))
15-
16-
# Get the long description from the README file
17-
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
18-
long_description = f.read()
1911

2012
setup(
21-
name='sample',
22-
23-
# Versions should comply with PEP440. For a discussion on single-sourcing
24-
# the version across setup.py and the project code, see
25-
# https://packaging.python.org/en/latest/single_source_version.html
26-
version='1.2.0',
27-
28-
description='A sample Python project',
29-
long_description=long_description,
30-
31-
# The project's main homepage.
32-
url='https://github.com/pypa/sampleproject',
33-
34-
# Author details
35-
author='The Python Packaging Authority',
36-
author_email='[email protected]',
37-
38-
# Choose your license
39-
license='MIT',
40-
41-
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
42-
classifiers=[
43-
# How mature is this project? Common values are
44-
# 3 - Alpha
45-
# 4 - Beta
46-
# 5 - Production/Stable
47-
'Development Status :: 3 - Alpha',
48-
49-
# Indicate who your project is intended for
50-
'Intended Audience :: Developers',
51-
'Topic :: Software Development :: Build Tools',
52-
53-
# Pick your license as you wish (should match "license" above)
54-
'License :: OSI Approved :: MIT License',
55-
56-
# Specify the Python versions you support here. In particular, ensure
57-
# that you indicate whether you support Python 2, Python 3 or both.
58-
'Programming Language :: Python :: 2',
59-
'Programming Language :: Python :: 2.7',
60-
'Programming Language :: Python :: 3',
61-
'Programming Language :: Python :: 3.3',
62-
'Programming Language :: Python :: 3.4',
63-
'Programming Language :: Python :: 3.5',
64-
],
65-
66-
# What does your project relate to?
67-
keywords='sample setuptools development',
68-
69-
# You can just specify the packages manually here if your project is
70-
# simple. Or you can use find_packages().
71-
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
72-
73-
# Alternatively, if you want to distribute just a my_module.py, uncomment
74-
# this:
75-
# py_modules=["my_module"],
76-
77-
# List run-time dependencies here. These will be installed by pip when
78-
# your project is installed. For an analysis of "install_requires" vs pip's
79-
# requirements files see:
80-
# https://packaging.python.org/en/latest/requirements.html
81-
install_requires=['peppercorn'],
82-
83-
# List additional groups of dependencies here (e.g. development
84-
# dependencies). You can install these using the following syntax,
85-
# for example:
86-
# $ pip install -e .[dev,test]
87-
extras_require={
88-
'dev': ['check-manifest'],
89-
'test': ['coverage'],
90-
},
91-
92-
# If there are data files included in your packages that need to be
93-
# installed, specify them here. If using Python 2.6 or less, then these
94-
# have to be included in MANIFEST.in as well.
95-
package_data={
96-
'sample': ['package_data.dat'],
97-
},
98-
9913
# Although 'package_data' is the preferred approach, in some case you may
10014
# need to place data files outside of your packages. See:
10115
# http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa
10216
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
10317
data_files=[('my_data', ['data/data_file'])],
104-
105-
# To provide executable scripts, use entry points in preference to the
106-
# "scripts" keyword. Entry points provide cross-platform support and allow
107-
# pip to create the appropriate form of executable for the target platform.
108-
entry_points={
109-
'console_scripts': [
110-
'sample=sample:main',
111-
],
112-
},
11318
)

0 commit comments

Comments
 (0)