Skip to content

Commit f95a4b5

Browse files
author
Sylvain MARIE
committed
packaging improvements: set the "universal wheel" flag to 1, and cleaned up the setup.py. In particular removed dependency to six for setup. Fixes #57
1 parent 1b5afc6 commit f95a4b5

File tree

3 files changed

+18
-26
lines changed

3 files changed

+18
-26
lines changed

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ env:
1818

1919
before_install:
2020
# (a) linux dependencies
21-
- sudo apt-get install pandoc
2221
- sudo apt-get install ant
2322
- sudo apt-get install ant-optional # for junitreports
2423

2524
install:
2625
- pip list
27-
# needs to be installed beforehand
28-
- pip install setuptools_scm
26+
- pip install six setuptools_scm # apparently python 2 requires this
2927
- python ci_tools/py_install.py pip ci_tools/requirements-pip.txt
3028
# this does not work anymore on python 2 so lets only do it when needed
3129
- if [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then pip install mkdocs-material mkdocs; fi;
@@ -85,7 +83,7 @@ after_success:
8583
echo "File 'ci_tools/github_travis_rsa' has not been created, please check your encrypted repo token in .travis.yml, on the line starting with 'openssl aes-256-cbc...'"
8684
fi
8785
# -- create the _version.py file
88-
- python ci_tools/write_version.py ./valid8
86+
# - python ci_tools/write_version.py ./valid8
8987

9088
deploy:
9189
# Deploy on PyPI on tags

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# This flag says that the code is written to work on both Python 2 and Python
88
# 3. If at all possible, it is good practice to do this. If you cannot, you
99
# will need to generate wheels for each Python version that you support.
10-
universal=0
10+
universal=1
1111

1212
[metadata]
1313
description-file = README.md

setup.py

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,24 @@
33
https://packaging.python.org/en/latest/distributing.html
44
https://github.com/pypa/sampleproject
55
"""
6-
from six import raise_from
76
from os import path
8-
7+
import pkg_resources
98
from setuptools import setup, find_packages
109

11-
here = path.abspath(path.dirname(__file__))
10+
pkg_resources.require("setuptools>=39.2")
11+
pkg_resources.require("setuptools_scm")
12+
13+
from setuptools_scm import get_version # noqa: E402
1214

1315
# *************** Dependencies *********
1416
INSTALL_REQUIRES = ['makefun', 'six', 'future;python_version<"3.3"', 'funcsigs;python_version<"3.3"', 'decopatch',
1517
'functools32;python_version<"3.2"'] # 'typing_inspect' is now copied internally so as to be compliant with very old versions of typing module
1618
DEPENDENCY_LINKS = []
17-
SETUP_REQUIRES = ['pytest-runner', 'setuptools_scm', 'enum34;python_version<"3.4"', 'six']
19+
SETUP_REQUIRES = ['pytest-runner', 'setuptools_scm', 'enum34;python_version<"3.4"']
1820
TESTS_REQUIRE = ['pytest>=4.4.0', 'pytest-logging', 'enforce', 'mini_lambda', 'attrs', 'numpy',
1921
'autoclass', 'checktypes', 'pytest-cases']
2022
EXTRAS_REQUIRE = {}
2123

22-
# simple check
23-
try:
24-
from setuptools_scm import get_version
25-
except Exception as e:
26-
raise_from(Exception('Required packages for setup not found. Please install `setuptools_scm`'), e)
27-
2824
# ************** ID card *****************
2925
DISTNAME = 'valid8'
3026
DESCRIPTION = 'Yet another validation lib ;). Provides tools for general-purpose variable validation, ' \
@@ -34,23 +30,16 @@
3430
MAINTAINER = 'Sylvain Marié'
3531
MAINTAINER_EMAIL = '[email protected]'
3632
URL = 'https://github.com/smarie/python-valid8'
33+
DOWNLOAD_URL = URL + '/tarball/' + get_version()
3734
LICENSE = 'BSD 3-Clause'
3835
LICENSE_LONG = 'License :: OSI Approved :: BSD License'
39-
40-
version_for_download_url = get_version()
41-
DOWNLOAD_URL = URL + '/tarball/' + version_for_download_url
42-
4336
KEYWORDS = 'decorate decorator input arg args argument function contract value check checker valid validate validator' \
4437
' validation'
4538

39+
here = path.abspath(path.dirname(__file__))
4640
with open(path.join(here, 'docs', 'long_description.md')) as f:
4741
LONG_DESCRIPTION = f.read()
4842

49-
# ************* VERSION **************
50-
# --Get the Version number from VERSION file, see https://packaging.python.org/single_source_version/ option 4.
51-
# THIS IS DEPRECATED AS WE NOW USE GIT TO MANAGE VERSION
52-
# with open(path.join(here, 'VERSION')) as version_file:
53-
# VERSION = version_file.read().strip()
5443
# OBSOLETES = []
5544

5645
setup(
@@ -96,15 +85,17 @@
9685
# 'Programming Language :: Python :: 3.4',
9786
'Programming Language :: Python :: 3.5',
9887
'Programming Language :: Python :: 3.6',
99-
'Programming Language :: Python :: 3.7'
88+
'Programming Language :: Python :: 3.7',
89+
90+
# 'Framework :: Pytest'
10091
],
10192

10293
# What does your project relate to?
10394
keywords=KEYWORDS,
10495

10596
# You can just specify the packages manually here if your project is
10697
# simple. Or you can use find_packages().
107-
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
98+
packages=find_packages(exclude=['contrib', 'docs', '*tests*']),
10899

109100
# Alternatively, if you want to distribute just a my_module.py, uncomment
110101
# this:
@@ -139,6 +130,9 @@
139130
# have to be included in MANIFEST.in as well.
140131
# Note: we use the empty string so that this also works with submodules
141132
package_data={"": ['py.typed', '*.pyi']},
133+
# IMPORTANT: DO NOT set the `include_package_data` flag !! It triggers inclusion of all git-versioned files
134+
# see https://github.com/pypa/setuptools_scm/issues/190#issuecomment-351181286
135+
# include_package_data=True,
142136

143137
# Although 'package_data' is the preferred approach, in some case you may
144138
# need to place data files outside of your packages. See:

0 commit comments

Comments
 (0)