Skip to content

Commit 06122cd

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 #21
1 parent b2c95a9 commit 06122cd

File tree

2 files changed

+16
-23
lines changed

2 files changed

+16
-23
lines changed

setup.cfg

+1-1
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

+15-22
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
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

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

1317
# Check that code generation has been run, otherwise run it
@@ -31,40 +35,24 @@
3135
# *************** Dependencies *********
3236
INSTALL_REQUIRES = []
3337
DEPENDENCY_LINKS = []
34-
SETUP_REQUIRES = ['pytest-runner', 'setuptools_scm', 'pypandoc', 'pandoc', 'ordered-set', 'mako', 'six']
35-
TESTS_REQUIRE = ['pytest', 'pytest-logging', 'pytest-cov', 'numpy', 'pandas']
38+
SETUP_REQUIRES = ['pytest-runner', 'setuptools_scm', 'ordered-set', 'mako']
39+
TESTS_REQUIRE = ['pytest', 'numpy', 'pandas']
3640
EXTRAS_REQUIRE = {}
3741

38-
# simple check
39-
try:
40-
from setuptools_scm import get_version
41-
except Exception as e:
42-
raise_from(Exception('Required packages for setup not found. Please install `setuptools_scm`'), e)
43-
4442
# ************** ID card *****************
4543
DISTNAME = 'mini_lambda'
4644
DESCRIPTION = 'Simple lambda functions without `lambda x:` and with string conversion capability.'
4745
MAINTAINER = 'Sylvain MARIE'
4846
MAINTAINER_EMAIL = '[email protected]'
4947
URL = 'https://github.com/smarie/python-mini-lambda'
48+
DOWNLOAD_URL = URL + '/tarball/' + get_version()
5049
LICENSE = 'BSD 3-Clause'
5150
LICENSE_LONG = 'License :: OSI Approved :: BSD License'
52-
53-
version_for_download_url = get_version()
54-
DOWNLOAD_URL = URL + '/tarball/' + version_for_download_url
55-
5651
KEYWORDS = 'mini minimal lambda expr expression simple print string func function symbol symbolic'
5752

5853
with open(path.join(here, 'docs', 'long_description.md')) as f:
5954
LONG_DESCRIPTION = f.read()
6055

61-
# ************* VERSION **************
62-
# --Get the Version number from VERSION file, see https://packaging.python.org/single_source_version/ option 4.
63-
# THIS IS DEPRECATED AS WE NOW USE GIT TO MANAGE VERSION
64-
# with open(path.join(here, 'VERSION')) as version_file:
65-
# VERSION = version_file.read().strip()
66-
# OBSOLETES = []
67-
6856
setup(
6957
name=DISTNAME,
7058
description=DESCRIPTION,
@@ -109,14 +97,16 @@
10997
'Programming Language :: Python :: 3.5',
11098
'Programming Language :: Python :: 3.6',
11199
'Programming Language :: Python :: 3.7',
100+
101+
# 'Framework :: Pytest'
112102
],
113103

114104
# What does your project relate to?
115105
keywords=KEYWORDS,
116106

117107
# You can just specify the packages manually here if your project is
118108
# simple. Or you can use find_packages().
119-
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
109+
packages=find_packages(exclude=['contrib', 'docs', '*tests*']),
120110

121111
# Alternatively, if you want to distribute just a my_module.py, uncomment
122112
# this:
@@ -151,6 +141,9 @@
151141
# have to be included in MANIFEST.in as well.
152142
# Note: we use the empty string so that this also works with submodules
153143
package_data={"": ['py.typed', '*.pyi']},
144+
# IMPORTANT: DO NOT set the `include_package_data` flag !! It triggers inclusion of all git-versioned files
145+
# see https://github.com/pypa/setuptools_scm/issues/190#issuecomment-351181286
146+
# include_package_data=True,
154147

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

0 commit comments

Comments
 (0)