Skip to content

Commit

Permalink
packaging improvements: set the "universal wheel" flag to 1, and clea…
Browse files Browse the repository at this point in the history
…ned up the `setup.py`. In particular removed dependency to `six` for setup and added `py.typed` file, as well as set the `zip_safe` flag to False. Removed tests folder from package. Fixes #39
  • Loading branch information
Sylvain MARIE committed Apr 25, 2020
1 parent 0d1bd85 commit 9c61d5a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
Empty file added pytest_steps/py.typed
Empty file.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# This flag says that the code is written to work on both Python 2 and Python
# 3. If at all possible, it is good practice to do this. If you cannot, you
# will need to generate wheels for each Python version that you support.
universal=0
universal=1

[metadata]
description-file = README.md
Expand Down
45 changes: 21 additions & 24 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,37 @@
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from six import raise_from
from os import path

import pkg_resources
from setuptools import setup, find_packages

here = path.abspath(path.dirname(__file__))
pkg_resources.require("setuptools>=39.2")
pkg_resources.require("setuptools_scm")

from setuptools_scm import get_version # noqa: E402

# *************** Dependencies *********
INSTALL_REQUIRES = ['makefun>=1.5', 'wrapt', 'functools32;python_version<"3.2"', 'funcsigs;python_version<"3.3"', 'six']
DEPENDENCY_LINKS = []
SETUP_REQUIRES = ['pytest-runner', 'setuptools_scm', 'six']
SETUP_REQUIRES = ['pytest-runner', 'setuptools_scm']
TESTS_REQUIRE = ['pytest', 'pytest-logging', 'pytest-harvest>=1.4.0', 'pytest-cases']
EXTRAS_REQUIRE = {}

# simple check
try:
from setuptools_scm import get_version
except Exception as e:
raise_from(Exception('Required packages for setup not found. Please install `setuptools_scm`'), e)

# ************** ID card *****************
DISTNAME = 'pytest-steps'
DESCRIPTION = 'Create step-wise / incremental tests in pytest.'
MAINTAINER = 'Sylvain MARIE'
MAINTAINER_EMAIL = '[email protected]'
URL = 'https://github.com/smarie/python-pytest-steps'
DOWNLOAD_URL = URL + '/tarball/' + get_version()
LICENSE = 'BSD 3-Clause'
LICENSE_LONG = 'License :: OSI Approved :: BSD License'

version_for_download_url = get_version()
DOWNLOAD_URL = URL + '/tarball/' + version_for_download_url

KEYWORDS = 'pytest test step incremental decorator parametrize parameter state share result modular'

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

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

setup(
Expand Down Expand Up @@ -100,7 +89,7 @@

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

# Alternatively, if you want to distribute just a my_module.py, uncomment
# this:
Expand All @@ -114,7 +103,7 @@
dependency_links=DEPENDENCY_LINKS,

# we're using git
use_scm_version={'write_to': 'pytest_steps/_version.py'}, # this provides the version + adds the date if local non-commited changes.
use_scm_version={'write_to': '%s/_version.py' % DISTNAME.replace('-', '_')}, # this provides the version + adds the date if local non-commited changes.
# use_scm_version={'local_scheme':'dirty-tag'}, # this provides the version + adds '+dirty' if local non-commited changes.
setup_requires=SETUP_REQUIRES,

Expand All @@ -133,9 +122,11 @@
# If there are data files included in your packages that need to be
# installed, specify them here. If using Python 2.6 or less, then these
# have to be included in MANIFEST.in as well.
# package_data={
# 'sample': ['package_data.dat'],
# },
# Note: we use the empty string so that this also works with submodules
package_data={"": ['py.typed', '*.pyi']},
# IMPORTANT: DO NOT set the `include_package_data` flag !! It triggers inclusion of all git-versioned files
# see https://github.com/pypa/setuptools_scm/issues/190#issuecomment-351181286
# include_package_data=True,

# Although 'package_data' is the preferred approach, in some case you may
# need to place data files outside of your packages. See:
Expand All @@ -154,4 +145,10 @@

# the following makes a plugin available to pytest
entry_points={"pytest11": ["steps = pytest_steps.plugin"]},

# explicitly setting the flag to avoid `ply` being downloaded
# see https://github.com/smarie/python-getversion/pull/5
# and to make mypy happy
# see https://mypy.readthedocs.io/en/latest/installed_packages.html
zip_safe=False,
)

0 comments on commit 9c61d5a

Please sign in to comment.