Skip to content

Commit

Permalink
BLD: remove generated Cython files from sdist
Browse files Browse the repository at this point in the history
Rationale: it has happened multiple times in the recent past that users
needed to use a more recent Cython than was used to generate the sdist
of the most recent release available on PyPI (e.g. for building with
a not-yet-released version of Python for which a Cython fix just
landed).  The dependency specification and packaging tools have matured
to the point where it should be fine to require Cython to be installed.
Also, we have wheels (and conda-forge packages) for Windows, Linux and
macOS, so this change won't be visible at all to the average user.

Closes numpygh-13790

Also adds pyproject.toml to MANIFEST.in, it was missing.
  • Loading branch information
rgommers committed Sep 8, 2019
1 parent c280ab6 commit d630d96
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Avoid using MANIFEST.in for that.
#
include MANIFEST.in
include pyproject.toml
include pytest.ini
include *.txt
include README.md
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools", "wheel", "cython"] # PEP 508 specification
requires = [
"setuptools",
"wheel",
"Cython>=0.29.13", # Note: keep in sync with tools/cythonize.py
]


[tool.towncrier]
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@ def setup_package():
if run_build:
from numpy.distutils.core import setup
cwd = os.path.abspath(os.path.dirname(__file__))
if not os.path.exists(os.path.join(cwd, 'PKG-INFO')):
# Generate Cython sources, unless building from source release
if not 'sdist' in sys.argv:
# Generate Cython sources, unless we're generating an sdist
generate_cython()

metadata['configuration'] = configuration
Expand Down
1 change: 1 addition & 0 deletions tools/cythonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def process_pyx(fromfile, tofile):
# Cython 0.29.13 is required for Python 3.8 and there are
# other fixes in the 0.29 series that are needed even for earlier
# Python versions.
# Note: keep in sync with that in pyproject.toml
required_version = LooseVersion('0.29.13')

if LooseVersion(cython_version) < required_version:
Expand Down

0 comments on commit d630d96

Please sign in to comment.