-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set build_isolation and use_pep517 correctly
- Fix how `use_pep517` and `build_isolation` are read from the environment -- introduce a new environment helper to detect `<PREFIX>_<SETTING>` and `<PREFIX>_NO_<SETTING>`, check for booleans and return appropriately boolean, str, or None types - Check for `False` values when adding `--no-use-pep517` and `--no-build-isolation` during resolution rather than falsey values - Change environment variable name from `PIP_PYTHON_VERSION` to `PIPENV_REQUESTED_PYTHON_VERSION` to avoid causing `pip` to fail due to accidentally percieving the `python_version` flag as being set -- this is an artifact from attempting to resolve outside of the virtualenv - Add `pipenv` to the path of patched `notpip.__main__` to accommodate updated import fully qualified module names - Update `pip` and `piptools` patches - Add test packages for each of two known failure modes: outdated `setuptools` with a missing `build-backend` (which `pip` forces to `build_meta:__legacy__` & which doesn't exist before `40.8`), and `import Cython` statements in `setup.py` in packages with properly defined `pyproject.toml` `build-backend` lines. - Fixes #4231 - Replaces, includes, and closes #4242 Signed-off-by: Dan Ryan <[email protected]> Add integration tests for #4231 Signed-off-by: Dan Ryan <[email protected]>
- Loading branch information
1 parent
7059a26
commit cc00b8b
Showing
17 changed files
with
475 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
[build-system] | ||
requires = ["setuptools >= 40.6.0", "setuptools-scm", "cython"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.black] | ||
line-length = 90 | ||
target_version = ['py27', 'py35', 'py36', 'py37', 'py38'] | ||
include = '\.pyi?$' | ||
exclude = ''' | ||
/( | ||
\.eggs | ||
| \.git | ||
| \.hg | ||
| \.mypy_cache | ||
| \.tox | ||
| \.pyre_configuration | ||
| \.venv | ||
| _build | ||
| buck-out | ||
| build | ||
| dist | ||
) | ||
''' | ||
|
||
[tool.towncrier] | ||
package = 'cython-import-package' | ||
package_dir = 'src' | ||
filename = 'CHANGELOG.rst' | ||
directory = 'news/' | ||
title_format = '{version} ({project_date})' | ||
issue_format = '`#{issue} <https://github.com/sarugaku/cython_import_package/issues/{issue}>`_' | ||
template = 'tasks/CHANGELOG.rst.jinja2' | ||
|
||
[[tool.towncrier.type]] | ||
directory = 'feature' | ||
name = 'Features' | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = 'bugfix' | ||
name = 'Bug Fixes' | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = 'trivial' | ||
name = 'Trivial Changes' | ||
showcontent = false | ||
|
||
[[tool.towncrier.type]] | ||
directory = 'removal' | ||
name = 'Removals and Deprecations' | ||
showcontent = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[metadata] | ||
name = cython_import_package | ||
package_name = cython-import-package | ||
description = A fake python package. | ||
url = https://github.com/sarugaku/cython_import_package | ||
author = Dan Ryan | ||
author_email = [email protected] | ||
long_description = file: README.rst | ||
license = ISC License | ||
keywords = fake package test | ||
classifier = | ||
Development Status :: 1 - Planning | ||
License :: OSI Approved :: ISC License (ISCL) | ||
Operating System :: OS Independent | ||
Programming Language :: Python :: 2 | ||
Programming Language :: Python :: 2.6 | ||
Programming Language :: Python :: 2.7 | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3.4 | ||
Programming Language :: Python :: 3.5 | ||
Programming Language :: Python :: 3.6 | ||
Programming Language :: Python :: 3.7 | ||
Topic :: Software Development :: Libraries :: Python Modules | ||
|
||
[options.extras_require] | ||
tests = | ||
pytest | ||
pytest-xdist | ||
pytest-cov | ||
pytest-timeout | ||
readme-renderer[md] | ||
twine | ||
dev = | ||
black;python_version>="3.6" | ||
flake8 | ||
flake8-bugbear;python_version>="3.5" | ||
invoke | ||
isort | ||
mypy;python_version>="3.5" | ||
parver | ||
pre-commit | ||
rope | ||
wheel | ||
|
||
[options] | ||
zip_safe = true | ||
python_requires = >=2.6,!=3.0,!=3.1,!=3.2,!=3.3 | ||
install_requires = | ||
attrs | ||
vistir | ||
|
||
[bdist_wheel] | ||
universal = 1 | ||
|
||
[egg_info] | ||
tag_build = | ||
tag_date = 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import ast | ||
import os | ||
|
||
from setuptools import setup, find_packages | ||
from setuptools.command.test import test as TestCommand | ||
|
||
# ORDER MATTERS | ||
# Import this after setuptools or it will fail | ||
from Cython.Build import cythonize # noqa: I100 | ||
import Cython.Distutils | ||
|
||
|
||
|
||
ROOT = os.path.dirname(__file__) | ||
|
||
PACKAGE_NAME = 'cython_import_package' | ||
|
||
VERSION = None | ||
|
||
with open(os.path.join(ROOT, 'src', PACKAGE_NAME.replace("-", "_"), '__init__.py')) as f: | ||
for line in f: | ||
if line.startswith('__version__ = '): | ||
VERSION = ast.literal_eval(line[len('__version__ = '):].strip()) | ||
break | ||
if VERSION is None: | ||
raise EnvironmentError('failed to read version') | ||
|
||
|
||
# Put everything in setup.cfg, except those that don't actually work? | ||
setup( | ||
# These really don't work. | ||
package_dir={'': 'src'}, | ||
packages=find_packages('src'), | ||
|
||
# I don't know how to specify an empty key in setup.cfg. | ||
package_data={ | ||
'': ['LICENSE*', 'README*'], | ||
}, | ||
setup_requires=["setuptools_scm", "cython"], | ||
|
||
# I need this to be dynamic. | ||
version=VERSION, | ||
) |
1 change: 1 addition & 0 deletions
1
tests/fixtures/cython-import-package/src/cython_import_package/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
[build-system] | ||
requires = ["setuptools>=30.3.0", "wheel", "setuptools_scm>=3.3.1"] | ||
|
||
[tool.black] | ||
line-length = 90 | ||
target_version = ['py27', 'py35', 'py36', 'py37', 'py38'] | ||
include = '\.pyi?$' | ||
exclude = ''' | ||
/( | ||
\.eggs | ||
| \.git | ||
| \.hg | ||
| \.mypy_cache | ||
| \.tox | ||
| \.pyre_configuration | ||
| \.venv | ||
| _build | ||
| buck-out | ||
| build | ||
| dist | ||
) | ||
''' | ||
|
||
[tool.towncrier] | ||
package = 'legacy-backend-package' | ||
package_dir = 'src' | ||
filename = 'CHANGELOG.rst' | ||
directory = 'news/' | ||
title_format = '{version} ({project_date})' | ||
issue_format = '`#{issue} <https://github.com/sarugaku/legacy_backend_package/issues/{issue}>`_' | ||
template = 'tasks/CHANGELOG.rst.jinja2' | ||
|
||
[[tool.towncrier.type]] | ||
directory = 'feature' | ||
name = 'Features' | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = 'bugfix' | ||
name = 'Bug Fixes' | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = 'trivial' | ||
name = 'Trivial Changes' | ||
showcontent = false | ||
|
||
[[tool.towncrier.type]] | ||
directory = 'removal' | ||
name = 'Removals and Deprecations' | ||
showcontent = true |
Oops, something went wrong.