From f3ff0541b6967ee91be3f572c5afe4f559436aa1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 26 Jan 2019 12:12:55 -0500 Subject: [PATCH 001/272] Add Tidelift template --- README.rst | 11 +++++++++++ docs/_templates/tidelift-sidebar.html | 6 ++++++ docs/conf.py | 4 ++++ 3 files changed, 21 insertions(+) create mode 100644 README.rst create mode 100644 docs/_templates/tidelift-sidebar.html create mode 100644 docs/conf.py diff --git a/README.rst b/README.rst new file mode 100644 index 00000000000..5d77d8d3a88 --- /dev/null +++ b/README.rst @@ -0,0 +1,11 @@ +.. image:: https://tidelift.com/badges/github/GROUP/PROJECT + :target: https://tidelift.com/subscription/pkg/pypi-PROJECT?utm_source=pypi-PROJECT&utm_medium=readme + + +Security Contact +================ + +If you wish to report a security vulnerability, the public disclosure +of which may exacerbate the risk, please +`Contact Tidelift security `_, +which will coordinate the fix and disclosure privately. diff --git a/docs/_templates/tidelift-sidebar.html b/docs/_templates/tidelift-sidebar.html new file mode 100644 index 00000000000..c89c0f09d05 --- /dev/null +++ b/docs/_templates/tidelift-sidebar.html @@ -0,0 +1,6 @@ +

Professional support

+ +

+Professionally-supported {{ project }} is available with the +Tidelift Subscription. +

diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000000..d0287332101 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,4 @@ + +# Custom sidebar templates, maps document names to template names. +templates_path = ['_templates'] +html_sidebars = {'index': 'tidelift-sidebar.html'} From c6655951aa8292127f01d53c337da1da642efe74 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 26 Jan 2019 13:18:15 -0500 Subject: [PATCH 002/272] Rely on alabaster theme to support sidebar rendering. --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index d0287332101..3d109305b42 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,5 @@ # Custom sidebar templates, maps document names to template names. +html_theme = 'alabaster' templates_path = ['_templates'] html_sidebars = {'index': 'tidelift-sidebar.html'} From 9edd5b701549833ebbfb354c072962c58e5394ac Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 22 Mar 2019 19:54:23 -0400 Subject: [PATCH 003/272] Use nicer, simpler phrasing --- README.rst | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 5d77d8d3a88..357626220be 100644 --- a/README.rst +++ b/README.rst @@ -1,11 +1,9 @@ .. image:: https://tidelift.com/badges/github/GROUP/PROJECT :target: https://tidelift.com/subscription/pkg/pypi-PROJECT?utm_source=pypi-PROJECT&utm_medium=readme - Security Contact ================ -If you wish to report a security vulnerability, the public disclosure -of which may exacerbate the risk, please -`Contact Tidelift security `_, -which will coordinate the fix and disclosure privately. +To report a security vulnerability, please use the +`Tidelift security contact `_. +Tidelift will coordinate the fix and disclosure. From e8db26a129378279833620da952a1ecc6cef937b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 17 May 2019 16:17:33 -0400 Subject: [PATCH 004/272] Add support for automatic publishing of release notes --- .travis.yml | 6 ++++++ tox.ini | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 .travis.yml create mode 100644 tox.ini diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..13f58071af5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +jobs: + include: + - stage: deploy + env: + # TIDELIFT_TOKEN + - secure: ... diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000000..8f419798dc9 --- /dev/null +++ b/tox.ini @@ -0,0 +1,7 @@ +[testenv:release] +passenv = + TIDELIFT_TOKEN +deps = + jaraco.tidelift +commands = + python -m jaraco.tidelift.publish-release-notes From 534678f19edd76e6f93ad31900d9a92d00ef25fd Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 17 May 2019 16:37:45 -0400 Subject: [PATCH 005/272] Use technique for environment passing matching that found in jaraco/skeleton --- .travis.yml | 1 + tox.ini | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 13f58071af5..a9afa23f5b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,3 +4,4 @@ jobs: env: # TIDELIFT_TOKEN - secure: ... + TOX_TESTENV_PASSENV="TIDELIFT_TOKEN" diff --git a/tox.ini b/tox.ini index 8f419798dc9..7f9b6c1eb47 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,4 @@ [testenv:release] -passenv = - TIDELIFT_TOKEN deps = jaraco.tidelift commands = From fd540b6535f56647581df61333bac7eadc1309f8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 22 Aug 2019 20:01:38 -0400 Subject: [PATCH 006/272] Move Tidelift token into Travis configuration --- .travis.yml | 7 ------- tox.ini | 2 ++ 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a9afa23f5b7..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -jobs: - include: - - stage: deploy - env: - # TIDELIFT_TOKEN - - secure: ... - TOX_TESTENV_PASSENV="TIDELIFT_TOKEN" diff --git a/tox.ini b/tox.ini index 7f9b6c1eb47..35053514ded 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,7 @@ [testenv:release] deps = jaraco.tidelift +passenv = + TIDELIFT_TOKEN commands = python -m jaraco.tidelift.publish-release-notes From 211ff140a4bd82fcb4f01a5569cdc86e4badea8b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 9 Sep 2019 16:36:40 +0100 Subject: [PATCH 007/272] Update badge URL --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 357626220be..420bfb4f041 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -.. image:: https://tidelift.com/badges/github/GROUP/PROJECT +.. image:: https://tidelift.com/badges/package/pypi/PROJECT :target: https://tidelift.com/subscription/pkg/pypi-PROJECT?utm_source=pypi-PROJECT&utm_medium=readme Security Contact From 8f99a0c1b8ee2cb28a8bdb1811ef96da68636d1b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 9 Sep 2019 17:30:03 +0100 Subject: [PATCH 008/272] Add funding reference to project --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000000..230b556cbdf --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +tidelift: pypi/PROJECT From 1c187ad0cf50fbc14626f63cb669a9ec5949012f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 9 Sep 2019 17:45:58 +0100 Subject: [PATCH 009/272] List sidebars to avoid errors looking for template 't' --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 3d109305b42..dbf962ddc46 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,4 +2,4 @@ # Custom sidebar templates, maps document names to template names. html_theme = 'alabaster' templates_path = ['_templates'] -html_sidebars = {'index': 'tidelift-sidebar.html'} +html_sidebars = {'index': ['tidelift-sidebar.html']} From b10e8186a9305d1f899f0fd7d1319b7b15ed1ecd Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 30 Nov 2019 20:33:33 -0500 Subject: [PATCH 010/272] Rebrand to 'For Enterprise' --- docs/_templates/tidelift-sidebar.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_templates/tidelift-sidebar.html b/docs/_templates/tidelift-sidebar.html index c89c0f09d05..ce48f46b8a5 100644 --- a/docs/_templates/tidelift-sidebar.html +++ b/docs/_templates/tidelift-sidebar.html @@ -1,6 +1,6 @@ -

Professional support

+

For Enterprise

Professionally-supported {{ project }} is available with the -Tidelift Subscription. +Tidelift Subscription.

From bb357fb88ca6df10b84235eff42bafa1461b2b75 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 30 Nov 2019 20:38:21 -0500 Subject: [PATCH 011/272] Add a 'For Enterprise' section to the README --- README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.rst b/README.rst index 420bfb4f041..7b317c718e0 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,15 @@ .. image:: https://tidelift.com/badges/package/pypi/PROJECT :target: https://tidelift.com/subscription/pkg/pypi-PROJECT?utm_source=pypi-PROJECT&utm_medium=readme +For Enterprise +============== + +Available as part of the Tidelift Subscription. + +This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use. + +`Learn more `_. + Security Contact ================ From 34d87688eae5d10970f3c8269ac01bcca4ad0229 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 11 Jan 2020 17:23:00 -0500 Subject: [PATCH 012/272] Include token passthrough for azure pipelines publish stage. --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000000..01bfa5f56f4 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,2 @@ + env: + TIDELIFT_TOKEN: $(Tidelift-token) From a5dbf96442a539dbdb59af56898f0571dc68c3d6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 30 May 2020 17:11:49 -0400 Subject: [PATCH 013/272] Drop support for Python 3.5. --- .github/workflows/python-tests.yml | 1 - .travis.yml | 1 - appveyor.yml | 12 +++++------- setup.cfg | 7 +++---- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index e3663cf0b89..41441644f30 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -23,7 +23,6 @@ jobs: - pypy3 - 3.7 - 3.6 - - 3.5 os: - ubuntu-latest - ubuntu-16.04 diff --git a/.travis.yml b/.travis.yml index f97abc51c43..fa04a42e6e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ jobs: include: - python: pypy3 env: DISABLE_COVERAGE=1 # Don't run coverage on pypy (too slow). - - python: 3.5 - python: 3.6 - python: 3.7 - &latest_py3 diff --git a/appveyor.yml b/appveyor.yml index de4e6c66c6c..3c0c36b83ea 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,15 +8,13 @@ environment: matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - APPVEYOR_JOB_NAME: "python35-x64-vs2015" - PYTHON: "C:\\Python35-x64" + APPVEYOR_JOB_NAME: "python36-x64-vs2015" + PYTHON: "C:\\Python36-x64" - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - APPVEYOR_JOB_NAME: "python35-x64-vs2017" - PYTHON: "C:\\Python35-x64" + APPVEYOR_JOB_NAME: "python36-x64-vs2017" + PYTHON: "C:\\Python36-x64" - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - APPVEYOR_JOB_NAME: "python35-x64-vs2019" - PYTHON: "C:\\Python35-x64" - - APPVEYOR_JOB_NAME: "python36-x64" + APPVEYOR_JOB_NAME: "python36-x64-vs2019" PYTHON: "C:\\Python36-x64" - APPVEYOR_JOB_NAME: "python37-x64" PYTHON: "C:\\Python37-x64" diff --git a/setup.cfg b/setup.cfg index 66fb8921b9d..8558057f3b8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,7 +34,6 @@ classifiers = Operating System :: OS Independent Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 @@ -45,7 +44,7 @@ classifiers = [options] zip_safe = True -python_requires = >=3.5 +python_requires = >=3.6 py_modules = easy_install packages = find: @@ -62,14 +61,14 @@ certs = tests = mock pytest-flake8 - flake8-2020; python_version>="3.6" + flake8-2020 virtualenv>=13.0.0 pytest-virtualenv>=1.2.7 pytest>=3.7 wheel coverage>=4.5.1 pytest-cov>=2.5.1 - paver; python_version>="3.6" + paver futures; python_version=="2.7" pip>=19.1 # For proper file:// URLs support. From 38de858e37f9c7a90498ea78c78ed76aca835ad2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 17 Oct 2020 16:32:23 -0400 Subject: [PATCH 014/272] Update changelog --- changelog.d/2435.breaking.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2435.breaking.rst diff --git a/changelog.d/2435.breaking.rst b/changelog.d/2435.breaking.rst new file mode 100644 index 00000000000..d29c60eb39b --- /dev/null +++ b/changelog.d/2435.breaking.rst @@ -0,0 +1 @@ +Require Python 3.6 or later. From 3dd7313d5e61dabd7bf7c647af1eeb6d72a75a6c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 17 Oct 2020 22:06:26 -0400 Subject: [PATCH 015/272] Bump PPC runs --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 918b9745be4..8b945bd3366 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ jobs: - arch: ppc64le python: pypy3 - arch: ppc64le - python: 3.5 + python: 3.6 - &latest_py3_ppc arch: ppc64le python: 3.8 From 97ee66249afed0f38f4266c1280e28af1882fabd Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Oct 2020 13:12:15 -0400 Subject: [PATCH 016/272] Remove Python 3.5 from Appveyor tests --- appveyor.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4d1ae55f4f9..8c24ec3f510 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,10 +20,6 @@ environment: PYTHON: "C:\\Python37-x64" - APPVEYOR_JOB_NAME: "python36-x64" PYTHON: "C:\\Python36-x64" - - APPVEYOR_JOB_NAME: "python35-x64" - PYTHON: "C:\\Python35-x64" - PYTEST_ADDOPTS: "--cov" - TOX_TESTENV_PASSENV: "PYTEST_ADDOPTS" install: # symlink python from a directory with a space From 7cf674e13dbaa2a3c5ef54b22d3af4c380e6b006 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 18 Oct 2020 19:35:09 +0200 Subject: [PATCH 017/272] Reconstruct changelog with categories from history --- CHANGES.rst | 417 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 416 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 30750c0aa03..567b2bac768 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,7 @@ v50.3.2 ------- + Documentation changes ^^^^^^^^^^^^^^^^^^^^^ * #2394: Extended towncrier news template to include change note categories. @@ -23,12 +24,19 @@ Misc v50.3.1 ------- + + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ * #2093: Finalized doc revamp. * #2097: doc: simplify index and group deprecated files * #2102: doc overhaul step 2: break main doc into multiple sections * #2111: doc overhaul step 3: update userguide * #2395: Added a ``:user:`` role to Sphinx config -- by :user:`webknjaz` * #2395: Added an illustrative explanation about the change notes to fragments dir -- by :user:`webknjaz` + +Misc +^^^^ * #2379: Travis CI test suite now tests against PPC64. * #2413: Suppress EOF errors (and other exceptions) when importing lib2to3. @@ -36,12 +44,20 @@ v50.3.1 v50.3.0 ------- + + +Changes +^^^^^^^ * #2368: In distutils, restore support for monkeypatched CCompiler.spawn per pypa/distutils#15. v50.2.0 ------- + + +Changes +^^^^^^^ * #2355: When pip is imported as part of a build, leave distutils patched. * #2380: There are some setuptools specific changes in the ``setuptools.command.bdist_rpm`` module that are no longer needed, because @@ -52,24 +68,40 @@ v50.2.0 v50.1.0 ------- + + +Changes +^^^^^^^ * #2350: Setuptools reverts using the included distutils by default. Platform maintainers and system integrators and others are *strongly* encouraged to set ``SETUPTOOLS_USE_DISTUTILS=local`` to help identify and work through the reported issues with distutils adoption, mainly to file issues and pull requests with pypa/distutils such that distutils performs as needed across every supported environment. v50.0.3 ------- + + +Misc +^^^^ * #2363: Restore link_libpython support on Python 3.7 and earlier (see pypa/distutils#9). v50.0.2 ------- + + +Misc +^^^^ * #2352: In distutils hack, use absolute import rather than relative to avoid bpo-30876. v50.0.1 ------- + + +Misc +^^^^ * #2357: Restored Python 3.5 support in distutils.util for missing ``subprocess._optim_args_from_interpreter_flags``. * #2358: Restored AIX support on Python 3.8 and earlier. * #2361: Add Python 3.10 support to _distutils_hack. Get the 'Loader' abstract class @@ -80,19 +112,34 @@ v50.0.1 v50.0.0 ------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ * #2232: Once again, Setuptools overrides the stdlib distutils on import. For environments or invocations where this behavior is undesirable, users are provided with a temporary escape hatch. If the environment variable ``SETUPTOOLS_USE_DISTUTILS`` is set to ``stdlib``, Setuptools will fall back to the legacy behavior. Use of this escape hatch is discouraged, but it is provided to ease the transition while proper fixes for edge cases can be addressed. + +Changes +^^^^^^^ * #2334: In MSVC module, refine text in error message. v49.6.0 ------- + + +Changes +^^^^^^^ * #2129: In pkg_resources, no longer detect any pathname ending in .egg as a Python egg. Now the path must be an unpacked egg or a zip file. v49.5.0 ------- + + +Changes +^^^^^^^ * #2306: When running as a PEP 517 backend, setuptools does not try to install ``setup_requires`` itself. They are reported as build requirements for the frontend to install. @@ -101,43 +148,74 @@ v49.5.0 v49.4.0 ------- + + +Changes +^^^^^^^ * #2310: Updated vendored packaging version to 20.4. v49.3.2 ------- + + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ * #2300: Improve the ``safe_version`` function documentation + +Misc +^^^^ * #2297: Once again, in stubs prefer exec_module to the deprecated load_module. v49.3.1 ------- + + +Changes +^^^^^^^ * #2316: Removed warning when ``distutils`` is imported before ``setuptools`` when ``distutils`` replacement is not enabled. v49.3.0 ------- + + +Changes +^^^^^^^ * #2259: Setuptools now provides a .pth file (except for editable installs of setuptools) to the target environment to ensure that when enabled, the setuptools-provided distutils is preferred before setuptools has been imported (and even if setuptools is never imported). Honors the SETUPTOOLS_USE_DISTUTILS environment variable. v49.2.1 ------- + + +Misc +^^^^ * #2257: Fixed two flaws in distutils._msvccompiler.MSVCCompiler.spawn. v49.2.0 ------- + + +Changes +^^^^^^^ * #2230: Now warn the user when setuptools is imported after distutils modules have been loaded (exempting PyPy for 3.6), directing the users of packages to import setuptools first. v49.1.3 ------- + + +Misc +^^^^ * #2212: (Distutils) Allow spawn to accept environment. Avoid monkey-patching global state. * #2249: Fix extension loading technique in stubs. @@ -145,39 +223,69 @@ v49.1.3 v49.1.2 ------- + + +Changes +^^^^^^^ * #2232: In preparation for re-enabling a local copy of distutils, Setuptools now honors an environment variable, SETUPTOOLS_USE_DISTUTILS. If set to 'stdlib' (current default), distutils will be used from the standard library. If set to 'local' (default in a imminent backward-incompatible release), the local copy of distutils will be used. v49.1.1 ------- + + +Misc +^^^^ * #2094: Removed pkg_resources.py2_warn module, which is no longer reachable. v49.0.1 ------- + + +Misc +^^^^ * #2228: Applied fix for pypa/distutils#3, restoring expectation that spawn will raise a DistutilsExecError when attempting to execute a missing file. v49.1.0 ------- + + +Changes +^^^^^^^ * #2228: Disabled distutils adoption for now while emergent issues are addressed. v49.0.0 ------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ * #2165: Setuptools no longer installs a site.py file during easy_install or develop installs. As a result, .eggs on PYTHONPATH will no longer take precedence over other packages on sys.path. If this issue affects your production environment, please reach out to the maintainers at #2165. + +Changes +^^^^^^^ * #2137: Removed (private) pkg_resources.RequirementParseError, now replaced by packaging.requirements.InvalidRequirement. Kept the name for compatibility, but users should catch InvalidRequirement instead. * #2180: Update vendored packaging in pkg_resources to 19.2. + +Misc +^^^^ * #2199: Fix exception causes all over the codebase by using ``raise new_exception from old_exception`` v48.0.0 ------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ * #2143: Setuptools adopts distutils from the Python 3.9 standard library and no longer depends on distutils in the standard library. When importing ``setuptools`` or ``setuptools.distutils_patch``, Setuptools will expose its bundled version as a top-level ``distutils`` package (and unload any previously-imported top-level distutils package), retaining the expectation that ``distutils``' objects are actually Setuptools objects. To avoid getting any legacy behavior from the standard library, projects are advised to always "import setuptools" prior to importing anything from distutils. This behavior happens by default when using ``pip install`` or ``pep517.build``. Workflows that rely on ``setup.py (anything)`` will need to first ensure setuptools is imported. One way to achieve this behavior without modifying code is to invoke Python thus: ``python -c "import setuptools; exec(open('setup.py').read())" (anything)``. @@ -185,12 +293,20 @@ v48.0.0 v47.3.2 ------- + + +Misc +^^^^ * #2071: Replaced references to the deprecated imp package with references to importlib v47.3.1 ------- + + +Misc +^^^^ * #1973: Removed ``pkg_resources.py31compat.makedirs`` in favor of the stdlib. Use ``os.makedirs()`` instead. * #2198: Restore ``__requires__`` directive in easy-install wrapper scripts. @@ -198,22 +314,38 @@ v47.3.1 v47.3.0 ------- + + +Changes +^^^^^^^ * #2197: Console script wrapper for editable installs now has a unified template and honors importlib_metadata if present for faster script execution on older Pythons. + +Misc +^^^^ * #2195: Fix broken entry points generated by easy-install (pip editable installs). v47.2.0 ------- + + +Changes +^^^^^^^ * #2194: Editable-installed entry points now load significantly faster on Python versions 3.8+. v47.1.1 ------- + + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ * #2156: Update mailing list pointer in developer docs Incorporate changes from v44.1.1: +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * #2158: Avoid loading working set during ``Distribution.finalize_options`` prior to invoking ``_install_setup_requires``, broken since v42.0.0. @@ -221,25 +353,44 @@ Incorporate changes from v44.1.1: v44.1.1 ------- + + +Misc +^^^^ * #2158: Avoid loading working set during ``Distribution.finalize_options`` prior to invoking ``_install_setup_requires``, broken since v42.0.0. v47.1.0 ------- + + +Changes +^^^^^^^ * #2070: In wheel-to-egg conversion, use simple pkg_resources-style namespace declaration for packages that declare namespace_packages. v47.0.0 ------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ * #2094: Setuptools now actively crashes under Python 2. Python 3.5 or later is required. Users of Python 2 should use ``setuptools<45``. + +Changes +^^^^^^^ * #1700: Document all supported keywords by migrating the ones from distutils. v46.4.0 ------- + + +Changes +^^^^^^^ * #1753: ``attr:`` now extracts variables through rudimentary examination of the AST, thereby supporting modules with third-party imports. If examining the AST fails to find the variable, ``attr:`` falls back to the old behavior of @@ -255,7 +406,14 @@ No significant changes. v46.3.0 ------- + + +Changes +^^^^^^^ * #2089: Package index functionality no longer attempts to remove an md5 fragment from the index URL. This functionality, added for distribute #163 is no longer relevant. + +Misc +^^^^ * #2041: Preserve file modes during pkg files copying, but clear read only flag for target afterwards. * #2105: Filter ``2to3`` deprecation warnings from ``TestDevelop.test_2to3_user_mode``. @@ -263,11 +421,21 @@ v46.3.0 v46.2.0 ------- + + +Changes +^^^^^^^ * #2040: Deprecated the ``bdist_wininst`` command. Binary packages should be built as wheels instead. * #2062: Change 'Mac OS X' to 'macOS' in code. * #2075: Stop recognizing files ending with ``.dist-info`` as distribution metadata. * #2086: Deprecate 'use_2to3' functionality. Packagers are encouraged to use single-source solutions or build tool chains to manage conversions outside of setuptools. + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ * #1698: Added documentation for ``build_meta`` (a bare minimum, not completed). + +Misc +^^^^ * #2082: Filter ``lib2to3`` ``PendingDeprecationWarning`` and ``DeprecationWarning`` in tests, because ``lib2to3`` is `deprecated in Python 3.9 `_. @@ -281,6 +449,10 @@ No significant changes. v46.1.2 ------- + + +Misc +^^^^ * #1458: Added template for reporting Python 2 incompatibilities. @@ -293,12 +465,17 @@ No significant changes. v46.1.0 ------- + + +Changes +^^^^^^^ * #308: Allow version number normalization to be bypassed by wrapping in a 'setuptools.sic()' call. * #1424: Prevent keeping files mode for package_data build. It may break a build if user's package data has read only flag. * #1431: In ``easy_install.check_site_dir``, ensure the installation directory exists. * #1563: In ``pkg_resources`` prefer ``find_spec`` (PEP 451) to ``find_module``. Incorporate changes from v44.1.0: +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * #1704: Set sys.argv[0] in setup script run by build_meta.__legacy__ * #1959: Fix for Python 4: replace unsafe six.PY3 with six.PY2 @@ -308,6 +485,10 @@ Incorporate changes from v44.1.0: v44.1.0 ------- + + +Changes +^^^^^^^ * #1704: Set sys.argv[0] in setup script run by build_meta.__legacy__ * #1959: Fix for Python 4: replace unsafe six.PY3 with six.PY2 * #1994: Fixed a bug in the "setuptools.finalize_distribution_options" hook that lead to ignoring the order attribute of entry points managed by this hook. @@ -316,16 +497,33 @@ v44.1.0 v46.0.0 ------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ * #65: Once again as in 3.0, removed the Features feature. + +Changes +^^^^^^^ * #1890: Fix vendored dependencies so importing ``setuptools.extern.some_module`` gives the same object as ``setuptools._vendor.some_module``. This makes Metadata picklable again. * #1899: Test suite now fails on warnings. + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ * #2011: Fix broken link to distutils docs on package_data + +Misc +^^^^ * #1991: Include pkg_resources test data in sdist, so tests can be executed from it. v45.3.0 ------- + + +Changes +^^^^^^^ * #1557: Deprecated eggsecutable scripts and updated docs. * #1904: Update msvc.py to use CPython 3.8.0 mechanism to find msvc 14+ @@ -333,6 +531,10 @@ v45.3.0 v45.2.0 ------- + + +Changes +^^^^^^^ * #1905: Fixed defect in _imp, introduced in 41.6.0 when the 'tests' directory is not present. * #1941: Improve editable installs with PEP 518 build isolation: @@ -340,12 +542,19 @@ v45.2.0 * The error shown when the install directory is not in ``PYTHONPATH`` has been turned into a warning. * #1981: Setuptools now declares its ``tests`` and ``docs`` dependencies in metadata (extras). * #1985: Add support for installing scripts in environments where bdist_wininst is missing (i.e. Python 3.9). + +Misc +^^^^ * #1968: Add flake8-2020 to check for misuse of sys.version or sys.version_info. v45.1.0 ------- + + +Changes +^^^^^^^ * #1458: Add minimum sunset date and preamble to Python 2 warning. * #1704: Set sys.argv[0] in setup script run by build_meta.__legacy__ * #1974: Add Python 3 Only Trove Classifier and remove universal wheel declaration for more complete transition from Python 2. @@ -354,26 +563,47 @@ v45.1.0 v45.0.0 ------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ * #1458: Drop support for Python 2. Setuptools now requires Python 3.5 or later. Install setuptools using pip >=9 or pin to Setuptools <45 to maintain 2.7 support. + +Changes +^^^^^^^ * #1959: Fix for Python 4: replace unsafe six.PY3 with six.PY2 v44.0.0 ------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ * #1908: Drop support for Python 3.4. v43.0.0 ------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ * #1634: Include ``pyproject.toml`` in source distribution by default. Projects relying on the previous behavior where ``pyproject.toml`` was excluded by default should stop relying on that behavior or add ``exclude pyproject.toml`` to their MANIFEST.in file. + +Changes +^^^^^^^ * #1927: Setuptools once again declares 'setuptools' in the ``build-system.requires`` and adds PEP 517 build support by declaring itself as the ``build-backend``. It additionally specifies ``build-system.backend-path`` to rely on itself for those builders that support it. v42.0.2 ------- +Changes +^^^^^^^ + * #1921: Fix support for easy_install's ``find-links`` option in ``setup.cfg``. * #1922: Build dependencies (setup_requires and tests_require) now install transitive dependencies indicated by extras. @@ -381,12 +611,20 @@ v42.0.2 v42.0.1 ------- + + +Changes +^^^^^^^ * #1918: Fix regression in handling wheels compatibility tags. v42.0.0 ------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ * #1830, #1909: Mark the easy_install script and setuptools command as deprecated, and use `pip `_ when available to fetch/build wheels for missing ``setup_requires``/``tests_require`` requirements, with the following differences in behavior: * support for ``python_requires`` * better support for wheels (proper handling of priority with respect to PEP 425 tags) @@ -395,6 +633,9 @@ v42.0.0 * no support for the ``allow_hosts`` easy_install option (``index_url``/``find_links`` are still honored) * pip environment variables are honored (and take precedence over easy_install options) * #1898: Removed the "upload" and "register" commands in favor of `twine `_. + +Changes +^^^^^^^ * #1767: Add support for the ``license_files`` option in ``setup.cfg`` to automatically include multiple license files in a source distribution. * #1829: Update handling of wheels compatibility tags: @@ -407,46 +648,82 @@ v42.0.0 v41.6.0 ------- + + +Changes +^^^^^^^ * #479: Replace usage of deprecated ``imp`` module with local re-implementation in ``setuptools._imp``. v41.5.1 ------- + + +Changes +^^^^^^^ * #1891: Fix code for detecting Visual Studio's version on Windows under Python 2. v41.5.0 ------- + + +Changes +^^^^^^^ * #1811: Improve Visual C++ 14.X support, mainly for Visual Studio 2017 and 2019. * #1814: Fix ``pkg_resources.Requirement`` hash/equality implementation: take PEP 508 direct URL into account. * #1824: Fix tests when running under ``python3.10``. * #1878: Formally deprecated the ``test`` command, with the recommendation that users migrate to ``tox``. + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ * #1860: Update documentation to mention the egg format is not supported by pip and dependency links support was dropped starting with pip 19.0. * #1862: Drop ez_setup documentation: deprecated for some time (last updated in 2016), and still relying on easy_install (deprecated too). * #1868: Drop most documentation references to (deprecated) EasyInstall. * #1884: Added a trove classifier to document support for Python 3.8. + +Misc +^^^^ * #1886: Added Python 3.8 release to the Travis test matrix. v41.4.0 ------- + + +Changes +^^^^^^^ * #1847: In declarative config, now traps errors when invalid ``python_requires`` values are supplied. v41.3.0 ------- + + +Changes +^^^^^^^ * #1690: When storing extras, rely on OrderedSet to retain order of extras as indicated by the packager, which will also be deterministic on Python 2.7 (with PYTHONHASHSEED unset) and Python 3.6+. + +Misc +^^^^ * #1858: Fixed failing integration test triggered by 'long_description_content_type' in packaging. v41.2.0 ------- + + +Changes +^^^^^^^ * #479: Remove some usage of the deprecated ``imp`` module. + +Misc +^^^^ * #1565: Changed html_sidebars from string to list of string as per https://www.sphinx-doc.org/en/master/changes.html#id58 @@ -454,6 +731,10 @@ v41.2.0 v41.1.0 ------- + + +Misc +^^^^ * #1697: Moved most of the constants from setup.py to setup.cfg * #1749: Fixed issue with the PEP 517 backend where building a source distribution would fail if any tarball existed in the destination directory. * #1750: Fixed an issue with PEP 517 backend where wheel builds would fail if the destination directory did not already exist. @@ -461,12 +742,19 @@ v41.1.0 * #1769: Improve ``package_data`` check: ensure the dictionary values are lists/tuples of strings. * #1788: Changed compatibility fallback logic for ``html.unescape`` to avoid accessing ``HTMLParser.unescape`` when not necessary. ``HTMLParser.unescape`` is deprecated and will be removed in Python 3.9. * #1790: Added the file path to the error message when a ``UnicodeDecodeError`` occurs while reading a metadata file. + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ * #1776: Use license classifiers rather than the license field. v41.0.1 ------- + + +Changes +^^^^^^^ * #1671: Fixed issue with the PEP 517 backend that prevented building a wheel when the ``dist/`` directory contained existing ``.whl`` files. * #1709: In test.paths_on_python_path, avoid adding unnecessary duplicates to the PYTHONPATH. * #1741: In package_index, now honor "current directory" during a checkout of git and hg repositories under Windows @@ -475,22 +763,37 @@ v41.0.1 v41.0.0 ------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ * #1735: When parsing setup.cfg files, setuptools now requires the files to be encoded as UTF-8. Any other encoding will lead to a UnicodeDecodeError. This change removes support for specifying an encoding using a 'coding: ' directive in the header of the file, a feature that was introduces in 40.7. Given the recent release of the aforementioned feature, it is assumed that few if any projects are utilizing the feature to specify an encoding other than UTF-8. v40.9.0 ------- + + +Changes +^^^^^^^ * #1675: Added support for ``setup.cfg``-only projects when using the ``setuptools.build_meta`` backend. Projects that have enabled PEP 517 no longer need to have a ``setup.py`` and can use the purely declarative ``setup.cfg`` configuration file instead. * #1720: Added support for ``pkg_resources.parse_requirements``-style requirements in ``setup_requires`` when ``setup.py`` is invoked from the ``setuptools.build_meta`` build backend. * #1664: Added the path to the ``PKG-INFO`` or ``METADATA`` file in the exception text when the ``Version:`` header can't be found. + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ * #1705: Removed some placeholder documentation sections referring to deprecated features. v40.8.0 ------- + + +Changes +^^^^^^^ * #1652: Added the ``build_meta:__legacy__`` backend, a "compatibility mode" PEP 517 backend that can be used as the default when ``build-backend`` is left unspecified in ``pyproject.toml``. * #1635: Resource paths are passed to ``pkg_resources.resource_string`` and similar no longer accept paths that traverse parents, that begin with a leading ``/``. Violations of this expectation raise DeprecationWarnings and will become errors. Additionally, any paths that are absolute on Windows are strictly disallowed and will raise ValueErrors. * #1536: ``setuptools`` will now automatically include licenses if ``setup.cfg`` contains a ``license_file`` attribute, unless this file is manually excluded inside ``MANIFEST.in``. @@ -499,25 +802,44 @@ v40.8.0 v40.7.3 ------- + + +Changes +^^^^^^^ * #1670: In package_index, revert to using a copy of splituser from Python 3.8. Attempts to use ``urllib.parse.urlparse`` led to problems as reported in #1663 and #1668. This change serves as an alternative to #1499 and fixes #1668. v40.7.2 ------- + + +Changes +^^^^^^^ * #1666: Restore port in URL handling in package_index. v40.7.1 ------- + + +Changes +^^^^^^^ * #1660: On Python 2, when reading config files, downcast options from text to bytes to satisfy distutils expectations. v40.7.0 ------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ * #1551: File inputs for the ``license`` field in ``setup.cfg`` files now explicitly raise an error. + +Changes +^^^^^^^ * #1180: Add support for non-ASCII in setup.cfg (#1062). Add support for native strings on some parameters (#1136). * #1499: ``setuptools.package_index`` no longer relies on the deprecated ``urllib.parse.splituser`` per Python #27485. * #1544: Added tests for PackageIndex.download (for git URLs). @@ -527,30 +849,51 @@ v40.7.0 v40.6.3 ------- + + +Changes +^^^^^^^ * #1594: PEP 517 backend no longer declares setuptools as a dependency as it can be assumed. v40.6.2 ------- + + +Changes +^^^^^^^ * #1592: Fix invalid dependency on external six module (instead of vendored version). v40.6.1 ------- + + +Changes +^^^^^^^ * #1590: Fixed regression where packages without ``author`` or ``author_email`` fields generated malformed package metadata. v40.6.0 ------- + + +Deprecations +^^^^^^^^^^^^ * #1541: Officially deprecated the ``requires`` parameter in ``setup()``. + +Changes +^^^^^^^ * #1519: In ``pkg_resources.normalize_path``, additional path normalization is now performed to ensure path values to a directory is always the same, preventing false positives when checking scripts have a consistent prefix to set up on Windows. * #1545: Changed the warning class of all deprecation warnings; deprecation warning classes are no longer derived from ``DeprecationWarning`` and are thus visible by default. * #1554: ``build_meta.build_sdist`` now includes ``setup.py`` in source distributions by default. * #1576: Started monkey-patching ``get_metadata_version`` and ``read_pkg_file`` onto ``distutils.DistributionMetadata`` to retain the correct version on the ``PKG-INFO`` file in the (deprecated) ``upload`` command. -* #1533: Restricted the ``recursive-include setuptools/_vendor`` to contain only .py and .txt files. + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ * #1395: Changed Pyrex references to Cython in the documentation. * #1456: Documented that the ``rpmbuild`` packages is required for the ``bdist_rpm`` command. * #1537: Documented how to use ``setup.cfg`` for ``src/ layouts`` @@ -559,69 +902,115 @@ v40.6.0 * #1553: Updated installation instructions to point to ``pip install`` instead of ``ez_setup.py``. * #1560: Updated ``setuptools`` distribution documentation to remove some outdated information. * #1564: Documented ``setup.cfg`` minimum version for version and project_urls. + +Misc +^^^^ +* #1533: Restricted the ``recursive-include setuptools/_vendor`` to contain only .py and .txt files. * #1572: Added the ``concurrent.futures`` backport ``futures`` to the Python 2.7 test suite requirements. v40.5.0 ------- + + +Changes +^^^^^^^ * #1335: In ``pkg_resources.normalize_path``, fix issue on Cygwin when cwd contains symlinks. * #1502: Deprecated support for downloads from Subversion in package_index/easy_install. * #1517: Dropped use of six.u in favor of ``u""`` literals. * #1520: Added support for ``data_files`` in ``setup.cfg``. + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ * #1525: Fixed rendering of the deprecation warning in easy_install doc. v40.4.3 ------- + + +Changes +^^^^^^^ * #1480: Bump vendored pyparsing in pkg_resources to 2.2.1. v40.4.2 ------- + + +Misc +^^^^ * #1497: Updated gitignore in repo. v40.4.1 ------- + + +Changes +^^^^^^^ * #1480: Bump vendored pyparsing to 2.2.1. v40.4.0 ------- + + +Changes +^^^^^^^ * #1481: Join the sdist ``--dist-dir`` and the ``build_meta`` sdist directory argument to point to the same target (meaning the build frontend no longer needs to clean manually the dist dir to avoid multiple sdist presence, and setuptools no longer needs to handle conflicts between the two). v40.3.0 ------- + + +Changes +^^^^^^^ * #1402: Fixed a bug with namespace packages under Python 3.6 when one package in current directory hides another which is installed. * #1427: Set timestamp of ``.egg-info`` directory whenever ``egg_info`` command is run. * #1474: ``build_meta.get_requires_for_build_sdist`` now does not include the ``wheel`` package anymore. * #1486: Suppress warnings in pkg_resources.handle_ns. + +Misc +^^^^ * #1479: Remove internal use of six.binary_type. v40.2.0 ------- + + +Changes +^^^^^^^ * #1466: Fix handling of Unicode arguments in PEP 517 backend v40.1.1 -------- + + +Changes +^^^^^^^ * #1465: Fix regression with ``egg_info`` command when tagging is used. v40.1.0 ------- + + +Changes +^^^^^^^ * #1410: Deprecated ``upload`` and ``register`` commands. * #1312: Introduced find_namespace_packages() to find PEP 420 namespace packages. * #1420: Added find_namespace: directive to config parser. @@ -631,24 +1020,44 @@ v40.1.0 * #1388: Fixed "Microsoft Visual C++ Build Tools" link in exception when Visual C++ not found. * #1389: Added support for scripts which have unicode content. * #1416: Moved several Python version checks over to using ``six.PY2`` and ``six.PY3``. + +Misc +^^^^ * #1441: Removed spurious executable permissions from files that don't need them. v40.0.0 ------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ * #1342: Drop support for Python 3.3. + +Changes +^^^^^^^ * #1366: In package_index, fixed handling of encoded entities in URLs. * #1383: In pkg_resources VendorImporter, avoid removing packages imported from the root. + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ * #1379: Minor doc fixes after actually using the new release process. * #1385: Removed section on non-package data files. * #1403: Fix developer's guide. + +Misc +^^^^ * #1404: Fix PEP 518 configuration: set build requirements in ``pyproject.toml`` to ``["wheel"]``. v39.2.0 ------- + + +Changes +^^^^^^^ * #1359: Support using "file:" to load a PEP 440-compliant package version from a text file. * #1360: Fixed issue with a mismatch between the name of the package and the @@ -657,11 +1066,17 @@ v39.2.0 includes the attributes in the ``_provider`` instance variable. * #1365: Take the package_dir option into account when loading the version from a module attribute. + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ * #1353: Added coverage badge to README. * #1356: Made small fixes to the developer guide documentation. * #1357: Fixed warnings in documentation builds and started enforcing that the docs build without warnings in tox. * #1376: Updated release process docs. + +Misc +^^^^ * #1343: The ``setuptools`` specific ``long_description_content_type``, ``project_urls`` and ``provides_extras`` fields are now set consistently after any ``distutils`` ``setup_keywords`` calls, allowing them to override From 6597dcb657705154bb1ae75104dd1b7fab0b8b10 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 18 Oct 2020 13:54:16 -0400 Subject: [PATCH 018/272] Switch to RTD v2 config --- .readthedocs.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index cb10a7f9914..6a40653472f 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,6 +1,8 @@ +# Read the Docs configuration file +# https://docs.readthedocs.io/en/stable/config-file/v2.html + +version: 2 + python: - version: 3 - extra_requirements: - - docs - pip_install: false - requirements: docs/requirements.txt + install: + - requirements: docs/requirements.txt From 0e1fc1c6318864ab70dc0868762e02fa8faaaf8e Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Mon, 19 Oct 2020 10:06:57 +0300 Subject: [PATCH 019/272] s/517/PEP 517/ --- docs/userguide/quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userguide/quickstart.rst b/docs/userguide/quickstart.rst index 697087edb42..874ac086a24 100644 --- a/docs/userguide/quickstart.rst +++ b/docs/userguide/quickstart.rst @@ -21,7 +21,7 @@ the backend (build system) it wants to use. The distribution can then be generated with whatever tools that provides a ``build sdist``-alike functionality. While this may appear cumbersome, given the added pieces, it in fact tremendously enhances the portability of your package. The -change is driven under :pep:`517 <517#build-requirements>`. To learn more about Python packaging in general, +change is driven under :pep:`PEP 517 <517#build-requirements>`. To learn more about Python packaging in general, navigate to the `bottom `_ of this page. From d7170a28dc3ad02eacc69d1c425bb6f1d5afe619 Mon Sep 17 00:00:00 2001 From: Greg Solon Date: Tue, 20 Oct 2020 21:55:56 +0800 Subject: [PATCH 020/272] Update quickstart.rst Removed quotes in setup.cfg which caused build to fail. --- docs/userguide/quickstart.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/userguide/quickstart.rst b/docs/userguide/quickstart.rst index 697087edb42..a9cb76a4ee6 100644 --- a/docs/userguide/quickstart.rst +++ b/docs/userguide/quickstart.rst @@ -43,11 +43,11 @@ such as metadata, contents, dependencies, etc. Here we demonstrate the minimum .. code-block:: ini [metadata] - name = "mypackage" + name = mypackage version = 0.0.1 [options] - packages = "mypackage" + packages = mypackage install_requires = requests importlib; python_version == "2.6" From fb8d9c43500c06f6f2286ea7c7ae452d41cce412 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 14 Nov 2020 20:32:18 -0500 Subject: [PATCH 021/272] Move Tidelift release note publishing to Github Actions. --- .github/workflows/main.yml | 6 ++++++ azure-pipelines.yml | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000000..01999cabbf9 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,6 @@ +jobs: + release: + steps: + - name: Release + env: + TIDELIFT_TOKEN: ${{ secrets.TIDELIFT_TOKEN }} diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 01bfa5f56f4..00000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,2 +0,0 @@ - env: - TIDELIFT_TOKEN: $(Tidelift-token) From ec944a40aa06f0499201b06a308fe713d77ddbf4 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Wed, 18 Nov 2020 16:16:42 +0100 Subject: [PATCH 022/272] Upgrade GHA actions using deprecated env mechanism --- .github/workflows/python-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 2d5abe2767c..e1147ca0cb3 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -62,7 +62,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v2.1.1 + uses: actions/setup-python@v2 if: >- !fromJSON(env.USE_DEADSNAKES) && true || false with: @@ -77,7 +77,7 @@ jobs: run: >- python -m sysconfig - name: Pip cache - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }} From de48cfdb81f285a46d0484e780019b7ee75e95ce Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Wed, 18 Nov 2020 16:25:43 +0100 Subject: [PATCH 023/272] Temporarily allow `set-env` GHA commands Refs: * github.com/deadsnakes/issues/issues/135 * github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ --- .github/workflows/python-tests.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index e1147ca0cb3..b6640181740 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -50,6 +50,11 @@ jobs: if: >- endsWith(env.PYTHON_VERSION, '-beta') || endsWith(env.PYTHON_VERSION, '-dev') + # FIXME: replace `set-env` with a newer alternative + # Refs: + # * github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true run: | from __future__ import print_function python_version = '${{ env.PYTHON_VERSION }}'.replace('-beta', '') @@ -59,6 +64,12 @@ jobs: - name: Set up Python ${{ env.PYTHON_VERSION }} (deadsnakes) uses: deadsnakes/action@v1.0.0 if: fromJSON(env.USE_DEADSNAKES) && true || false + # FIXME: drop once deadsnakes/action gets fixed + # Refs: + # * github.com/deadsnakes/issues/issues/135 + # * github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up Python ${{ env.PYTHON_VERSION }} @@ -99,6 +110,11 @@ jobs: python -m pip freeze --all - name: Adjust TOXENV for PyPy if: startsWith(env.PYTHON_VERSION, 'pypy') + # FIXME: replace `set-env` with a newer alternative + # Refs: + # * github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true run: >- echo "::set-env name=TOXENV::${{ env.PYTHON_VERSION }}" - name: Log env vars From b20d12e1fb7132fada3e6b58ec1c1c0bd409c5f7 Mon Sep 17 00:00:00 2001 From: Harald Korneliussen Date: Wed, 18 Nov 2020 19:32:18 +0100 Subject: [PATCH 024/272] Fixes syntax issues in quickstart (#2448) Quotes in the name and packages field causes an "Invalid distribution name or version syntax" if you follow this quickstart guide directly. pep517.build also requires you to specify the directory. --- docs/userguide/quickstart.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/userguide/quickstart.rst b/docs/userguide/quickstart.rst index 697087edb42..50a984ec9b5 100644 --- a/docs/userguide/quickstart.rst +++ b/docs/userguide/quickstart.rst @@ -43,11 +43,11 @@ such as metadata, contents, dependencies, etc. Here we demonstrate the minimum .. code-block:: ini [metadata] - name = "mypackage" + name = mypackage version = 0.0.1 [options] - packages = "mypackage" + packages = mypackage install_requires = requests importlib; python_version == "2.6" @@ -63,7 +63,7 @@ Then, you need an installer, such as `pep517 ` which you can obtain via ``pip install pep517``. After downloading it, invoke the installer:: - python -m pep517.build + python -m pep517.build . You now have your distribution ready (e.g. a ``tar.gz`` file and a ``.whl`` file in the ``dist`` directory), which you can upload to PyPI! From 4a4d50af47c067eff372fd007123b62c25e5c6dd Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 20 Nov 2020 00:02:20 +0100 Subject: [PATCH 025/272] Fix all deprecated set-env and add-path uses @ GHA --- .github/workflows/python-tests.yml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index b6640181740..9dc4b9d7a83 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -57,19 +57,15 @@ jobs: ACTIONS_ALLOW_UNSECURE_COMMANDS: true run: | from __future__ import print_function + import os python_version = '${{ env.PYTHON_VERSION }}'.replace('-beta', '') - print('::set-env name=PYTHON_VERSION::{ver}'.format(ver=python_version)) - print('::set-env name=USE_DEADSNAKES::true') + with open(os.environ['GITHUB_ENV'], 'a') as env_file: + env_file.write('PYTHON_VERSION={ver}\n'.format(ver=python_version)) + env_file.write('USE_DEADSNAKES=true\n') shell: python - name: Set up Python ${{ env.PYTHON_VERSION }} (deadsnakes) - uses: deadsnakes/action@v1.0.0 + uses: deadsnakes/action@v2.0.1 if: fromJSON(env.USE_DEADSNAKES) && true || false - # FIXME: drop once deadsnakes/action gets fixed - # Refs: - # * github.com/deadsnakes/issues/issues/135 - # * github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true with: python-version: ${{ env.PYTHON_VERSION }} - name: Set up Python ${{ env.PYTHON_VERSION }} @@ -110,13 +106,10 @@ jobs: python -m pip freeze --all - name: Adjust TOXENV for PyPy if: startsWith(env.PYTHON_VERSION, 'pypy') - # FIXME: replace `set-env` with a newer alternative - # Refs: - # * github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true run: >- - echo "::set-env name=TOXENV::${{ env.PYTHON_VERSION }}" + echo "TOXENV=${{ env.PYTHON_VERSION }}" + >> + "${GITHUB_ENV}" - name: Log env vars run: >- env From b4de397a00c6c9ef0551082d532a60badbea7ee9 Mon Sep 17 00:00:00 2001 From: wim glenn Date: Fri, 4 Dec 2020 13:57:21 -0600 Subject: [PATCH 026/272] fix broken link to entry-points details --- docs/pkg_resources.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pkg_resources.rst b/docs/pkg_resources.rst index 364e218328d..c99f0cd13af 100644 --- a/docs/pkg_resources.rst +++ b/docs/pkg_resources.rst @@ -703,7 +703,7 @@ entry point group and look for entry points named "pre_process" and To advertise an entry point, a project needs to use ``setuptools`` and provide an ``entry_points`` argument to ``setup()`` in its setup script, so that the entry points will be included in the distribution's metadata. For more -details, see the [``setuptools`` documentation](https://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins). +details, see `Advertising Behavior _. Each project distribution can advertise at most one entry point of a given name within the same entry point group. For example, a distutils extension From 475fb309a8559556b12a5b37acd03e5d0cf49aa0 Mon Sep 17 00:00:00 2001 From: wim glenn Date: Sat, 5 Dec 2020 12:07:28 -0600 Subject: [PATCH 027/272] Update docs/pkg_resources.rst Co-authored-by: Sviatoslav Sydorenko --- docs/pkg_resources.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/pkg_resources.rst b/docs/pkg_resources.rst index c99f0cd13af..19d43244d1b 100644 --- a/docs/pkg_resources.rst +++ b/docs/pkg_resources.rst @@ -703,7 +703,7 @@ entry point group and look for entry points named "pre_process" and To advertise an entry point, a project needs to use ``setuptools`` and provide an ``entry_points`` argument to ``setup()`` in its setup script, so that the entry points will be included in the distribution's metadata. For more -details, see `Advertising Behavior _. +details, see :ref:`Advertising Behavior`. Each project distribution can advertise at most one entry point of a given name within the same entry point group. For example, a distutils extension @@ -1939,4 +1939,3 @@ History 0.3a1 * Initial release. - From 65441834e019b064bae862d3cfd9971ecbd1c7f8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Dec 2020 12:39:41 -0500 Subject: [PATCH 028/272] Remove conditional skip, no longer relevant. --- setuptools/tests/test_integration.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py index 24cef480ead..23604910506 100644 --- a/setuptools/tests/test_integration.py +++ b/setuptools/tests/test_integration.py @@ -123,8 +123,6 @@ def test_pyuri(install_context): @pytest.mark.parametrize("build_dep", build_deps) -@pytest.mark.skipif( - sys.version_info < (3, 6), reason='run only on late versions') def test_build_deps_on_distutils(request, tmpdir_factory, build_dep): """ All setuptools build dependencies must build without From 99bc2c11d74075ebf0b1dae4cab881225765f404 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Dec 2020 12:54:20 -0500 Subject: [PATCH 029/272] Remove tests guaranteeing that (vendored) dependencies can be installed without setuptools. In a PEP 517 world without distutils, packagers will need to find another way to build and supply the dependencies --- setuptools/tests/test_integration.py | 56 ---------------------------- 1 file changed, 56 deletions(-) diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py index 23604910506..04ba62f7ba7 100644 --- a/setuptools/tests/test_integration.py +++ b/setuptools/tests/test_integration.py @@ -6,11 +6,6 @@ import glob import os import sys -import re -import subprocess -import functools -import tarfile -import zipfile import urllib.request import pytest @@ -117,54 +112,3 @@ def test_pyuri(install_context): # The package data should be installed. assert os.path.exists(os.path.join(pyuri.location, 'pyuri', 'uri.regex')) - - -build_deps = ['appdirs', 'packaging', 'pyparsing', 'six'] - - -@pytest.mark.parametrize("build_dep", build_deps) -def test_build_deps_on_distutils(request, tmpdir_factory, build_dep): - """ - All setuptools build dependencies must build without - setuptools. - """ - if 'pyparsing' in build_dep: - pytest.xfail(reason="Project imports setuptools unconditionally") - build_target = tmpdir_factory.mktemp('source') - build_dir = download_and_extract(request, build_dep, build_target) - install_target = tmpdir_factory.mktemp('target') - output = install(build_dir, install_target) - for line in output.splitlines(): - match = re.search('Unknown distribution option: (.*)', line) - allowed_unknowns = [ - 'test_suite', - 'tests_require', - 'python_requires', - 'install_requires', - 'long_description_content_type', - ] - assert not match or match.group(1).strip('"\'') in allowed_unknowns - - -def install(pkg_dir, install_dir): - with open(os.path.join(pkg_dir, 'setuptools.py'), 'w') as breaker: - breaker.write('raise ImportError()') - cmd = [sys.executable, 'setup.py', 'install', '--prefix', str(install_dir)] - env = dict(os.environ, PYTHONPATH=str(pkg_dir)) - output = subprocess.check_output( - cmd, cwd=pkg_dir, env=env, stderr=subprocess.STDOUT) - return output.decode('utf-8') - - -def download_and_extract(request, req, target): - cmd = [ - sys.executable, '-m', 'pip', 'download', '--no-deps', - '--no-binary', ':all:', req, - ] - output = subprocess.check_output(cmd, encoding='utf-8') - filename = re.search('Saved (.*)', output).group(1) - request.addfinalizer(functools.partial(os.remove, filename)) - opener = zipfile.ZipFile if filename.endswith('.zip') else tarfile.open - with opener(filename) as archive: - archive.extractall(target) - return os.path.join(target, os.listdir(target)[0]) From 2a0463cb489a1b8a222248c65422d908dc4aee18 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Dec 2020 12:55:57 -0500 Subject: [PATCH 030/272] Update changelog. --- changelog.d/2471.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2471.misc.rst diff --git a/changelog.d/2471.misc.rst b/changelog.d/2471.misc.rst new file mode 100644 index 00000000000..5bd42a6d989 --- /dev/null +++ b/changelog.d/2471.misc.rst @@ -0,0 +1 @@ +Removed the tests that guarantee that the vendored dependencies can be built by distutils. From b6bbe236ed0689f50b5148f1172510b975687e62 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Dec 2020 19:32:25 -0500 Subject: [PATCH 031/272] =?UTF-8?q?Bump=20version:=2050.3.2=20=E2=86=92=20?= =?UTF-8?q?51.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 20 ++++++++++++++++++++ changelog.d/2430.doc.1.rst | 2 -- changelog.d/2430.doc.2.rst | 2 -- changelog.d/2435.breaking.rst | 1 - changelog.d/2471.misc.rst | 1 - setup.cfg | 2 +- 7 files changed, 22 insertions(+), 8 deletions(-) delete mode 100644 changelog.d/2430.doc.1.rst delete mode 100644 changelog.d/2430.doc.2.rst delete mode 100644 changelog.d/2435.breaking.rst delete mode 100644 changelog.d/2471.misc.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 97840e4275d..c56d45dc8e7 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 50.3.2 +current_version = 51.0.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 567b2bac768..55133876e9b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,23 @@ +v51.0.0 +------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ +* #2435: Require Python 3.6 or later. + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ +* #2430: Fixed inconsistent RST title nesting levels caused by #2399 + -- by :user:`webknjaz` +* #2430: Fixed a typo in Sphinx docs that made docs dev section disappear + as a result of PR #2426 -- by :user:`webknjaz` + +Misc +^^^^ +* #2471: Removed the tests that guarantee that the vendored dependencies can be built by distutils. + + v50.3.2 ------- diff --git a/changelog.d/2430.doc.1.rst b/changelog.d/2430.doc.1.rst deleted file mode 100644 index d09e0b9e7bb..00000000000 --- a/changelog.d/2430.doc.1.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed a typo in Sphinx docs that made docs dev section disappear -as a result of PR #2426 -- by :user:`webknjaz` diff --git a/changelog.d/2430.doc.2.rst b/changelog.d/2430.doc.2.rst deleted file mode 100644 index 0ac8782323d..00000000000 --- a/changelog.d/2430.doc.2.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed inconsistent RST title nesting levels caused by #2399 --- by :user:`webknjaz` diff --git a/changelog.d/2435.breaking.rst b/changelog.d/2435.breaking.rst deleted file mode 100644 index d29c60eb39b..00000000000 --- a/changelog.d/2435.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Require Python 3.6 or later. diff --git a/changelog.d/2471.misc.rst b/changelog.d/2471.misc.rst deleted file mode 100644 index 5bd42a6d989..00000000000 --- a/changelog.d/2471.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Removed the tests that guarantee that the vendored dependencies can be built by distutils. diff --git a/setup.cfg b/setup.cfg index 0d3fdcf682e..570bd2889b7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ formats = zip [metadata] name = setuptools -version = 50.3.2 +version = 51.0.0 description = Easily download, build, install, upgrade, and uninstall Python packages author = Python Packaging Authority author_email = distutils-sig@python.org From c681f6748acaea1bf0b706528c36327cc94a6eed Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 8 Dec 2020 16:29:09 -0500 Subject: [PATCH 032/272] Collapse skeleton history from archive/2020-12 --- .coveragerc | 5 ++ .flake8 | 9 +++ .github/workflows/main.yml | 42 +++++++++++ .pre-commit-config.yaml | 10 +++ .readthedocs.yml | 6 ++ CHANGES.rst | 0 LICENSE | 19 +++++ README.rst | 18 +++++ docs/conf.py | 26 +++++++ docs/history.rst | 8 +++ docs/index.rst | 22 ++++++ mypy.ini | 2 + pyproject.toml | 22 ++++++ pytest.ini | 9 +++ setup.cfg | 45 ++++++++++++ setup.py | 6 ++ skeleton.md | 144 +++++++++++++++++++++++++++++++++++++ tox.ini | 40 +++++++++++ 18 files changed, 433 insertions(+) create mode 100644 .coveragerc create mode 100644 .flake8 create mode 100644 .github/workflows/main.yml create mode 100644 .pre-commit-config.yaml create mode 100644 .readthedocs.yml create mode 100644 CHANGES.rst create mode 100644 LICENSE create mode 100644 README.rst create mode 100644 docs/conf.py create mode 100644 docs/history.rst create mode 100644 docs/index.rst create mode 100644 mypy.ini create mode 100644 pyproject.toml create mode 100644 pytest.ini create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 skeleton.md create mode 100644 tox.ini diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000000..45823064a3c --- /dev/null +++ b/.coveragerc @@ -0,0 +1,5 @@ +[run] +omit = .tox/* + +[report] +show_missing = True diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000000..790c109fdbe --- /dev/null +++ b/.flake8 @@ -0,0 +1,9 @@ +[flake8] +max-line-length = 88 +ignore = + # W503 violates spec https://github.com/PyCQA/pycodestyle/issues/513 + W503 + # W504 has issues https://github.com/OCA/maintainer-quality-tools/issues/545 + W504 + # Black creates whitespace before colon + E203 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000000..8c5c232c369 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,42 @@ +name: Automated Tests + +on: [push, pull_request] + +jobs: + test: + strategy: + matrix: + python: [3.6, 3.8, 3.9] + platform: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Install tox + run: | + python -m pip install tox + - name: Run tests + run: tox + + release: + needs: test + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install tox + run: | + python -m pip install tox + - name: Release + run: tox -e release + env: + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000000..6639c78c6ca --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: +- repo: https://github.com/psf/black + rev: stable + hooks: + - id: black + +- repo: https://github.com/asottile/blacken-docs + rev: v1.8.0 + hooks: + - id: blacken-docs diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 00000000000..cc698548db4 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,6 @@ +version: 2 +python: + install: + - path: . + extra_requirements: + - docs diff --git a/CHANGES.rst b/CHANGES.rst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000000..353924be0e5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright Jason R. Coombs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/README.rst b/README.rst new file mode 100644 index 00000000000..69554ef8116 --- /dev/null +++ b/README.rst @@ -0,0 +1,18 @@ +.. image:: https://img.shields.io/pypi/v/skeleton.svg + :target: `PyPI link`_ + +.. image:: https://img.shields.io/pypi/pyversions/skeleton.svg + :target: `PyPI link`_ + +.. _PyPI link: https://pypi.org/project/skeleton + +.. image:: https://github.com/jaraco/skeleton/workflows/Automated%20Tests/badge.svg + :target: https://github.com/jaraco/skeleton/actions?query=workflow%3A%22Automated+Tests%22 + :alt: Automated Tests + +.. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://github.com/psf/black + :alt: Code style: Black + +.. .. image:: https://readthedocs.org/projects/skeleton/badge/?version=latest +.. :target: https://skeleton.readthedocs.io/en/latest/?badge=latest diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000000..433d185d4a8 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +extensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker'] + +master_doc = "index" + +link_files = { + '../CHANGES.rst': dict( + using=dict(GH='https://github.com'), + replace=[ + dict( + pattern=r'(Issue #|\B#)(?P\d+)', + url='{package_url}/issues/{issue}', + ), + dict( + pattern=r'(?m:^((?Pv?\d+(\.\d+){1,2}))\n[-=]+\n)', + with_scm='{text}\n{rev[timestamp]:%d %b %Y}\n', + ), + dict( + pattern=r'PEP[- ](?P\d+)', + url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/', + ), + ], + ) +} diff --git a/docs/history.rst b/docs/history.rst new file mode 100644 index 00000000000..8e217503ba1 --- /dev/null +++ b/docs/history.rst @@ -0,0 +1,8 @@ +:tocdepth: 2 + +.. _changes: + +History +******* + +.. include:: ../CHANGES (links).rst diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000000..d14131b0ef3 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,22 @@ +Welcome to skeleton documentation! +======================================== + +.. toctree:: + :maxdepth: 1 + + history + + +.. automodule:: skeleton + :members: + :undoc-members: + :show-inheritance: + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 00000000000..976ba029463 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,2 @@ +[mypy] +ignore_missing_imports = True diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000000..79f088a9565 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[build-system] +requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4.1"] +build-backend = "setuptools.build_meta" + +[tool.black] +skip-string-normalization = true + +[tool.setuptools_scm] + +# jaraco/skeleton#22 +[tool.jaraco.pytest.plugins.black] +addopts = "--black" + +# jaraco/skeleton#22 +[tool.jaraco.pytest.plugins.mypy] +addopts = "--mypy" + +[tool.jaraco.pytest.plugins.flake8] +addopts = "--flake8" + +[tool.jaraco.pytest.plugins.cov] +addopts = "--cov" diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000000..d7f0b115595 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,9 @@ +[pytest] +norecursedirs=dist build .tox .eggs +addopts=--doctest-modules +doctest_optionflags=ALLOW_UNICODE ELLIPSIS +# workaround for warning pytest-dev/pytest#6178 +junit_family=xunit2 +filterwarnings= + # https://github.com/pytest-dev/pytest/issues/6928 + ignore:direct construction of .*Item has been deprecated:DeprecationWarning diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000000..6321ca774ca --- /dev/null +++ b/setup.cfg @@ -0,0 +1,45 @@ +[metadata] +license_file = LICENSE +name = skeleton +author = Jason R. Coombs +author_email = jaraco@jaraco.com +description = skeleton +long_description = file:README.rst +url = https://github.com/jaraco/skeleton +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + +[options] +packages = find: +include_package_data = true +python_requires = >=3.6 +install_requires = +setup_requires = setuptools_scm[toml] >= 3.4.1 + +[options.extras_require] +testing = + # upstream + pytest >= 3.5, !=3.7.3 + pytest-checkdocs >= 1.2.3 + pytest-flake8 + pytest-black >= 0.3.7; python_implementation != "PyPy" + pytest-cov + pytest-mypy; python_implementation != "PyPy" + # jaraco/skeleton#22 + jaraco.test >= 3.2.0 + + # local + +docs = + # upstream + sphinx + jaraco.packaging >= 3.2 + rst.linker >= 1.9 + + # local + +[options.entry_points] diff --git a/setup.py b/setup.py new file mode 100644 index 00000000000..bac24a43d99 --- /dev/null +++ b/setup.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +import setuptools + +if __name__ == "__main__": + setuptools.setup() diff --git a/skeleton.md b/skeleton.md new file mode 100644 index 00000000000..ec421c2598d --- /dev/null +++ b/skeleton.md @@ -0,0 +1,144 @@ +# Overview + +This project is merged with [skeleton](https://github.com/jaraco/skeleton). What is skeleton? It's the scaffolding of a Python project jaraco [introduced in his blog](https://blog.jaraco.com/a-project-skeleton-for-python-projects/). It seeks to provide a means to re-use techniques and inherit advances when managing projects for distribution. + +## An SCM-Managed Approach + +While maintaining dozens of projects in PyPI, jaraco derives best practices for project distribution and publishes them in the [skeleton repo](https://github.com/jaraco/skeleton), a Git repo capturing the evolution and culmination of these best practices. + +It's intended to be used by a new or existing project to adopt these practices and honed and proven techniques. Adopters are encouraged to use the project directly and maintain a small deviation from the technique, make their own fork for more substantial changes unique to their environment or preferences, or simply adopt the skeleton once and abandon it thereafter. + +The primary advantage to using an SCM for maintaining these techniques is that those tools help facilitate the merge between the template and its adopting projects. + +Another advantage to using an SCM-managed approach is that tools like GitHub recognize that a change in the skeleton is the _same change_ across all projects that merge with that skeleton. Without the ancestry, with a traditional copy/paste approach, a [commit like this](https://github.com/jaraco/skeleton/commit/12eed1326e1bc26ce256e7b3f8cd8d3a5beab2d5) would produce notifications in the upstream project issue for each and every application, but because it's centralized, GitHub provides just the one notification when the change is added to the skeleton. + +# Usage + +## new projects + +To use skeleton for a new project, simply pull the skeleton into a new project: + +``` +$ git init my-new-project +$ cd my-new-project +$ git pull gh://jaraco/skeleton +``` + +Now customize the project to suit your individual project needs. + +## existing projects + +If you have an existing project, you can still incorporate the skeleton by merging it into the codebase. + +``` +$ git merge skeleton --allow-unrelated-histories +``` + +The `--allow-unrelated-histories` is necessary because the history from the skeleton was previously unrelated to the existing codebase. Resolve any merge conflicts and commit to the master, and now the project is based on the shared skeleton. + +## Updating + +Whenever a change is needed or desired for the general technique for packaging, it can be made in the skeleton project and then merged into each of the derived projects as needed, recommended before each release. As a result, features and best practices for packaging are centrally maintained and readily trickle into a whole suite of packages. This technique lowers the amount of tedious work necessary to create or maintain a project, and coupled with other techniques like continuous integration and deployment, lowers the cost of creating and maintaining refined Python projects to just a few, familiar Git operations. + +For example, here's a session of the [path project](https://pypi.org/project/path) pulling non-conflicting changes from the skeleton: + + + +Thereafter, the target project can make whatever customizations it deems relevant to the scaffolding. The project may even at some point decide that the divergence is too great to merit renewed merging with the original skeleton. This approach applies maximal guidance while creating minimal constraints. + +# Features + +The features/techniques employed by the skeleton include: + +- PEP 517/518-based build relying on Setuptools as the build tool +- Setuptools declarative configuration using setup.cfg +- tox for running tests +- A README.rst as reStructuredText with some popular badges, but with Read the Docs and AppVeyor badges commented out +- A CHANGES.rst file intended for publishing release notes about the project +- Use of [Black](https://black.readthedocs.io/en/stable/) for code formatting (disabled on unsupported Python 3.5 and earlier) +- Integrated type checking through [mypy](https://github.com/python/mypy/). + +## Packaging Conventions + +A pyproject.toml is included to enable PEP 517 and PEP 518 compatibility and declares the requirements necessary to build the project on Setuptools (a minimum version compatible with setup.cfg declarative config). + +The setup.cfg file implements the following features: + +- Assumes universal wheel for release +- Advertises the project's LICENSE file (MIT by default) +- Reads the README.rst file into the long description +- Some common Trove classifiers +- Includes all packages discovered in the repo +- Data files in the package are also included (not just Python files) +- Declares the required Python versions +- Declares install requirements (empty by default) +- Declares setup requirements for legacy environments +- Supplies two 'extras': + - testing: requirements for running tests + - docs: requirements for building docs + - these extras split the declaration into "upstream" (requirements as declared by the skeleton) and "local" (those specific to the local project); these markers help avoid merge conflicts +- Placeholder for defining entry points + +Additionally, the setup.py file declares `use_scm_version` which relies on [setuptools_scm](https://pypi.org/project/setuptools_scm) to do two things: + +- derive the project version from SCM tags +- ensure that all files committed to the repo are automatically included in releases + +## Running Tests + +The skeleton assumes the developer has [tox](https://pypi.org/project/tox) installed. The developer is expected to run `tox` to run tests on the current Python version using [pytest](https://pypi.org/project/pytest). + +Other environments (invoked with `tox -e {name}`) supplied include: + + - a `docs` environment to build the documentation + - a `release` environment to publish the package to PyPI + +A pytest.ini is included to define common options around running tests. In particular: + +- rely on default test discovery in the current directory +- avoid recursing into common directories not containing tests +- run doctests on modules and invoke Flake8 tests +- in doctests, allow Unicode literals and regular literals to match, allowing for doctests to run on Python 2 and 3. Also enable ELLIPSES, a default that would be undone by supplying the prior option. +- filters out known warnings caused by libraries/functionality included by the skeleton + +Relies on a .flake8 file to correct some default behaviors: + +- disable mutually incompatible rules W503 and W504 +- support for Black format + +## Continuous Integration + +The project is pre-configured to run Continuous Integration tests. + +### Github Actions + +[Github Actions](https://docs.github.com/en/free-pro-team@latest/actions) are the preferred provider as they provide free, fast, multi-platform services with straightforward configuration. Configured in `.github/workflows`. + +Features include: +- test against multiple Python versions +- run on late (and updated) platform versions +- automated releases of tagged commits + +### Continuous Deployments + +In addition to running tests, an additional publish stage is configured to automatically release tagged commits to PyPI using [API tokens](https://pypi.org/help/#apitoken). The release process expects an authorized token to be configured with each Github project (or org) `PYPI_TOKEN` [secret](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets). Example: + +``` +pip-run -q jaraco.develop -- -m jaraco.develop.add-github-secrets +``` + +## Building Documentation + +Documentation is automatically built by [Read the Docs](https://readthedocs.org) when the project is registered with it, by way of the .readthedocs.yml file. To test the docs build manually, a tox env may be invoked as `tox -e docs`. Both techniques rely on the dependencies declared in `setup.cfg/options.extras_require.docs`. + +In addition to building the Sphinx docs scaffolded in `docs/`, the docs build a `history.html` file that first injects release dates and hyperlinks into the CHANGES.rst before incorporating it as history in the docs. + +## Cutting releases + +By default, tagged commits are released through the continuous integration deploy stage. + +Releases may also be cut manually by invoking the tox environment `release` with the PyPI token set as the TWINE_PASSWORD: + +``` +TWINE_PASSWORD={token} tox -e release +``` diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000000..7233b942320 --- /dev/null +++ b/tox.ini @@ -0,0 +1,40 @@ +[tox] +envlist = python +minversion = 3.2 +# https://github.com/jaraco/skeleton/issues/6 +tox_pip_extensions_ext_venv_update = true +toxworkdir={env:TOX_WORK_DIR:.tox} + + +[testenv] +deps = +commands = + pytest {posargs} +usedevelop = True +extras = testing + +[testenv:docs] +extras = + docs + testing +changedir = docs +commands = + python -m sphinx . {toxinidir}/build/html + +[testenv:release] +skip_install = True +deps = + pep517>=0.5 + twine[keyring]>=1.13 + path + jaraco.develop>=7.1 +passenv = + TWINE_PASSWORD + GITHUB_TOKEN +setenv = + TWINE_USERNAME = {env:TWINE_USERNAME:__token__} +commands = + python -c "import path; path.Path('dist').rmtree_p()" + python -m pep517.build . + python -m twine upload dist/* + python -m jaraco.develop.create-github-release From d00fac7b86abd71664af6a28acd924eff7c79017 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 12 Dec 2020 12:22:45 -0500 Subject: [PATCH 033/272] Include rst files in docs in sdist. Fixes #2477. --- MANIFEST.in | 2 +- changelog.d/2477.misc.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/2477.misc.rst diff --git a/MANIFEST.in b/MANIFEST.in index 128ae280ecd..92bd4f6938c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,7 @@ recursive-include setuptools *.py *.exe *.xml recursive-include tests *.py recursive-include setuptools/tests *.html -recursive-include docs *.py *.txt *.conf *.css *.css_t Makefile indexsidebar.html +recursive-include docs *.py *.txt *.rst *.conf *.css *.css_t Makefile indexsidebar.html recursive-include setuptools/_vendor *.py *.txt recursive-include pkg_resources *.py *.txt recursive-include pkg_resources/tests/data * diff --git a/changelog.d/2477.misc.rst b/changelog.d/2477.misc.rst new file mode 100644 index 00000000000..48900e9da29 --- /dev/null +++ b/changelog.d/2477.misc.rst @@ -0,0 +1 @@ +Restore inclusion of rst files in sdist. From d97cb2b35ec9afe2839a48587a456d81b0055a60 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 12 Dec 2020 12:34:36 -0500 Subject: [PATCH 034/272] Update changelog. Ref #2484. --- changelog.d/2484.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2484.misc.rst diff --git a/changelog.d/2484.misc.rst b/changelog.d/2484.misc.rst new file mode 100644 index 00000000000..8f93b3d0ed6 --- /dev/null +++ b/changelog.d/2484.misc.rst @@ -0,0 +1 @@ +Setuptools has replaced the master branch with the main branch. From 1603dcbaae3bbee4fa90e34828146e348c661401 Mon Sep 17 00:00:00 2001 From: Chih-Hsuan Yen Date: Fri, 11 Dec 2020 04:34:59 +0800 Subject: [PATCH 035/272] Fix test_test_command_install_requirements with pip 20.3+ setuptools appends --find-links to pip if dependency_links is found, and both takes URLs [1][2]. [1] https://github.com/pypa/setuptools/blob/v51.0.0/docs/userguide/dependency_management.rst#dependencies-that-arent-in-pypi [2] https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-f --- changelog.d/2478.misc.2.rst | 2 ++ setuptools/tests/test_virtualenv.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelog.d/2478.misc.2.rst diff --git a/changelog.d/2478.misc.2.rst b/changelog.d/2478.misc.2.rst new file mode 100644 index 00000000000..27c07b11526 --- /dev/null +++ b/changelog.d/2478.misc.2.rst @@ -0,0 +1,2 @@ +Fix tests with pip 20.3+ +-- by :user:`yan12125` diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index c8ed9e57ea7..e7b100fba4f 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -2,6 +2,8 @@ import os import sys +import pathlib + import pytest from pytest import yield_fixture from pytest_fixture_config import yield_requires_config @@ -124,7 +126,7 @@ def sdist(distname, version): make_nspkg_sdist(str(dist_path), distname, version) return dist_path dependency_links = [ - str(dist_path) + pathlib.Path(str(dist_path)).as_uri() for dist_path in ( sdist('foobar', '2.4'), sdist('bits', '4.2'), From d368be2b5be8676ba8a3d55045b45b55090f6982 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 12 Dec 2020 13:36:37 -0500 Subject: [PATCH 036/272] Move changelog to new issue. Fixes #2485. --- changelog.d/2478.misc.2.rst | 2 -- changelog.d/2485.misc.rst | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 changelog.d/2478.misc.2.rst create mode 100644 changelog.d/2485.misc.rst diff --git a/changelog.d/2478.misc.2.rst b/changelog.d/2478.misc.2.rst deleted file mode 100644 index 27c07b11526..00000000000 --- a/changelog.d/2478.misc.2.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix tests with pip 20.3+ --- by :user:`yan12125` diff --git a/changelog.d/2485.misc.rst b/changelog.d/2485.misc.rst new file mode 100644 index 00000000000..0a28fd931e4 --- /dev/null +++ b/changelog.d/2485.misc.rst @@ -0,0 +1,2 @@ +Fixed failing test when pip 20.3+ is present. +-- by :user:`yan12125` From 3f7a90f597ff52d05abae1b07ba65fd6b5c80c85 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 12 Dec 2020 14:10:51 -0500 Subject: [PATCH 037/272] Update changelog. --- changelog.d/2486.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2486.change.rst diff --git a/changelog.d/2486.change.rst b/changelog.d/2486.change.rst new file mode 100644 index 00000000000..f4f783e200e --- /dev/null +++ b/changelog.d/2486.change.rst @@ -0,0 +1 @@ +Project adopts jaraco/skeleton for shared package maintenance. From 2667241f44fed464948cbd140bed1b17cfe4e826 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 12 Dec 2020 23:29:03 -0500 Subject: [PATCH 038/272] Update skeleton description to describe the periodic collapse. Fixes #27. --- skeleton.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/skeleton.md b/skeleton.md index ec421c2598d..dd8ec014cdb 100644 --- a/skeleton.md +++ b/skeleton.md @@ -46,6 +46,26 @@ For example, here's a session of the [path project](https://pypi.org/project/pat Thereafter, the target project can make whatever customizations it deems relevant to the scaffolding. The project may even at some point decide that the divergence is too great to merit renewed merging with the original skeleton. This approach applies maximal guidance while creating minimal constraints. +## Periodic Collapse + +In late 2020, this project [introduced](https://github.com/jaraco/skeleton/issues/27) the idea of a periodic but infrequent (O(years)) collapse of commits to limit the number of commits a new consumer will need to accept to adopt the skeleton. + +The full history of commits is collapsed into a single commit and that commit becomes the new mainline head. + +When one of these collapse operations happens, any project that previously pulled from the skeleton will no longer have a related history with that new main branch. For those projects, the skeleton provides a "handoff" branch that reconciles the two branches. Any project that has previously merged with the skeleton but now gets an error "fatal: refusing to merge unrelated histories" should instead use the handoff branch once to incorporate the new main branch. + +``` +$ git pull https://github.com/jaraco/skeleton 2020-handoff +``` + +This handoff needs to be pulled just once and thereafter the project can pull from the main head. + +The archive and handoff branches from prior collapses are indicate here: + +| refresh | archive | handoff | +|---------|-----------------|--------------| +| 2020-12 | archive/2020-12 | 2020-handoff | + # Features The features/techniques employed by the skeleton include: From 701eee9e53dcbfe200bef46420da420052699e68 Mon Sep 17 00:00:00 2001 From: Chih-Hsuan Yen Date: Sun, 13 Dec 2020 18:01:50 +0800 Subject: [PATCH 039/272] Fix tests with pytest 6.2 The latest pytest deprecates pytest.yield_fixture in favor of pytest.fixture [1]. The changelog [2] says that both are the same. [1] https://github.com/pytest-dev/pytest/pull/7988 [2] https://docs.pytest.org/en/stable/changelog.html#pytest-6-2-0-2020-12-12 --- changelog.d/2487.misc.rst | 2 ++ pkg_resources/tests/test_resources.py | 4 ++-- setuptools/tests/fixtures.py | 4 ++-- setuptools/tests/test_develop.py | 4 ++-- setuptools/tests/test_easy_install.py | 6 +++--- setuptools/tests/test_egg_info.py | 2 +- setuptools/tests/test_msvc.py | 6 +++--- setuptools/tests/test_virtualenv.py | 3 +-- 8 files changed, 16 insertions(+), 15 deletions(-) create mode 100644 changelog.d/2487.misc.rst diff --git a/changelog.d/2487.misc.rst b/changelog.d/2487.misc.rst new file mode 100644 index 00000000000..003f6efbdfa --- /dev/null +++ b/changelog.d/2487.misc.rst @@ -0,0 +1,2 @@ + Fix tests with pytest 6.2 +-- by :user:`yan12125` diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py index b08bb293ef0..965a7c00897 100644 --- a/pkg_resources/tests/test_resources.py +++ b/pkg_resources/tests/test_resources.py @@ -773,7 +773,7 @@ class TestNamespaces: ns_str = "__import__('pkg_resources').declare_namespace(__name__)\n" - @pytest.yield_fixture + @pytest.fixture def symlinked_tmpdir(self, tmpdir): """ Where available, return the tempdir as a symlink, @@ -791,7 +791,7 @@ def symlinked_tmpdir(self, tmpdir): finally: os.unlink(link_name) - @pytest.yield_fixture(autouse=True) + @pytest.fixture(autouse=True) def patched_path(self, tmpdir): """ Patch sys.path to include the 'site-pkgs' dir. Also diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py index 5204c8d1266..e8cb7f52376 100644 --- a/setuptools/tests/fixtures.py +++ b/setuptools/tests/fixtures.py @@ -3,7 +3,7 @@ from . import contexts -@pytest.yield_fixture +@pytest.fixture def user_override(monkeypatch): """ Override site.USER_BASE and site.USER_SITE with temporary directories in @@ -17,7 +17,7 @@ def user_override(monkeypatch): yield -@pytest.yield_fixture +@pytest.fixture def tmpdir_cwd(tmpdir): with tmpdir.as_cwd() as orig: yield orig diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index 9854420e6b3..2766da2f79e 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -31,7 +31,7 @@ """ -@pytest.yield_fixture +@pytest.fixture def temp_user(monkeypatch): with contexts.tempdir() as user_base: with contexts.tempdir() as user_site: @@ -40,7 +40,7 @@ def temp_user(monkeypatch): yield -@pytest.yield_fixture +@pytest.fixture def test_env(tmpdir, temp_user): target = tmpdir foo = target.mkdir('foo') diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 26a5e9a6ba8..dc00e697de6 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -305,7 +305,7 @@ def test_add_from_site_is_ignored(self): assert not pth.dirty -@pytest.yield_fixture +@pytest.fixture def setup_context(tmpdir): with (tmpdir / 'setup.py').open('w') as f: f.write(SETUP_PY) @@ -361,7 +361,7 @@ def foo_package(self, tmpdir): f.write('Name: foo\n') return str(tmpdir) - @pytest.yield_fixture() + @pytest.fixture() def install_target(self, tmpdir): target = str(tmpdir) with mock.patch('sys.path', sys.path + [target]): @@ -406,7 +406,7 @@ def patched_setup_context(self): ) -@pytest.yield_fixture +@pytest.fixture def distutils_package(): distutils_setup_py = SETUP_PY.replace( 'from setuptools import setup', diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index dc472af4c86..1047468b185 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -45,7 +45,7 @@ def run(): """) }) - @pytest.yield_fixture + @pytest.fixture def env(self): with contexts.tempdir(prefix='setuptools-test.') as env_dir: env = Environment(env_dir) diff --git a/setuptools/tests/test_msvc.py b/setuptools/tests/test_msvc.py index 24e38ea8800..d1527bfa46d 100644 --- a/setuptools/tests/test_msvc.py +++ b/setuptools/tests/test_msvc.py @@ -88,7 +88,7 @@ def test_no_registry_entries_means_nothing_found(self): assert isinstance(exc, expected) assert 'aka.ms/vcpython27' in str(exc) - @pytest.yield_fixture + @pytest.fixture def user_preferred_setting(self): """ Set up environment with different install dirs for user vs. system @@ -116,7 +116,7 @@ def test_prefer_current_user(self, user_preferred_setting): expected = os.path.join(user_preferred_setting, 'vcvarsall.bat') assert expected == result - @pytest.yield_fixture + @pytest.fixture def local_machine_setting(self): """ Set up environment with only the system environment configured. @@ -138,7 +138,7 @@ def test_local_machine_recognized(self, local_machine_setting): expected = os.path.join(local_machine_setting, 'vcvarsall.bat') assert expected == result - @pytest.yield_fixture + @pytest.fixture def x64_preferred_setting(self): """ Set up environment with 64-bit and 32-bit system settings configured diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index e7b100fba4f..21dea5bb871 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -5,7 +5,6 @@ import pathlib import pytest -from pytest import yield_fixture from pytest_fixture_config import yield_requires_config import pytest_virtualenv @@ -29,7 +28,7 @@ def pytest_virtualenv_works(virtualenv): @yield_requires_config(pytest_virtualenv.CONFIG, ['virtualenv_executable']) -@yield_fixture(scope='function') +@pytest.fixture(scope='function') def bare_virtualenv(): """ Bare virtualenv (no pip/setuptools/wheel). """ From 150321caba0dc73489b61d6b5bbfbed52b795ae7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 13 Dec 2020 14:03:23 -0500 Subject: [PATCH 040/272] Enable automerge --- .github/workflows/automerge.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/automerge.yml diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 00000000000..4f70acfbcbb --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,27 @@ +name: automerge +on: + pull_request: + types: + - labeled + - unlabeled + - synchronize + - opened + - edited + - ready_for_review + - reopened + - unlocked + pull_request_review: + types: + - submitted + check_suite: + types: + - completed + status: {} +jobs: + automerge: + runs-on: ubuntu-latest + steps: + - name: automerge + uses: "pascalgn/automerge-action@v0.12.0" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From 9008e48a54bde1cbbabaf4423906630a4edab877 Mon Sep 17 00:00:00 2001 From: Matt Deitke Date: Sun, 13 Dec 2020 20:42:20 -0800 Subject: [PATCH 041/272] typo --- docs/userguide/quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userguide/quickstart.rst b/docs/userguide/quickstart.rst index 30989826fb9..1d557d47bd6 100644 --- a/docs/userguide/quickstart.rst +++ b/docs/userguide/quickstart.rst @@ -71,7 +71,7 @@ file in the ``dist`` directory), which you can upload to PyPI! Of course, before you release your project to PyPI, you'll want to add a bit more information to your setup script to help people find or learn about your project. And maybe your project will have grown by then to include a few -dependencies, and perhaps some data files and scripts. In the next few section, +dependencies, and perhaps some data files and scripts. In the next few sections, we will walk through those additional but essential information you need to specify to properly package your project. From a283c8776ef8ee56c5088a93a55c77509bc399c6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 20 Dec 2020 13:09:01 -0500 Subject: [PATCH 042/272] Restore fail on warning in docs builds. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 8b628f6545b..54ea6850b8e 100644 --- a/tox.ini +++ b/tox.ini @@ -38,7 +38,7 @@ extras = testing changedir = docs commands = - python -m sphinx . {toxinidir}/build/html + python -m sphinx -W . {toxinidir}/build/html [testenv:finalize] skip_install = True From c769f4d850a0697833216fa7daef7bf0f0519b8f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 20 Dec 2020 13:52:52 -0500 Subject: [PATCH 043/272] Remove redundant dependencies --- setup.cfg | 5 ----- 1 file changed, 5 deletions(-) diff --git a/setup.cfg b/setup.cfg index edcbb03f452..f3f53f6c982 100644 --- a/setup.cfg +++ b/setup.cfg @@ -45,18 +45,13 @@ testing = # local mock - pytest-flake8 flake8-2020 virtualenv>=13.0.0 pytest-virtualenv>=1.2.7 - pytest>=3.7 wheel - coverage>=4.5.1 - pytest-cov>=2.5.1 paver pip>=19.1 # For proper file:// URLs support. jaraco.envs - jaraco.test >= 3.1.1; python_version >= "3.6" docs = # Keep these in sync with docs/requirements.txt From 176622446978b4d8f69cffd81c734753fc094616 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 20 Dec 2020 13:53:59 -0500 Subject: [PATCH 044/272] Add PyPy3 to list of Pythons tested --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8c5c232c369..0e2a8fa8e7c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ jobs: test: strategy: matrix: - python: [3.6, 3.8, 3.9] + python: [3.6, 3.8, 3.9, pypy3] platform: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.platform }} steps: From e52ace421bdf5bf9b236c05af924501e061a7f3c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 20 Dec 2020 14:18:05 -0500 Subject: [PATCH 045/272] Ensure windir is passed in environment. --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 54ea6850b8e..d58164cc683 100644 --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,8 @@ install_command = {[helpers]pip} install {opts} {packages} list_dependencies_command = {[helpers]pip} freeze --all setenv = COVERAGE_FILE={toxworkdir}/.coverage.{envname} +passenv = + windir # required for test_pkg_resources [testenv:coverage] description=Combine coverage data and create report From cabb200e590955eee70b67787eaa5597d4d0ff19 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 20 Dec 2020 14:54:14 -0500 Subject: [PATCH 046/272] =?UTF-8?q?Bump=20version:=2051.0.0=20=E2=86=92=20?= =?UTF-8?q?51.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 18 ++++++++++++++++++ changelog.d/2477.misc.rst | 1 - changelog.d/2484.misc.rst | 1 - changelog.d/2485.misc.rst | 2 -- changelog.d/2486.change.rst | 1 - changelog.d/2487.misc.rst | 2 -- setup.cfg | 2 +- 8 files changed, 20 insertions(+), 9 deletions(-) delete mode 100644 changelog.d/2477.misc.rst delete mode 100644 changelog.d/2484.misc.rst delete mode 100644 changelog.d/2485.misc.rst delete mode 100644 changelog.d/2486.change.rst delete mode 100644 changelog.d/2487.misc.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index c56d45dc8e7..d156dedb0f1 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 51.0.0 +current_version = 51.1.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 55133876e9b..fb5725cc3ff 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,21 @@ +v51.1.0 +------- + + +Changes +^^^^^^^ +* #2486: Project adopts jaraco/skeleton for shared package maintenance. + +Misc +^^^^ +* #2477: Restore inclusion of rst files in sdist. +* #2484: Setuptools has replaced the master branch with the main branch. +* #2485: Fixed failing test when pip 20.3+ is present. + -- by :user:`yan12125` +* #2487: Fix tests with pytest 6.2 + -- by :user:`yan12125` + + v51.0.0 ------- diff --git a/changelog.d/2477.misc.rst b/changelog.d/2477.misc.rst deleted file mode 100644 index 48900e9da29..00000000000 --- a/changelog.d/2477.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Restore inclusion of rst files in sdist. diff --git a/changelog.d/2484.misc.rst b/changelog.d/2484.misc.rst deleted file mode 100644 index 8f93b3d0ed6..00000000000 --- a/changelog.d/2484.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Setuptools has replaced the master branch with the main branch. diff --git a/changelog.d/2485.misc.rst b/changelog.d/2485.misc.rst deleted file mode 100644 index 0a28fd931e4..00000000000 --- a/changelog.d/2485.misc.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed failing test when pip 20.3+ is present. --- by :user:`yan12125` diff --git a/changelog.d/2486.change.rst b/changelog.d/2486.change.rst deleted file mode 100644 index f4f783e200e..00000000000 --- a/changelog.d/2486.change.rst +++ /dev/null @@ -1 +0,0 @@ -Project adopts jaraco/skeleton for shared package maintenance. diff --git a/changelog.d/2487.misc.rst b/changelog.d/2487.misc.rst deleted file mode 100644 index 003f6efbdfa..00000000000 --- a/changelog.d/2487.misc.rst +++ /dev/null @@ -1,2 +0,0 @@ - Fix tests with pytest 6.2 --- by :user:`yan12125` diff --git a/setup.cfg b/setup.cfg index f3f53f6c982..6ef70e26609 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] license_file = LICENSE name = setuptools -version = 51.0.0 +version = 51.1.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 8a99cc4660582b651d91421d4f47cb988a355741 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 20 Dec 2020 20:42:36 -0500 Subject: [PATCH 047/272] Disable integration tests on PyPy on Windows. Ref #2496. --- setuptools/tests/test_integration.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py index 04ba62f7ba7..b557831216f 100644 --- a/setuptools/tests/test_integration.py +++ b/setuptools/tests/test_integration.py @@ -15,6 +15,13 @@ from setuptools.dist import Distribution +pytestmark = pytest.mark.skipif( + 'platform.python_implementation() == "PyPy" and ' + 'platform.system() == "Windows"', + reason="pypa/setuptools#2496", +) + + def setup_module(module): packages = 'stevedore', 'virtualenvwrapper', 'pbr', 'novaclient' for pkg in packages: From 9e3806e5a557d3041dacb34801aed3e4a1dc654e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 20 Dec 2020 23:26:07 -0500 Subject: [PATCH 048/272] Fix syntax in test_build_meta, version should not have quotes. Bug was masked by LegacyVersion parsing. --- setuptools/tests/test_build_meta.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 5462b26a8a6..6d3a997ee06 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -108,7 +108,7 @@ def run(): 'setup.cfg': DALS(""" [metadata] name = foo - version='0.0.0' + version = 0.0.0 [options] py_modules=hello From d503f75e0535edb644a53fd77b4bc85a97fb4add Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 20 Dec 2020 23:37:47 -0500 Subject: [PATCH 049/272] Fix badge for GHA --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 2273dcd897a..526d1222da9 100644 --- a/README.rst +++ b/README.rst @@ -6,8 +6,8 @@ .. _PyPI link: https://pypi.org/project/setuptools -.. image:: https://github.com/jaraco/setuptools/workflows/Automated%20Tests/badge.svg - :target: https://github.com/jaraco/setuptools/actions?query=workflow%3A%22Automated+Tests%22 +.. image:: https://github.com/pypa/setuptools/workflows/Automated%20Tests/badge.svg + :target: https://github.com/pypa/setuptools/actions?query=workflow%3A%22Automated+Tests%22 :alt: Automated Tests .. image:: https://img.shields.io/badge/code%20style-black-000000.svg From dfd155218751787fecd2bb3a11fef6e510ed8ec3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 21 Dec 2020 11:25:18 -0500 Subject: [PATCH 050/272] Unset tag_build and tag_date prior to cutting a release. Fixes #2500. --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 517dd4d9064..9680ec01008 100644 --- a/tox.ini +++ b/tox.ini @@ -68,6 +68,8 @@ setenv = commands = python -m bootstrap python -c "import path; path.Path('dist').rmtree_p()" + # unset tag_build and tag_date pypa/setuptools#2500 + python setup.py egg_info -Db "" saveopts python -m pep517.build . python -m twine upload dist/* python -m jaraco.develop.create-github-release From ac2311014ab27409f1ca109101131fd7383cdc32 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 21 Dec 2020 12:20:02 -0500 Subject: [PATCH 051/272] Include tmpl files in manifest template. Workaround for #2498. Tests once again pass on an extract of the sdist. --- MANIFEST.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 92bd4f6938c..eba40c5de68 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,10 +1,12 @@ -recursive-include setuptools *.py *.exe *.xml +recursive-include setuptools *.py *.exe *.xml *.tmpl recursive-include tests *.py recursive-include setuptools/tests *.html recursive-include docs *.py *.txt *.rst *.conf *.css *.css_t Makefile indexsidebar.html recursive-include setuptools/_vendor *.py *.txt recursive-include pkg_resources *.py *.txt recursive-include pkg_resources/tests/data * +recursive-include tools * +recursive-include changelog.d * include *.py include *.rst include MANIFEST.in From 44d45ae20a663f1cb75812657cee1244e3dddb58 Mon Sep 17 00:00:00 2001 From: Tim Hatch Date: Mon, 14 Dec 2020 09:37:47 -0800 Subject: [PATCH 052/272] Failing test for #2489 --- .../data/my-test-package-zip/my-test-package.zip | Bin 0 -> 1809 bytes pkg_resources/tests/test_find_distributions.py | 9 +++++++++ 2 files changed, 9 insertions(+) create mode 100644 pkg_resources/tests/data/my-test-package-zip/my-test-package.zip diff --git a/pkg_resources/tests/data/my-test-package-zip/my-test-package.zip b/pkg_resources/tests/data/my-test-package-zip/my-test-package.zip new file mode 100644 index 0000000000000000000000000000000000000000..81f9a0170f7aca13a0d1d8e5201c2c186554ce7e GIT binary patch literal 1809 zcmWIWW@h1H0D)azeSu&Gl#pbQVaTnFFG(#fi7!Y@&Q45E)k{rJ*UijJ%hwML;bdUe zpMO0bgi9;985mh!GBYrMi2%5fTY*MSX1i|02s9Fe)$kcvl3x&?lUkOVqgPT<0ybX_ zXf_C=na_pW0$qF-q@)(4=B1?OC0EAhWaecTQ(%uGK6|P%3v`PU(^3igK?E2i91Ng9 z>Qt-#nFi!t0AdwCnp#)4OE7jTz7~^SAlTG(bAA8AyDPR;f4!dkX8HNea$EmA zwK}WtMDnKS#3`EQP;!goS%>XQ>Q?o zm|3%DM}%Z96?pah?Q{8e$DdA|KbtFL*1Rr(A|2h6C-j}3zh3rCE$x|tORdr5;LlwX zx9nUZrY@c;Hl^Wh6DQjfm1#?!ia%9yVL&9U4{oU0ffE=l#i=Ew1$xP8>0qa`%*2{J z5upMy;`CJ|oe*G%WB@S-+=zloxC!NRF%tOcGrA}AwE{K#bTxG~PM$xn`OL}S>j58L zJywMipb!W>g&G2(ml#h^T`DG;{_OcpEy-7s4y~(|Jj5D;Ma>j94s5Nm*O1WXqEz}f>TdjX9DWiPC$3=%$=nG4y~L2% Date: Mon, 14 Dec 2020 09:14:45 -0800 Subject: [PATCH 053/272] Find .egg-info in zipimport too Fixes #2489 --- changelog.d/2489.change.rst | 2 ++ pkg_resources/__init__.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/2489.change.rst diff --git a/changelog.d/2489.change.rst b/changelog.d/2489.change.rst new file mode 100644 index 00000000000..40eddbe7349 --- /dev/null +++ b/changelog.d/2489.change.rst @@ -0,0 +1,2 @@ +``pkg_resources`` behavior for zipimport now matches the regular behavior, and finds +``.egg-info`` (previoulsy would only find ``.dist-info``) -- by :user:`thatch` diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 737f4d5fad1..ba90c8c4abf 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -1978,12 +1978,13 @@ def find_eggs_in_zip(importer, path_item, only=False): # don't yield nested distros return for subitem in metadata.resource_listdir(''): + lower = subitem.lower() if _is_egg_path(subitem): subpath = os.path.join(path_item, subitem) dists = find_eggs_in_zip(zipimport.zipimporter(subpath), subpath) for dist in dists: yield dist - elif subitem.lower().endswith('.dist-info'): + elif any(map(lower.endswith, ('.dist-info', '.egg-info'))): subpath = os.path.join(path_item, subitem) submeta = EggMetadata(zipimport.zipimporter(subpath)) submeta.egg_info = subpath From 66ca25303126c88b2eb82b21e77a6146ccfd3de9 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 22 Dec 2020 14:24:22 -0500 Subject: [PATCH 054/272] docs: recommend pypa build --- docs/build_meta.rst | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/docs/build_meta.rst b/docs/build_meta.rst index c36e2bab38f..9744488e993 100644 --- a/docs/build_meta.rst +++ b/docs/build_meta.rst @@ -67,14 +67,11 @@ specify the package information:: [options] packages = find: -Now generate the distribution. Although the PyPA is still working to -`provide a recommended tool `_ -to build packages, the `pep517 package `_ -provides this functionality. To build the package:: - - $ pip install -q pep517 - $ mkdir dist - $ python -m pep517.build . +Now generate the distribution. To build the package, use +`PyPA build `_:: + + $ pip install -q build + $ python -m build And now it's done! The ``.whl`` file and ``.tar.gz`` can then be distributed and installed:: From 13d7bcb994097895ed7f6c6af419e3a037fe90a7 Mon Sep 17 00:00:00 2001 From: Daniel Moore Date: Wed, 23 Dec 2020 14:39:27 -0800 Subject: [PATCH 055/272] Clarify Development Mode first paragraph --- docs/userguide/development_mode.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/userguide/development_mode.rst b/docs/userguide/development_mode.rst index bce724a79ff..3c477ec114f 100644 --- a/docs/userguide/development_mode.rst +++ b/docs/userguide/development_mode.rst @@ -3,9 +3,9 @@ Under normal circumstances, the ``distutils`` assume that you are going to build a distribution of your project, not use it in its "raw" or "unbuilt" -form. If you were to use the ``distutils`` that way, you would have to rebuild -and reinstall your project every time you made a change to it during -development. +form. However, if you were to use the ``distutils`` to build a distribution, +you would have to rebuild and reinstall your project every time you made a +change to it during development. Another problem that sometimes comes up with the ``distutils`` is that you may need to do development on two related projects at the same time. You may need From e83dc66104e2a5ad8e5a8db3079d24628b1fa6d7 Mon Sep 17 00:00:00 2001 From: Drew Date: Fri, 25 Dec 2020 15:52:54 -0500 Subject: [PATCH 056/272] docs (build_meta): fix spelling mistake --- docs/build_meta.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build_meta.rst b/docs/build_meta.rst index 9744488e993..2ad5ae267e6 100644 --- a/docs/build_meta.rst +++ b/docs/build_meta.rst @@ -7,7 +7,7 @@ What is it? Python packaging has come `a long way `_. -The traditional ``setuptools`` way of packgaging Python modules +The traditional ``setuptools`` way of packaging Python modules uses a ``setup()`` function within the ``setup.py`` script. Commands such as ``python setup.py bdist`` or ``python setup.py bdist_wheel`` generate a distribution bundle and ``python setup.py install`` installs the distribution. From c0c9cfde2eb7ad0573bf68ddb34944833aeb1d3c Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Mon, 21 Dec 2020 20:32:49 +0100 Subject: [PATCH 057/272] Migrate to `extend-exclude` in flake8 config This makes sure that flake8's defaults are in use. Specifically, it excludes `.tox/` dir that is known to contain a lot of files in nested folders that are not supposed to be linted. Refs: * https://github.com/pypa/setuptools/issues/2501#issuecomment-749144396 * https://github.com/pypa/setuptools/pull/2486/files#r546877674 * https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-extend-exclude * https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-exclude --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index 8bc2d27060d..13381d6a5d0 100644 --- a/.flake8 +++ b/.flake8 @@ -1,6 +1,6 @@ [flake8] max-line-length = 88 -exclude = +extend-exclude = setuptools/_vendor pkg_resources/_vendor ignore = From 45721e8f5e9cbbdb5f2406cc125cd4855e83fa0a Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Mon, 21 Dec 2020 20:35:35 +0100 Subject: [PATCH 058/272] Exclude `build/lib/` artifacts in flake8 config --- .flake8 | 1 + 1 file changed, 1 insertion(+) diff --git a/.flake8 b/.flake8 index 13381d6a5d0..5e1c7cae929 100644 --- a/.flake8 +++ b/.flake8 @@ -1,6 +1,7 @@ [flake8] max-line-length = 88 extend-exclude = + build/lib setuptools/_vendor pkg_resources/_vendor ignore = From cfb8ae513add75757e9e19d912bb8b8300f05b94 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 26 Dec 2020 22:01:46 +0100 Subject: [PATCH 059/272] Fix misplaced/mistyped per-file-ignores in flake8 Ref: https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-per-file-ignores --- .flake8 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 8bc2d27060d..bd097eec11e 100644 --- a/.flake8 +++ b/.flake8 @@ -10,5 +10,8 @@ ignore = W504 # Black creates whitespace before colon E203 - setuptools/site-patch.py F821 - setuptools/py*compat.py F811 + +# Allow certain violations in certain files: +per-file-ignores = + setuptools/site-patch.py: F821 + setuptools/py*compat.py: F811 From ae51676d767f8ea514a62f050e670ada435ad91d Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 26 Dec 2020 22:04:27 +0100 Subject: [PATCH 060/272] Drop non-existing site-patch.py from flake8 --- .flake8 | 1 - 1 file changed, 1 deletion(-) diff --git a/.flake8 b/.flake8 index bd097eec11e..42d9c477d30 100644 --- a/.flake8 +++ b/.flake8 @@ -13,5 +13,4 @@ ignore = # Allow certain violations in certain files: per-file-ignores = - setuptools/site-patch.py: F821 setuptools/py*compat.py: F811 From 5f4153bfb8c131467a47d05407325bb6b10dd992 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 26 Dec 2020 22:05:03 +0100 Subject: [PATCH 061/272] Drop unmached py*compat.py ignore rule from flake8 --- .flake8 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.flake8 b/.flake8 index 42d9c477d30..2fb438d5ba7 100644 --- a/.flake8 +++ b/.flake8 @@ -10,7 +10,3 @@ ignore = W504 # Black creates whitespace before colon E203 - -# Allow certain violations in certain files: -per-file-ignores = - setuptools/py*compat.py: F811 From 33d09d12cb20412fbe1c490e7c3865202f3b7cf2 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 26 Dec 2020 22:17:52 +0100 Subject: [PATCH 062/272] Use `extend-ignore` in flake8 config This option allows adding extra ignored rules to the default list instead of replacing it. The default exclusions are: E121, E123, E126, E226, E24, E704, W503 and W504. Refs: * https://github.com/pypa/setuptools/pull/2486/files#r541943356 * https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-extend-ignore * https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-ignore * #2501 * https://github.com//skeleton/issues/28 --- .flake8 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.flake8 b/.flake8 index 8bc2d27060d..bfa744bef22 100644 --- a/.flake8 +++ b/.flake8 @@ -3,11 +3,7 @@ max-line-length = 88 exclude = setuptools/_vendor pkg_resources/_vendor -ignore = - # W503 violates spec https://github.com/PyCQA/pycodestyle/issues/513 - W503 - # W504 has issues https://github.com/OCA/maintainer-quality-tools/issues/545 - W504 +extend-ignore = # Black creates whitespace before colon E203 setuptools/site-patch.py F821 From 4665f91bda1541205d9a6675bc81ed6599a608e3 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 26 Dec 2020 23:09:10 +0100 Subject: [PATCH 063/272] Use license_files instead of license_file in meta Singular `license_file` is deprecated since wheel v0.32.0. Refs: * https://wheel.readthedocs.io/en/stable/news.html * https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file --- setup.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 6ef70e26609..32d1f674cfa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,6 @@ [metadata] -license_file = LICENSE +license_files = + LICENSE name = setuptools version = 51.1.0 author = Python Packaging Authority From c657e826e0d4f24a3702763ab25610d48ceea222 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 28 Dec 2020 15:05:45 -0500 Subject: [PATCH 064/272] Replace incorrect statement about triggering installation of dependencies to indicate that the handling is mostly implementation specific. Ref pypa/setuptools#1471. --- docs/userguide/dependency_management.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/userguide/dependency_management.rst b/docs/userguide/dependency_management.rst index 354a9f8c36f..0eb2186494c 100644 --- a/docs/userguide/dependency_management.rst +++ b/docs/userguide/dependency_management.rst @@ -72,7 +72,7 @@ When your project is installed (e.g. using pip), all of the dependencies not already installed will be located (via PyPI), downloaded, built (if necessary), and installed and 2) Any scripts in your project will be installed with wrappers that verify the availability of the specified dependencies at runtime. - + Platform specific dependencies ------------------------------ @@ -202,7 +202,7 @@ Optional dependencies Setuptools allows you to declare dependencies that only get installed under specific circumstances. These dependencies are specified with ``extras_require`` keyword and are only installed if another package depends on it (either -directly or indirectly) This makes it convenient to declare dependencies for +directly or indirectly) This makes it convenient to declare dependencies for ancillary functions such as "tests" and "docs". .. note:: @@ -262,8 +262,12 @@ First is the console_scripts entry point: } ) -When the script ``rst2pdf`` is run, it will trigger the installation of -the two dependencies ``PDF`` maps to. +This syntax indicates that the entry point (in this case a console script) +is only valid when the PDF extra is installed. It is up to the installer +to determine how to handle the situation where PDF was not indicated +(e.g. omit the console script, provide a warning when attempting to load +the entry point, assume the extras are present and let the implementation +fail later). The second use case is that other package can use this "extra" for their own dependencies. For example, if "Project-B" needs "project A" with PDF support From 36233fe32c300e8e6b7c4d3ce53b37f23af24933 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 28 Dec 2020 15:58:41 -0500 Subject: [PATCH 065/272] Update changelog. Ref #1471. --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index fb5725cc3ff..a9945d3cfbc 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -371,6 +371,7 @@ v47.2.0 Changes ^^^^^^^ * #2194: Editable-installed entry points now load significantly faster on Python versions 3.8+. +* #1471: Incidentally fixed by #2194 on Python 3.8 or when importlib_metadata is present. v47.1.1 From 0f699dcd4d3a74aeae19e7c61c150c037bf06213 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 28 Dec 2020 18:01:34 -0500 Subject: [PATCH 066/272] In test_test_command_install_requirements, uninstall setuptools to avoid getting some other version in the environment. --- setuptools/tests/test_virtualenv.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index 21dea5bb871..950c74c5d55 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -179,6 +179,8 @@ def test_test_command_install_requirements(virtualenv, tmpdir): # Ensure pip/wheel packages are installed. virtualenv.run( "python -c \"__import__('pkg_resources').require(['pip', 'wheel'])\"") + # uninstall setuptools so that 'setup.py develop' works + virtualenv.run("python -m pip uninstall -y setuptools") _check_test_command_install_requirements(virtualenv, tmpdir) From bc65372f3e3c73e7e16a3d3faf29dc0984752718 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 28 Dec 2020 21:20:42 -0500 Subject: [PATCH 067/272] Disable index URL in pip-based fetch_build_eggs to avoid hitting PyPI. --- setuptools/tests/test_virtualenv.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index 950c74c5d55..5a942d84c54 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -181,6 +181,8 @@ def test_test_command_install_requirements(virtualenv, tmpdir): "python -c \"__import__('pkg_resources').require(['pip', 'wheel'])\"") # uninstall setuptools so that 'setup.py develop' works virtualenv.run("python -m pip uninstall -y setuptools") + # disable index URL so bits and bobs aren't requested from PyPI + virtualenv.env['PIP_NO_INDEX'] = '1' _check_test_command_install_requirements(virtualenv, tmpdir) From 3d4b6b0b15c6a78397a704194bcd5037d8382c1d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 28 Dec 2020 21:37:48 -0500 Subject: [PATCH 068/272] Update changelog. --- changelog.d/2525.patch.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2525.patch.rst diff --git a/changelog.d/2525.patch.rst b/changelog.d/2525.patch.rst new file mode 100644 index 00000000000..8b590dce279 --- /dev/null +++ b/changelog.d/2525.patch.rst @@ -0,0 +1 @@ +Avoid hitting network during test_virtualenv.test_test_command. From 4bc5bb337b52ff8619e2c0009ab6eb71678fa429 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 28 Dec 2020 21:45:45 -0500 Subject: [PATCH 069/272] Rename changelog --- changelog.d/{2525.patch.rst => 2525.misc.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/{2525.patch.rst => 2525.misc.rst} (100%) diff --git a/changelog.d/2525.patch.rst b/changelog.d/2525.misc.rst similarity index 100% rename from changelog.d/2525.patch.rst rename to changelog.d/2525.misc.rst From 60c341b82f3ddb188823405225ec5cd5b217784c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 28 Dec 2020 21:45:52 -0500 Subject: [PATCH 070/272] =?UTF-8?q?Bump=20version:=2051.1.0=20=E2=86=92=20?= =?UTF-8?q?51.1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 9 +++++++++ changelog.d/2525.misc.rst | 1 - setup.cfg | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/2525.misc.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index d156dedb0f1..60e7352f593 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 51.1.0 +current_version = 51.1.1 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index a9945d3cfbc..ca76648bd21 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v51.1.1 +------- + + +Misc +^^^^ +* #2525: Avoid hitting network during test_virtualenv.test_test_command. + + v51.1.0 ------- diff --git a/changelog.d/2525.misc.rst b/changelog.d/2525.misc.rst deleted file mode 100644 index 8b590dce279..00000000000 --- a/changelog.d/2525.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Avoid hitting network during test_virtualenv.test_test_command. diff --git a/setup.cfg b/setup.cfg index 6ef70e26609..9d41be119ce 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] license_file = LICENSE name = setuptools -version = 51.1.0 +version = 51.1.1 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 4b1334629e1cb254a1b6853f045f2615b79ec9e1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 29 Dec 2020 09:56:52 -0500 Subject: [PATCH 071/272] Automatically inject project name in docs heading. --- docs/index.rst | 4 ++-- setup.cfg | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index d14131b0ef3..325842bb7fa 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,5 @@ -Welcome to skeleton documentation! -======================================== +Welcome to |project| documentation! +=================================== .. toctree:: :maxdepth: 1 diff --git a/setup.cfg b/setup.cfg index 6321ca774ca..4fc095b31d0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -37,7 +37,7 @@ testing = docs = # upstream sphinx - jaraco.packaging >= 3.2 + jaraco.packaging >= 8.2 rst.linker >= 1.9 # local From ad71fbc76951144facc0dbd4fe39715c95915511 Mon Sep 17 00:00:00 2001 From: Jonathan E Date: Tue, 29 Dec 2020 17:19:49 -0800 Subject: [PATCH 072/272] Fix code typo in entry_point.rst In __init__.py the function helloworld() was defined, but everywhere else, hello_world() is called. Rename this function so that it is consistent with the naming in the rest of the file. --- docs/userguide/entry_point.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userguide/entry_point.rst b/docs/userguide/entry_point.rst index edab446502b..738207282cb 100644 --- a/docs/userguide/entry_point.rst +++ b/docs/userguide/entry_point.rst @@ -28,7 +28,7 @@ with ``__init__.py`` as: .. code-block:: python - def helloworld(): + def hello_world(): print("Hello world") and ``__main__.py`` providing a hook: From cfe99a5a7941f9f8785dd3ec12d1df94e9134411 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 29 Dec 2020 21:27:53 -0500 Subject: [PATCH 073/272] pre-commit autoupdate --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6639c78c6ca..c15ab0c9e6a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,10 @@ repos: - repo: https://github.com/psf/black - rev: stable + rev: 20.8b1 hooks: - id: black - repo: https://github.com/asottile/blacken-docs - rev: v1.8.0 + rev: v1.9.1 hooks: - id: blacken-docs From 060d491a9aaacfe457ad365cfd60b611fc9f5bcf Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 30 Dec 2020 10:57:25 -0500 Subject: [PATCH 074/272] Rename 'Automated Tests' to simply 'tests' --- .github/workflows/main.yml | 2 +- README.rst | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8c5c232c369..6a8ff006f41 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Automated Tests +name: tests on: [push, pull_request] diff --git a/README.rst b/README.rst index 69554ef8116..128e61e41ea 100644 --- a/README.rst +++ b/README.rst @@ -6,9 +6,9 @@ .. _PyPI link: https://pypi.org/project/skeleton -.. image:: https://github.com/jaraco/skeleton/workflows/Automated%20Tests/badge.svg - :target: https://github.com/jaraco/skeleton/actions?query=workflow%3A%22Automated+Tests%22 - :alt: Automated Tests +.. image:: https://github.com/jaraco/skeleton/workflows/tests/badge.svg + :target: https://github.com/jaraco/skeleton/actions?query=workflow%3A%22tests%22 + :alt: tests .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black From 2b839bad1c2189f4eeb0f74c4a2455ba6687741b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 30 Dec 2020 12:06:13 -0500 Subject: [PATCH 075/272] Add note about automatic merging of PRs and the requirements and limitations. --- skeleton.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/skeleton.md b/skeleton.md index dd8ec014cdb..0938f8920d6 100644 --- a/skeleton.md +++ b/skeleton.md @@ -138,6 +138,8 @@ Features include: - test against multiple Python versions - run on late (and updated) platform versions - automated releases of tagged commits +- [automatic merging of PRs](https://github.com/marketplace/actions/merge-pull-requests) (requires [protecting branches with required status checks](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/enabling-required-status-checks), [not possible through API](https://github.community/t/set-all-status-checks-to-be-required-as-branch-protection-using-the-github-api/119493)) + ### Continuous Deployments From a36768aa363c8f7b54aae00e11f895ff06337532 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 30 Dec 2020 22:20:46 -0500 Subject: [PATCH 076/272] Prefer pytest-enabler to jaraco.test --- pyproject.toml | 10 ++++------ setup.cfg | 3 +-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 79f088a9565..b6ebc0bef6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,16 +7,14 @@ skip-string-normalization = true [tool.setuptools_scm] -# jaraco/skeleton#22 -[tool.jaraco.pytest.plugins.black] +[pytest.enabler.black] addopts = "--black" -# jaraco/skeleton#22 -[tool.jaraco.pytest.plugins.mypy] +[pytest.enabler.mypy] addopts = "--mypy" -[tool.jaraco.pytest.plugins.flake8] +[pytest.enabler.flake8] addopts = "--flake8" -[tool.jaraco.pytest.plugins.cov] +[pytest.enabler.cov] addopts = "--cov" diff --git a/setup.cfg b/setup.cfg index 4fc095b31d0..d5010f7046f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,8 +29,7 @@ testing = pytest-black >= 0.3.7; python_implementation != "PyPy" pytest-cov pytest-mypy; python_implementation != "PyPy" - # jaraco/skeleton#22 - jaraco.test >= 3.2.0 + pytest-enabler # local From 02038f6272bd2fc04066480f7ba7d564ddb58769 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 13:09:59 +0100 Subject: [PATCH 077/272] Simplify `setuptools.archive_util.unpack_tarfile` --- setuptools/archive_util.py | 94 +++++++++++++++++++++++++------------- 1 file changed, 62 insertions(+), 32 deletions(-) diff --git a/setuptools/archive_util.py b/setuptools/archive_util.py index 0ce190b8cf7..0f70284822f 100644 --- a/setuptools/archive_util.py +++ b/setuptools/archive_util.py @@ -125,6 +125,56 @@ def unpack_zipfile(filename, extract_dir, progress_filter=default_filter): os.chmod(target, unix_attributes) +def _resolve_tar_file_or_dir(tar_obj, tar_member_obj): + """Resolve any links and extract link targets as normal files.""" + while tar_member_obj is not None and ( + tar_member_obj.islnk() or tar_member_obj.issym()): + linkpath = tar_member_obj.linkname + if tar_member_obj.issym(): + base = posixpath.dirname(tar_member_obj.name) + linkpath = posixpath.join(base, linkpath) + linkpath = posixpath.normpath(linkpath) + tar_member_obj = tar_obj._getmember(linkpath) + + is_file_or_dir = ( + tar_member_obj is not None and + (tar_member_obj.isfile() or tar_member_obj.isdir()) + ) + if is_file_or_dir: + return tar_member_obj + + raise LookupError('Got unknown file type') + + +def _iter_open_tar(tar_obj, extract_dir, progress_filter): + """Emit member-destination pairs from a tar archive.""" + # don't do any chowning! + tar_obj.chown = lambda *args: None + + with contextlib.closing(tar_obj): + for member in tar_obj: + name = member.name + # don't extract absolute paths or ones with .. in them + if name.startswith('/') or '..' in name.split('/'): + continue + + prelim_dst = os.path.join(extract_dir, *name.split('/')) + + try: + member = _resolve_tar_file_or_dir(tar_obj, member) + except LookupError: + continue + + final_dst = progress_filter(name, prelim_dst) + if not final_dst: + continue + + if final_dst.endswith(os.sep): + final_dst = final_dst[:-1] + + yield member, final_dst + + def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): """Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir` @@ -138,38 +188,18 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): raise UnrecognizedFormat( "%s is not a compressed or uncompressed tar file" % (filename,) ) from e - with contextlib.closing(tarobj): - # don't do any chowning! - tarobj.chown = lambda *args: None - for member in tarobj: - name = member.name - # don't extract absolute paths or ones with .. in them - if not name.startswith('/') and '..' not in name.split('/'): - prelim_dst = os.path.join(extract_dir, *name.split('/')) - - # resolve any links and to extract the link targets as normal - # files - while member is not None and ( - member.islnk() or member.issym()): - linkpath = member.linkname - if member.issym(): - base = posixpath.dirname(member.name) - linkpath = posixpath.join(base, linkpath) - linkpath = posixpath.normpath(linkpath) - member = tarobj._getmember(linkpath) - - if member is not None and (member.isfile() or member.isdir()): - final_dst = progress_filter(name, prelim_dst) - if final_dst: - if final_dst.endswith(os.sep): - final_dst = final_dst[:-1] - try: - # XXX Ugh - tarobj._extract_member(member, final_dst) - except tarfile.ExtractError: - # chown/chmod/mkfifo/mknode/makedev failed - pass - return True + + for member, final_dst in _iter_open_tar( + tarobj, extract_dir, progress_filter, + ): + try: + # XXX Ugh + tarobj._extract_member(member, final_dst) + except tarfile.ExtractError: + # chown/chmod/mkfifo/mknode/makedev failed + pass + + return True extraction_drivers = unpack_directory, unpack_zipfile, unpack_tarfile From 0d3b9600b2a94449796d06e3cea06c7a3972887b Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 17:50:15 +0100 Subject: [PATCH 078/272] Simplify `easy_install.install_eggs` --- setuptools/command/easy_install.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 9ec83b7d8ba..ff449435fd3 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -837,12 +837,19 @@ def write_script(self, script_name, contents, mode="t", blockers=()): def install_eggs(self, spec, dist_filename, tmpdir): # .egg dirs or files are already built, so just return them - if dist_filename.lower().endswith('.egg'): - return [self.install_egg(dist_filename, tmpdir)] - elif dist_filename.lower().endswith('.exe'): - return [self.install_exe(dist_filename, tmpdir)] - elif dist_filename.lower().endswith('.whl'): - return [self.install_wheel(dist_filename, tmpdir)] + installer_map = { + '.egg': self.install_egg, + '.exe': self.install_exe, + '.whl': self.install_wheel, + } + try: + install_dist = installer_map[ + dist_filename.lower()[-4:] + ] + except KeyError: + pass + else: + return [install_dist(dist_filename, tmpdir)] # Anything else, try to extract and build setup_base = tmpdir From b5fdca1ecb05a8c4c2da434e55d6ef5efec91e3e Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 17:51:58 +0100 Subject: [PATCH 079/272] Simplify `easy_install.update_pth` --- setuptools/command/easy_install.py | 36 +++++++++++++++++------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index ff449435fd3..6d990af4e50 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1196,11 +1196,13 @@ def update_pth(self, dist): return for d in self.pth_file[dist.key]: # drop old entries - if self.multi_version or d.location != dist.location: - log.info("Removing %s from easy-install.pth file", d) - self.pth_file.remove(d) - if d.location in self.shadow_path: - self.shadow_path.remove(d.location) + if not self.multi_version and d.location == dist.location: + continue + + log.info("Removing %s from easy-install.pth file", d) + self.pth_file.remove(d) + if d.location in self.shadow_path: + self.shadow_path.remove(d.location) if not self.multi_version: if dist.location in self.pth_file.paths: @@ -1214,19 +1216,21 @@ def update_pth(self, dist): if dist.location not in self.shadow_path: self.shadow_path.append(dist.location) - if not self.dry_run: + if self.dry_run: + return - self.pth_file.save() + self.pth_file.save() - if dist.key == 'setuptools': - # Ensure that setuptools itself never becomes unavailable! - # XXX should this check for latest version? - filename = os.path.join(self.install_dir, 'setuptools.pth') - if os.path.islink(filename): - os.unlink(filename) - f = open(filename, 'wt') - f.write(self.pth_file.make_relative(dist.location) + '\n') - f.close() + if dist.key != 'setuptools': + return + + # Ensure that setuptools itself never becomes unavailable! + # XXX should this check for latest version? + filename = os.path.join(self.install_dir, 'setuptools.pth') + if os.path.islink(filename): + os.unlink(filename) + with open(filename, 'wt') as f: + f.write(self.pth_file.make_relative(dist.location) + '\n') def unpack_progress(self, src, dst): # Progress filter for unpacking From 554ded3e40f5a2f6f426569534d402aad239a199 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 17:54:06 +0100 Subject: [PATCH 080/272] Simplify `command.easy_install.get_site_dirs` --- setuptools/command/easy_install.py | 81 ++++++++++++++++-------------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 6d990af4e50..df7b1d07282 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1371,51 +1371,56 @@ def get_site_dirs(): if sys.exec_prefix != sys.prefix: prefixes.append(sys.exec_prefix) for prefix in prefixes: - if prefix: - if sys.platform in ('os2emx', 'riscos'): - sitedirs.append(os.path.join(prefix, "Lib", "site-packages")) - elif os.sep == '/': - sitedirs.extend([ - os.path.join( - prefix, - "lib", - "python{}.{}".format(*sys.version_info), - "site-packages", - ), - os.path.join(prefix, "lib", "site-python"), - ]) - else: - sitedirs.extend([ + if not prefix: + continue + + if sys.platform in ('os2emx', 'riscos'): + sitedirs.append(os.path.join(prefix, "Lib", "site-packages")) + elif os.sep == '/': + sitedirs.extend([ + os.path.join( prefix, - os.path.join(prefix, "lib", "site-packages"), - ]) - if sys.platform == 'darwin': - # for framework builds *only* we add the standard Apple - # locations. Currently only per-user, but /Library and - # /Network/Library could be added too - if 'Python.framework' in prefix: - home = os.environ.get('HOME') - if home: - home_sp = os.path.join( - home, - 'Library', - 'Python', - '{}.{}'.format(*sys.version_info), - 'site-packages', - ) - sitedirs.append(home_sp) + "lib", + "python{}.{}".format(*sys.version_info), + "site-packages", + ), + os.path.join(prefix, "lib", "site-python"), + ]) + else: + sitedirs.extend([ + prefix, + os.path.join(prefix, "lib", "site-packages"), + ]) + if sys.platform != 'darwin': + continue + + # for framework builds *only* we add the standard Apple + # locations. Currently only per-user, but /Library and + # /Network/Library could be added too + if 'Python.framework' not in prefix: + continue + + home = os.environ.get('HOME') + if not home: + continue + + home_sp = os.path.join( + home, + 'Library', + 'Python', + '{}.{}'.format(*sys.version_info), + 'site-packages', + ) + sitedirs.append(home_sp) lib_paths = get_path('purelib'), get_path('platlib') - for site_lib in lib_paths: - if site_lib not in sitedirs: - sitedirs.append(site_lib) + + sitedirs.extend(s for s in lib_paths if s not in sitedirs) if site.ENABLE_USER_SITE: sitedirs.append(site.USER_SITE) - try: + with contextlib.suppress(AttributeError): sitedirs.extend(site.getsitepackages()) - except AttributeError: - pass sitedirs = list(map(normalize_path, sitedirs)) From 7b5f8e131cdce8626c138f8815f9001214dc2541 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 17:54:56 +0100 Subject: [PATCH 081/272] Simplify `command.easy_install.expand_paths` --- setuptools/command/easy_install.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index df7b1d07282..6882efe00e7 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1459,13 +1459,18 @@ def expand_paths(inputs): # Yield existing non-dupe, non-import directory lines from it for line in lines: - if not line.startswith("import"): - line = normalize_path(line.rstrip()) - if line not in seen: - seen[line] = 1 - if not os.path.isdir(line): - continue - yield line, os.listdir(line) + if line.startswith("import"): + continue + + line = normalize_path(line.rstrip()) + if line in seen: + continue + + seen[line] = 1 + if not os.path.isdir(line): + continue + + yield line, os.listdir(line) def extract_wininst_cfg(dist_filename): From 28b54b140cee8b33748833372ca6dbd7e305d94d Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 17:56:00 +0100 Subject: [PATCH 082/272] Simplify `egg_info.FileList.process_template_line` --- setuptools/command/egg_info.py | 127 +++++++++++++++++---------------- 1 file changed, 66 insertions(+), 61 deletions(-) diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 0b7ad677f2a..8e34e4a2c8c 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -8,6 +8,7 @@ from distutils import log import distutils.errors import distutils.filelist +import functools import os import re import sys @@ -332,70 +333,74 @@ def process_template_line(self, line): # patterns, (dir and patterns), or (dir_pattern). (action, patterns, dir, dir_pattern) = self._parse_template_line(line) + action_map = { + 'include': self.include, + 'exclude': self.exclude, + 'global-include': self.global_include, + 'global-exclude': self.global_exclude, + 'recursive-include': functools.partial( + self.recursive_include, dir, + ), + 'recursive-exclude': functools.partial( + self.recursive_exclude, dir, + ), + 'graft': self.graft, + 'prune': self.prune, + } + log_map = { + 'include': "warning: no files found matching '%s'", + 'exclude': ( + "warning: no previously-included files found " + "matching '%s'" + ), + 'global-include': ( + "warning: no files found matching '%s' " + "anywhere in distribution" + ), + 'global-exclude': ( + "warning: no previously-included files matching " + "'%s' found anywhere in distribution" + ), + 'recursive-include': ( + "warning: no files found matching '%s' " + "under directory '%s'" + ), + 'recursive-exclude': ( + "warning: no previously-included files matching " + "'%s' found under directory '%s'" + ), + 'graft': "warning: no directories found matching '%s'", + 'prune': "no previously-included directories found matching '%s'", + } + + try: + process_action = action_map[action] + except KeyError: + raise DistutilsInternalError( + "this cannot happen: invalid action '{action!s}'". + format(action=action), + ) + # OK, now we know that the action is valid and we have the # right number of words on the line for that action -- so we # can proceed with minimal error-checking. - if action == 'include': - self.debug_print("include " + ' '.join(patterns)) - for pattern in patterns: - if not self.include(pattern): - log.warn("warning: no files found matching '%s'", pattern) - - elif action == 'exclude': - self.debug_print("exclude " + ' '.join(patterns)) - for pattern in patterns: - if not self.exclude(pattern): - log.warn(("warning: no previously-included files " - "found matching '%s'"), pattern) - - elif action == 'global-include': - self.debug_print("global-include " + ' '.join(patterns)) - for pattern in patterns: - if not self.global_include(pattern): - log.warn(("warning: no files found matching '%s' " - "anywhere in distribution"), pattern) - - elif action == 'global-exclude': - self.debug_print("global-exclude " + ' '.join(patterns)) - for pattern in patterns: - if not self.global_exclude(pattern): - log.warn(("warning: no previously-included files matching " - "'%s' found anywhere in distribution"), - pattern) - - elif action == 'recursive-include': - self.debug_print("recursive-include %s %s" % - (dir, ' '.join(patterns))) - for pattern in patterns: - if not self.recursive_include(dir, pattern): - log.warn(("warning: no files found matching '%s' " - "under directory '%s'"), - pattern, dir) - - elif action == 'recursive-exclude': - self.debug_print("recursive-exclude %s %s" % - (dir, ' '.join(patterns))) - for pattern in patterns: - if not self.recursive_exclude(dir, pattern): - log.warn(("warning: no previously-included files matching " - "'%s' found under directory '%s'"), - pattern, dir) - - elif action == 'graft': - self.debug_print("graft " + dir_pattern) - if not self.graft(dir_pattern): - log.warn("warning: no directories found matching '%s'", - dir_pattern) - - elif action == 'prune': - self.debug_print("prune " + dir_pattern) - if not self.prune(dir_pattern): - log.warn(("no previously-included directories found " - "matching '%s'"), dir_pattern) - - else: - raise DistutilsInternalError( - "this cannot happen: invalid action '%s'" % action) + + action_is_recursive = action.startswith('recursive-') + if action in {'graft', 'prune'}: + patterns = [dir_pattern] + extra_log_args = (dir, ) if action_is_recursive else () + log_tmpl = log_map[action] + + self.debug_print( + ' '.join( + [action] + + ([dir] if action_is_recursive else []) + + patterns, + ) + ) + for pattern in patterns: + if not process_action(pattern): + log.warn(log_tmpl, pattern, *extra_log_args) def _remove_files(self, predicate): """ From 08984781ec38f9ba8b35c70c6a5fff38e00b55aa Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 17:58:45 +0100 Subject: [PATCH 083/272] Simplify `dist.Distribution._parse_config_files` --- setuptools/dist.py | 50 ++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index 2c088ef8cb4..186a407cb89 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -557,14 +557,12 @@ def _parse_config_files(self, filenames=None): from configparser import ConfigParser # Ignore install directory options if we have a venv - if sys.prefix != sys.base_prefix: - ignore_options = [ - 'install-base', 'install-platbase', 'install-lib', - 'install-platlib', 'install-purelib', 'install-headers', - 'install-scripts', 'install-data', 'prefix', 'exec-prefix', - 'home', 'user', 'root'] - else: - ignore_options = [] + ignore_options = [] if sys.prefix == sys.base_prefix else [ + 'install-base', 'install-platbase', 'install-lib', + 'install-platlib', 'install-purelib', 'install-headers', + 'install-scripts', 'install-data', 'prefix', 'exec-prefix', + 'home', 'user', 'root', + ] ignore_options = frozenset(ignore_options) @@ -585,30 +583,34 @@ def _parse_config_files(self, filenames=None): opt_dict = self.get_option_dict(section) for opt in options: - if opt != '__name__' and opt not in ignore_options: - val = parser.get(section, opt) - opt = opt.replace('-', '_') - opt_dict[opt] = (filename, val) + if opt == '__name__' or opt in ignore_options: + continue + + val = parser.get(section, opt) + opt = opt.replace('-', '_') + opt_dict[opt] = (filename, val) # Make the ConfigParser forget everything (so we retain # the original filenames that options come from) parser.__init__() + if 'global' not in self.command_options: + return + # If there was a "global" section in the config file, use it # to set Distribution options. - if 'global' in self.command_options: - for (opt, (src, val)) in self.command_options['global'].items(): - alias = self.negative_opt.get(opt) - try: - if alias: - setattr(self, alias, not strtobool(val)) - elif opt in ('verbose', 'dry_run'): # ugh! - setattr(self, opt, strtobool(val)) - else: - setattr(self, opt, val) - except ValueError as e: - raise DistutilsOptionError(e) from e + for (opt, (src, val)) in self.command_options['global'].items(): + alias = self.negative_opt.get(opt) + if alias: + val = not strtobool(val) + elif opt in ('verbose', 'dry_run'): # ugh! + val = strtobool(val) + + try: + setattr(self, alias or opt, val) + except ValueError as e: + raise DistutilsOptionError(e) from e def _set_command_options(self, command_obj, option_dict=None): """ From 818680c71d2a407f76ae9dc9edaee6c8b338ab2c Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 18:00:05 +0100 Subject: [PATCH 084/272] Simplify `setuptools.glob._iglob` --- setuptools/glob.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/setuptools/glob.py b/setuptools/glob.py index 9d7cbc5da68..87062b8187f 100644 --- a/setuptools/glob.py +++ b/setuptools/glob.py @@ -47,6 +47,8 @@ def iglob(pathname, recursive=False): def _iglob(pathname, recursive): dirname, basename = os.path.split(pathname) + glob_in_dir = glob2 if recursive and _isrecursive(basename) else glob1 + if not has_magic(pathname): if basename: if os.path.lexists(pathname): @@ -56,13 +58,9 @@ def _iglob(pathname, recursive): if os.path.isdir(dirname): yield pathname return + if not dirname: - if recursive and _isrecursive(basename): - for x in glob2(dirname, basename): - yield x - else: - for x in glob1(dirname, basename): - yield x + yield from glob_in_dir(dirname, basename) return # `os.path.split()` returns the argument itself as a dirname if it is a # drive or UNC path. Prevent an infinite recursion if a drive or UNC path @@ -71,12 +69,7 @@ def _iglob(pathname, recursive): dirs = _iglob(dirname, recursive) else: dirs = [dirname] - if has_magic(basename): - if recursive and _isrecursive(basename): - glob_in_dir = glob2 - else: - glob_in_dir = glob1 - else: + if not has_magic(basename): glob_in_dir = glob0 for dirname in dirs: for name in glob_in_dir(dirname, basename): From 9c88e35e0e54712f8ac361faffe5bc9cd370ad8d Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 18:02:31 +0100 Subject: [PATCH 085/272] Simplify `setuptools.installer.fetch_build_egg` --- setuptools/installer.py | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/setuptools/installer.py b/setuptools/installer.py index e630b874797..ac2aba18025 100644 --- a/setuptools/installer.py +++ b/setuptools/installer.py @@ -80,20 +80,17 @@ def fetch_build_egg(dist, req): if 'allow_hosts' in opts: raise DistutilsError('the `allow-hosts` option is not supported ' 'when using pip to install requirements.') - if 'PIP_QUIET' in os.environ or 'PIP_VERBOSE' in os.environ: - quiet = False - else: - quiet = True + quiet = 'PIP_QUIET' not in os.environ and 'PIP_VERBOSE' not in os.environ if 'PIP_INDEX_URL' in os.environ: index_url = None elif 'index_url' in opts: index_url = opts['index_url'][1] else: index_url = None - if 'find_links' in opts: - find_links = _fixup_find_links(opts['find_links'][1])[:] - else: - find_links = [] + find_links = ( + _fixup_find_links(opts['find_links'][1])[:] if 'find_links' in opts + else [] + ) if dist.dependency_links: find_links.extend(dist.dependency_links) eggs_dir = os.path.realpath(dist.get_egg_cache_dir()) @@ -112,16 +109,12 @@ def fetch_build_egg(dist, req): cmd.append('--quiet') if index_url is not None: cmd.extend(('--index-url', index_url)) - if find_links is not None: - for link in find_links: - cmd.extend(('--find-links', link)) + for link in find_links or []: + cmd.extend(('--find-links', link)) # If requirement is a PEP 508 direct URL, directly pass # the URL to pip, as `req @ url` does not work on the # command line. - if req.url: - cmd.append(req.url) - else: - cmd.append(str(req)) + cmd.append(req.url or str(req)) try: subprocess.check_call(cmd) except subprocess.CalledProcessError as e: From 699afd09f252025ff412c3be101d78576ce0fe60 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 18:03:15 +0100 Subject: [PATCH 086/272] Simplify `msvc.SystemInfo.find_reg_vs_vers` --- setuptools/msvc.py | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 1ead72b421b..53d45e592c7 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -24,6 +24,7 @@ from os import listdir, pathsep from os.path import join, isfile, isdir, dirname import sys +import contextlib import platform import itertools import subprocess @@ -724,28 +725,23 @@ def find_reg_vs_vers(self): ms = self.ri.microsoft vckeys = (self.ri.vc, self.ri.vc_for_python, self.ri.vs) vs_vers = [] - for hkey in self.ri.HKEYS: - for key in vckeys: - try: - bkey = winreg.OpenKey(hkey, ms(key), 0, winreg.KEY_READ) - except (OSError, IOError): - continue - with bkey: - subkeys, values, _ = winreg.QueryInfoKey(bkey) - for i in range(values): - try: - ver = float(winreg.EnumValue(bkey, i)[0]) - if ver not in vs_vers: - vs_vers.append(ver) - except ValueError: - pass - for i in range(subkeys): - try: - ver = float(winreg.EnumKey(bkey, i)) - if ver not in vs_vers: - vs_vers.append(ver) - except ValueError: - pass + for hkey, key in itertools.product(self.ri.HKEYS, vckeys): + try: + bkey = winreg.OpenKey(hkey, ms(key), 0, winreg.KEY_READ) + except (OSError, IOError): + continue + with bkey: + subkeys, values, _ = winreg.QueryInfoKey(bkey) + for i in range(values): + with contextlib.suppress(ValueError): + ver = float(winreg.EnumValue(bkey, i)[0]) + if ver not in vs_vers: + vs_vers.append(ver) + for i in range(subkeys): + with contextlib.suppress(ValueError): + ver = float(winreg.EnumKey(bkey, i)) + if ver not in vs_vers: + vs_vers.append(ver) return sorted(vs_vers) def find_programdata_vs_vers(self): From c225c4c0f64bf044f2f82693df097ad07f9c12bd Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 18:04:46 +0100 Subject: [PATCH 087/272] Simplify `PackageIndex.process_index` --- setuptools/package_index.py | 68 ++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 3979b131b56..713391af62c 100644 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -428,49 +428,53 @@ def scan_egg_link(self, path, entry): dist.precedence = SOURCE_DIST self.add(dist) + def _scan(self, link): + # Process a URL to see if it's for a package page + NO_MATCH_SENTINEL = None, None + if not link.startswith(self.index_url): + return NO_MATCH_SENTINEL + + parts = list(map( + urllib.parse.unquote, link[len(self.index_url):].split('/') + )) + if len(parts) != 2 or '#' in parts[1]: + return NO_MATCH_SENTINEL + + # it's a package page, sanitize and index it + pkg = safe_name(parts[0]) + ver = safe_version(parts[1]) + self.package_pages.setdefault(pkg.lower(), {})[link] = True + return to_filename(pkg), to_filename(ver) + def process_index(self, url, page): """Process the contents of a PyPI page""" - def scan(link): - # Process a URL to see if it's for a package page - if link.startswith(self.index_url): - parts = list(map( - urllib.parse.unquote, link[len(self.index_url):].split('/') - )) - if len(parts) == 2 and '#' not in parts[1]: - # it's a package page, sanitize and index it - pkg = safe_name(parts[0]) - ver = safe_version(parts[1]) - self.package_pages.setdefault(pkg.lower(), {})[link] = True - return to_filename(pkg), to_filename(ver) - return None, None - # process an index page into the package-page index for match in HREF.finditer(page): try: - scan(urllib.parse.urljoin(url, htmldecode(match.group(1)))) + self._scan(urllib.parse.urljoin(url, htmldecode(match.group(1)))) except ValueError: pass - pkg, ver = scan(url) # ensure this page is in the page index - if pkg: - # process individual package page - for new_url in find_external_links(url, page): - # Process the found URL - base, frag = egg_info_for_url(new_url) - if base.endswith('.py') and not frag: - if ver: - new_url += '#egg=%s-%s' % (pkg, ver) - else: - self.need_version_info(url) - self.scan_url(new_url) - - return PYPI_MD5.sub( - lambda m: '%s' % m.group(1, 3, 2), page - ) - else: + pkg, ver = self._scan(url) # ensure this page is in the page index + if not pkg: return "" # no sense double-scanning non-package pages + # process individual package page + for new_url in find_external_links(url, page): + # Process the found URL + base, frag = egg_info_for_url(new_url) + if base.endswith('.py') and not frag: + if ver: + new_url += '#egg=%s-%s' % (pkg, ver) + else: + self.need_version_info(url) + self.scan_url(new_url) + + return PYPI_MD5.sub( + lambda m: '%s' % m.group(1, 3, 2), page + ) + def need_version_info(self, url): self.scan_all( "Page at %s links to .py file(s) without version info; an index " From fc891f5cf6d93ad533e2afb5e15a2952408ab358 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 13:08:18 +0100 Subject: [PATCH 088/272] Apply noqa C901 comments to overly complex code --- pkg_resources/__init__.py | 9 ++++++--- setuptools/command/bdist_egg.py | 2 +- setuptools/command/easy_install.py | 19 ++++++++++++------- setuptools/command/egg_info.py | 2 +- setuptools/dist.py | 8 +++++--- setuptools/installer.py | 2 +- setuptools/msvc.py | 4 ++-- setuptools/package_index.py | 8 +++++--- setuptools/ssl_support.py | 2 +- 9 files changed, 34 insertions(+), 22 deletions(-) diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 737f4d5fad1..f42257776e6 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -696,7 +696,8 @@ def add(self, dist, entry=None, insert=True, replace=False): keys2.append(dist.key) self._added_new(dist) - def resolve(self, requirements, env=None, installer=None, + # FIXME: 'WorkingSet.resolve' is too complex (11) + def resolve(self, requirements, env=None, installer=None, # noqa: C901 replace_conflicting=False, extras=None): """List all distributions needed to (recursively) meet `requirements` @@ -1745,7 +1746,8 @@ def _get_date_and_size(zip_stat): timestamp = time.mktime(date_time) return timestamp, size - def _extract_resource(self, manager, zip_path): + # FIXME: 'ZipProvider._extract_resource' is too complex (12) + def _extract_resource(self, manager, zip_path): # noqa: C901 if zip_path in self._index(): for name in self._index()[zip_path]: @@ -2858,7 +2860,8 @@ def get_entry_info(self, group, name): """Return the EntryPoint object for `group`+`name`, or ``None``""" return self.get_entry_map(group).get(name) - def insert_on(self, path, loc=None, replace=False): + # FIXME: 'Distribution.insert_on' is too complex (13) + def insert_on(self, path, loc=None, replace=False): # noqa: C901 """Ensure self.location is on path If replace=False (default): diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index a88efb45b8c..206f2419ba1 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -153,7 +153,7 @@ def call_command(self, cmdname, **kw): self.run_command(cmdname) return cmd - def run(self): + def run(self): # noqa: C901 # is too complex (14) # FIXME # Generate metadata first self.run_command("egg_info") # We run install_lib before install_data, because some data hacks diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 6882efe00e7..f1e487d4d21 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -226,7 +226,7 @@ def _render_version(): print(tmpl.format(**locals())) raise SystemExit() - def finalize_options(self): + def finalize_options(self): # noqa: C901 # is too complex (25) # FIXME self.version and self._render_version() py_version = sys.version.split()[0] @@ -437,7 +437,7 @@ def pseudo_tempname(self): def warn_deprecated_options(self): pass - def check_site_dir(self): + def check_site_dir(self): # noqa: C901 # is too complex (12) # FIXME """Verify that self.install_dir is .pth-capable dir, if needed""" instdir = normalize_path(self.install_dir) @@ -713,7 +713,10 @@ def select_scheme(self, name): if getattr(self, attrname) is None: setattr(self, attrname, scheme[key]) - def process_distribution(self, requirement, dist, deps=True, *info): + # FIXME: 'easy_install.process_distribution' is too complex (12) + def process_distribution( # noqa: C901 + self, requirement, dist, deps=True, *info, + ): self.update_pth(dist) self.package_index.add(dist) if dist in self.local_index[dist.key]: @@ -894,7 +897,8 @@ def egg_distribution(self, egg_path): metadata = EggMetadata(zipimport.zipimporter(egg_path)) return Distribution.from_filename(egg_path, metadata=metadata) - def install_egg(self, egg_path, tmpdir): + # FIXME: 'easy_install.install_egg' is too complex (11) + def install_egg(self, egg_path, tmpdir): # noqa: C901 destination = os.path.join( self.install_dir, os.path.basename(egg_path), @@ -993,7 +997,8 @@ def install_exe(self, dist_filename, tmpdir): # install the .egg return self.install_egg(egg_path, tmpdir) - def exe_to_egg(self, dist_filename, egg_tmp): + # FIXME: 'easy_install.exe_to_egg' is too complex (12) + def exe_to_egg(self, dist_filename, egg_tmp): # noqa: C901 """Extract a bdist_wininst to the directories an egg would use""" # Check for .pth file and set up prefix translations prefixes = get_exe_prefixes(dist_filename) @@ -1191,7 +1196,7 @@ def _set_fetcher_options(self, base): cfg_filename = os.path.join(base, 'setup.cfg') setopt.edit_config(cfg_filename, settings) - def update_pth(self, dist): + def update_pth(self, dist): # noqa: C901 # is too complex (11) # FIXME if self.pth_file is None: return @@ -1427,7 +1432,7 @@ def get_site_dirs(): return sitedirs -def expand_paths(inputs): +def expand_paths(inputs): # noqa: C901 # is too complex (11) # FIXME """Yield sys.path directories that might contain "old-style" packages""" seen = {} diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 8e34e4a2c8c..1f120b67d18 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -32,7 +32,7 @@ from setuptools import SetuptoolsDeprecationWarning -def translate_pattern(glob): +def translate_pattern(glob): # noqa: C901 # is too complex (14) # FIXME """ Translate a file path glob like '*.txt' in to a regular expression. This differs from fnmatch.translate which allows wildcards to match diff --git a/setuptools/dist.py b/setuptools/dist.py index 186a407cb89..662fbe67c59 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -119,7 +119,7 @@ def _read_list(name): # Based on Python 3.5 version -def write_pkg_file(self, file): +def write_pkg_file(self, file): # noqa: C901 # is too complex (14) # FIXME """Write the PKG-INFO format data to a file object. """ version = self.get_metadata_version() @@ -548,7 +548,8 @@ def _clean_req(self, req): req.marker = None return req - def _parse_config_files(self, filenames=None): + # FIXME: 'Distribution._parse_config_files' is too complex (14) + def _parse_config_files(self, filenames=None): # noqa: C901 """ Adapted from distutils.dist.Distribution.parse_config_files, this method provides the same functionality in subtly-improved @@ -612,7 +613,8 @@ def _parse_config_files(self, filenames=None): except ValueError as e: raise DistutilsOptionError(e) from e - def _set_command_options(self, command_obj, option_dict=None): + # FIXME: 'Distribution._set_command_options' is too complex (14) + def _set_command_options(self, command_obj, option_dict=None): # noqa: C901 """ Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to diff --git a/setuptools/installer.py b/setuptools/installer.py index ac2aba18025..c5822a31f4d 100644 --- a/setuptools/installer.py +++ b/setuptools/installer.py @@ -51,7 +51,7 @@ def _legacy_fetch_build_egg(dist, req): return cmd.easy_install(req) -def fetch_build_egg(dist, req): +def fetch_build_egg(dist, req): # noqa: C901 # is too complex (16) # FIXME """Fetch an egg needed for building. Use pip/wheel to fetch/build a wheel.""" diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 53d45e592c7..d5e0a952325 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -921,8 +921,8 @@ def WindowsSdkLastVersion(self): """ return self._use_last_dir_name(join(self.WindowsSdkDir, 'lib')) - @property - def WindowsSdkDir(self): + @property # noqa: C901 + def WindowsSdkDir(self): # noqa: C901 # is too complex (12) # FIXME """ Microsoft Windows SDK directory. diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 713391af62c..123e9582b5d 100644 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -320,7 +320,8 @@ def __init__( else: self.opener = urllib.request.urlopen - def process_url(self, url, retrieve=False): + # FIXME: 'PackageIndex.process_url' is too complex (14) + def process_url(self, url, retrieve=False): # noqa: C901 """Evaluate a URL as a possible download, and maybe retrieve it""" if url in self.scanned_urls and not retrieve: return @@ -595,7 +596,7 @@ def download(self, spec, tmpdir): spec = parse_requirement_arg(spec) return getattr(self.fetch_distribution(spec, tmpdir), 'location', None) - def fetch_distribution( + def fetch_distribution( # noqa: C901 # is too complex (14) # FIXME self, requirement, tmpdir, force_scan=False, source=False, develop_ok=False, local_index=None): """Obtain a distribution suitable for fulfilling `requirement` @@ -766,7 +767,8 @@ def _download_to(self, url, filename): def reporthook(self, url, filename, blocknum, blksize, size): pass # no-op - def open_url(self, url, warning=None): + # FIXME: + def open_url(self, url, warning=None): # noqa: C901 # is too complex (12) if url.startswith('file:'): return local_open(url) try: diff --git a/setuptools/ssl_support.py b/setuptools/ssl_support.py index eac5e656083..b58cca37c93 100644 --- a/setuptools/ssl_support.py +++ b/setuptools/ssl_support.py @@ -56,7 +56,7 @@ class CertificateError(ValueError): pass -if not match_hostname: +if not match_hostname: # noqa: C901 # 'If 59' is too complex (21) # FIXME def _dnsname_match(dn, hostname, max_wildcards=1): """Matching according to RFC 6125, section 6.4.3 From 6f74941c2649b6154dee860417b8b4a576d19974 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 31 Dec 2020 18:05:28 +0100 Subject: [PATCH 089/272] Enable McCabe complexity check in flake8 --- .flake8 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.flake8 b/.flake8 index 8bc2d27060d..f6a5cc8636e 100644 --- a/.flake8 +++ b/.flake8 @@ -12,3 +12,6 @@ ignore = E203 setuptools/site-patch.py F821 setuptools/py*compat.py F811 + +# Let's not overcomplicate the code: +max-complexity = 10 From 51b78f9d90fcdb0a924ed12e7baa24660f53008c Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 1 Jan 2021 20:16:51 -0500 Subject: [PATCH 090/272] fix: suggest PyPA build instead of pep517.build --- docs/setuptools.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/setuptools.rst b/docs/setuptools.rst index 1000a0cebf4..05516a4e310 100644 --- a/docs/setuptools.rst +++ b/docs/setuptools.rst @@ -157,7 +157,7 @@ To use this feature: ] build-backend = "setuptools.build_meta" -* Use a :pep:`517` compatible build frontend, such as ``pip >= 19`` or ``pep517``. +* Use a :pep:`517` compatible build frontend, such as ``pip >= 19`` or ``build``. .. warning:: From de4b9885060814c121f692db3e94b70994e15b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 30 Dec 2020 12:05:02 +0100 Subject: [PATCH 091/272] Define create_module()/exec_module() in VendorImporter Fixes https://github.com/pypa/setuptools/issues/2481 --- changelog.d/2481.change.rst | 2 ++ pkg_resources/extern/__init__.py | 6 ++++++ setuptools/extern/__init__.py | 6 ++++++ 3 files changed, 14 insertions(+) create mode 100644 changelog.d/2481.change.rst diff --git a/changelog.d/2481.change.rst b/changelog.d/2481.change.rst new file mode 100644 index 00000000000..dc824c9c2ed --- /dev/null +++ b/changelog.d/2481.change.rst @@ -0,0 +1,2 @@ +Define ``create_module()`` and ``exec_module()`` methods in ``VendorImporter`` +to get rid of ``ImportWarning`` -- by :user:`hroncok` diff --git a/pkg_resources/extern/__init__.py b/pkg_resources/extern/__init__.py index 4dc3beb2fa5..1fbb4fcc896 100644 --- a/pkg_resources/extern/__init__.py +++ b/pkg_resources/extern/__init__.py @@ -54,6 +54,12 @@ def load_module(self, fullname): "distribution.".format(**locals()) ) + def create_module(self, spec): + return self.load_module(spec.name) + + def exec_module(self, module): + pass + def install(self): """ Install this importer into sys.meta_path if not already present. diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py index b7f30dc2e38..399701a044e 100644 --- a/setuptools/extern/__init__.py +++ b/setuptools/extern/__init__.py @@ -54,6 +54,12 @@ def load_module(self, fullname): "distribution.".format(**locals()) ) + def create_module(self, spec): + return self.load_module(spec.name) + + def exec_module(self, module): + pass + def install(self): """ Install this importer into sys.meta_path if not already present. From f146b387548711d8095002e3d1214ca98a8b0392 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 6 Jan 2021 17:40:30 +0100 Subject: [PATCH 092/272] Avoid deprecated load_module() in pkg_resources namespace delaration Fixes: https://github.com/pypa/setuptools/issues/2493 --- changelog.d/2493.change.rst | 2 ++ pkg_resources/__init__.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/2493.change.rst diff --git a/changelog.d/2493.change.rst b/changelog.d/2493.change.rst new file mode 100644 index 00000000000..f2c46932405 --- /dev/null +++ b/changelog.d/2493.change.rst @@ -0,0 +1,2 @@ +Use importlib.import_module() rather than the deprectated loader.load_module() +in pkg_resources namespace delaration -- by :user:`encukou` diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 737f4d5fad1..99b7f680753 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -38,6 +38,7 @@ import inspect import ntpath import posixpath +import importlib from pkgutil import get_importer try: @@ -2209,7 +2210,7 @@ def _handle_ns(packageName, path_item): if subpath is not None: path = module.__path__ path.append(subpath) - loader.load_module(packageName) + importlib.import_module(packageName) _rebuild_mod_path(path, packageName, module) return subpath From c1b2b1a60f7d099e841d6bbcac3531c5cb2efc1b Mon Sep 17 00:00:00 2001 From: YuanPei Li Date: Fri, 8 Jan 2021 17:35:33 +0800 Subject: [PATCH 093/272] fix typo Fix a difference between the name of function definition and calling. --- docs/userguide/entry_point.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userguide/entry_point.rst b/docs/userguide/entry_point.rst index edab446502b..738207282cb 100644 --- a/docs/userguide/entry_point.rst +++ b/docs/userguide/entry_point.rst @@ -28,7 +28,7 @@ with ``__init__.py`` as: .. code-block:: python - def helloworld(): + def hello_world(): print("Hello world") and ``__main__.py`` providing a hook: From 0ace684768f5d9b42338fa4c0c10e3b4345a411f Mon Sep 17 00:00:00 2001 From: YuanPei Li Date: Fri, 8 Jan 2021 17:41:47 +0800 Subject: [PATCH 094/272] Create 2525.doc.rst --- changelog.d/2525.doc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2525.doc.rst diff --git a/changelog.d/2525.doc.rst b/changelog.d/2525.doc.rst new file mode 100644 index 00000000000..86baac98c14 --- /dev/null +++ b/changelog.d/2525.doc.rst @@ -0,0 +1 @@ +Fix typo in the entry point page. -- by :user:`jtr109` From 6a0c93bb62f45d1696ae8487c30090b279bb5f0f Mon Sep 17 00:00:00 2001 From: YuanPei Li Date: Fri, 8 Jan 2021 17:46:42 +0800 Subject: [PATCH 095/272] Update 2525.doc.rst --- changelog.d/2525.doc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/2525.doc.rst b/changelog.d/2525.doc.rst index 86baac98c14..5d7ad5d3357 100644 --- a/changelog.d/2525.doc.rst +++ b/changelog.d/2525.doc.rst @@ -1 +1 @@ -Fix typo in the entry point page. -- by :user:`jtr109` +Fix typo in the document page about entry point. -- by :user:`jtr109` From fbc9bd6fdbce132b9b5136345b0f6b3a1f6debaf Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 8 Jan 2021 14:14:14 -0500 Subject: [PATCH 096/272] Disable inclusion of package data as it causes 'tests' to be included as data. Fixes #2505. --- changelog.d/2505.misc.rst | 1 + setup.cfg | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog.d/2505.misc.rst diff --git a/changelog.d/2505.misc.rst b/changelog.d/2505.misc.rst new file mode 100644 index 00000000000..11c642e7789 --- /dev/null +++ b/changelog.d/2505.misc.rst @@ -0,0 +1 @@ +Disable inclusion of package data as it causes 'tests' to be included as data. diff --git a/setup.cfg b/setup.cfg index 4eb50183903..02d99530b7a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,7 +24,8 @@ project_urls = [options] packages = find: py_modules = easy_install -include_package_data = true +# disabled as it causes tests to be included #2505 +# include_package_data = true python_requires = >=3.6 install_requires = From fe0541078d9a7720d9fa679f66209598bb6f4572 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 8 Jan 2021 14:14:52 -0500 Subject: [PATCH 097/272] =?UTF-8?q?Bump=20version:=2051.1.1=20=E2=86=92=20?= =?UTF-8?q?51.1.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 9 +++++++++ changelog.d/2505.misc.rst | 1 - setup.cfg | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/2505.misc.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 60e7352f593..432c813062e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 51.1.1 +current_version = 51.1.2 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index ca76648bd21..5f69c6abbcf 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v51.1.2 +------- + + +Misc +^^^^ +* #2505: Disable inclusion of package data as it causes 'tests' to be included as data. + + v51.1.1 ------- diff --git a/changelog.d/2505.misc.rst b/changelog.d/2505.misc.rst deleted file mode 100644 index 11c642e7789..00000000000 --- a/changelog.d/2505.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Disable inclusion of package data as it causes 'tests' to be included as data. diff --git a/setup.cfg b/setup.cfg index 02d99530b7a..dff72caf38b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] license_file = LICENSE name = setuptools -version = 51.1.1 +version = 51.1.2 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 3e876d7906fa6387ab6ac9a9bff8659762363017 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 8 Jan 2021 23:14:07 -0500 Subject: [PATCH 098/272] Enable complexity limit. Fixes jaraco/skeleton#34. --- .flake8 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.flake8 b/.flake8 index 790c109fdbe..59a51f86913 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,9 @@ [flake8] max-line-length = 88 + +# jaraco/skeleton#34 +max-complexity = 10 + ignore = # W503 violates spec https://github.com/PyCQA/pycodestyle/issues/513 W503 From 1731fbebe9f6655a203e6e08ab309f9916ea6f65 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 9 Jan 2021 05:21:12 +0100 Subject: [PATCH 099/272] Replace pep517.build with build (#37) * Replace pep517.build with build Resolves #30 * Prefer simple usage Co-authored-by: Jason R. Coombs --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 7233b942320..249f97c24f1 100644 --- a/tox.ini +++ b/tox.ini @@ -24,7 +24,7 @@ commands = [testenv:release] skip_install = True deps = - pep517>=0.5 + build twine[keyring]>=1.13 path jaraco.develop>=7.1 @@ -35,6 +35,6 @@ setenv = TWINE_USERNAME = {env:TWINE_USERNAME:__token__} commands = python -c "import path; path.Path('dist').rmtree_p()" - python -m pep517.build . + python -m build python -m twine upload dist/* python -m jaraco.develop.create-github-release From a9b3f681dea9728235c2a9c68165f7b5cbf350ab Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 9 Jan 2021 05:27:24 +0100 Subject: [PATCH 100/272] Use license_files instead of license_file in meta (#35) Singular `license_file` is deprecated since wheel v0.32.0. Refs: * https://wheel.readthedocs.io/en/stable/news.html * https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file --- setup.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index d5010f7046f..88bc263a478 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,6 @@ [metadata] -license_file = LICENSE +license_files = + LICENSE name = skeleton author = Jason R. Coombs author_email = jaraco@jaraco.com From 77fbe1df4af6d8f75f44440e89ee1bc249c9f2e0 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 9 Jan 2021 05:37:11 +0100 Subject: [PATCH 101/272] Use `extend-ignore` in flake8 config (#33) * Use `extend-ignore` in flake8 config This option allows to add extra ignored rules to the default list instead of replacing it. The default exclusions are: E121, E123, E126, E226, E24, E704, W503 and W504. Fixes #28. Refs: * https://github.com/pypa/setuptools/pull/2486/files#r541943356 * https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-extend-ignore * https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-ignore * Enable complexity limit. Fixes jaraco/skeleton#34. * Replace pep517.build with build (#37) * Replace pep517.build with build Resolves #30 * Prefer simple usage Co-authored-by: Jason R. Coombs * Use license_files instead of license_file in meta (#35) Singular `license_file` is deprecated since wheel v0.32.0. Refs: * https://wheel.readthedocs.io/en/stable/news.html * https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file Co-authored-by: Jason R. Coombs --- .flake8 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.flake8 b/.flake8 index 59a51f86913..48b2e246f1b 100644 --- a/.flake8 +++ b/.flake8 @@ -4,10 +4,6 @@ max-line-length = 88 # jaraco/skeleton#34 max-complexity = 10 -ignore = - # W503 violates spec https://github.com/PyCQA/pycodestyle/issues/513 - W503 - # W504 has issues https://github.com/OCA/maintainer-quality-tools/issues/545 - W504 +extend-ignore = # Black creates whitespace before colon E203 From e39cb0d21041578f3435e29bc45b3e7894e48548 Mon Sep 17 00:00:00 2001 From: Dustin Ingram Date: Fri, 15 Jan 2021 13:53:33 -0600 Subject: [PATCH 102/272] Move helper method out of class --- setuptools/tests/test_egg_info.py | 57 ++++++++++++++++--------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index 1047468b185..0297f131083 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -19,6 +19,26 @@ from . import contexts +def _run_egg_info_command(tmpdir_cwd, env, cmd=None, output=None): + environ = os.environ.copy().update( + HOME=env.paths['home'], + ) + if cmd is None: + cmd = [ + 'egg_info', + ] + code, data = environment.run_setup_py( + cmd=cmd, + pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]), + data_stream=1, + env=environ, + ) + assert not code, data + + if output: + assert output in data + + class Environment(str): pass @@ -132,7 +152,7 @@ def test_egg_info_save_version_info_setup_defaults(self, tmpdir_cwd, env): def test_expected_files_produced(self, tmpdir_cwd, env): self._create_project() - self._run_egg_info_command(tmpdir_cwd, env) + _run_egg_info_command(tmpdir_cwd, env) actual = os.listdir('foo.egg-info') expected = [ @@ -166,7 +186,7 @@ def test_license_is_a_string(self, tmpdir_cwd, env): # currently configured to use a subprocess, the actual traceback # object is lost and we need to parse it from stderr with pytest.raises(AssertionError) as exc: - self._run_egg_info_command(tmpdir_cwd, env) + _run_egg_info_command(tmpdir_cwd, env) # Hopefully this is not too fragile: the only argument to the # assertion error should be a traceback, ending with: @@ -180,13 +200,13 @@ def test_rebuilt(self, tmpdir_cwd, env): """Ensure timestamps are updated when the command is re-run.""" self._create_project() - self._run_egg_info_command(tmpdir_cwd, env) + _run_egg_info_command(tmpdir_cwd, env) timestamp_a = os.path.getmtime('foo.egg-info') # arbitrary sleep just to handle *really* fast systems time.sleep(.001) - self._run_egg_info_command(tmpdir_cwd, env) + _run_egg_info_command(tmpdir_cwd, env) timestamp_b = os.path.getmtime('foo.egg-info') assert timestamp_a != timestamp_b @@ -201,7 +221,7 @@ def test_manifest_template_is_read(self, tmpdir_cwd, env): 'usage.rst': "Run 'hi'", } }) - self._run_egg_info_command(tmpdir_cwd, env) + _run_egg_info_command(tmpdir_cwd, env) egg_info_dir = os.path.join('.', 'foo.egg-info') sources_txt = os.path.join(egg_info_dir, 'SOURCES.txt') with open(sources_txt) as f: @@ -441,7 +461,7 @@ def test_requires( self, tmpdir_cwd, env, requires, use_setup_cfg, expected_requires, install_cmd_kwargs): self._setup_script_with_requires(requires, use_setup_cfg) - self._run_egg_info_command(tmpdir_cwd, env, **install_cmd_kwargs) + _run_egg_info_command(tmpdir_cwd, env, **install_cmd_kwargs) egg_info_dir = os.path.join('.', 'foo.egg-info') requires_txt = os.path.join(egg_info_dir, 'requires.txt') if os.path.exists(requires_txt): @@ -461,14 +481,14 @@ def test_install_requires_unordered_disallowed(self, tmpdir_cwd, env): req = 'install_requires={"fake-factory==0.5.2", "pytz"}' self._setup_script_with_requires(req) with pytest.raises(AssertionError): - self._run_egg_info_command(tmpdir_cwd, env) + _run_egg_info_command(tmpdir_cwd, env) def test_extras_require_with_invalid_marker(self, tmpdir_cwd, env): tmpl = 'extras_require={{":{marker}": ["barbazquux"]}},' req = tmpl.format(marker=self.invalid_marker) self._setup_script_with_requires(req) with pytest.raises(AssertionError): - self._run_egg_info_command(tmpdir_cwd, env) + _run_egg_info_command(tmpdir_cwd, env) assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == [] def test_extras_require_with_invalid_marker_in_req(self, tmpdir_cwd, env): @@ -476,7 +496,7 @@ def test_extras_require_with_invalid_marker_in_req(self, tmpdir_cwd, env): req = tmpl.format(marker=self.invalid_marker) self._setup_script_with_requires(req) with pytest.raises(AssertionError): - self._run_egg_info_command(tmpdir_cwd, env) + _run_egg_info_command(tmpdir_cwd, env) assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == [] def test_provides_extra(self, tmpdir_cwd, env): @@ -865,25 +885,6 @@ def test_egg_info_includes_setup_py(self, tmpdir_cwd): sources = f.read().split('\n') assert 'setup.py' in sources - def _run_egg_info_command(self, tmpdir_cwd, env, cmd=None, output=None): - environ = os.environ.copy().update( - HOME=env.paths['home'], - ) - if cmd is None: - cmd = [ - 'egg_info', - ] - code, data = environment.run_setup_py( - cmd=cmd, - pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]), - data_stream=1, - env=environ, - ) - assert not code, data - - if output: - assert output in data - def test_egg_info_tag_only_once(self, tmpdir_cwd, env): self._create_project() build_files({ From 2788dbf93ee8e3d86f7bc86ec6ffc79c7a4643c8 Mon Sep 17 00:00:00 2001 From: Dustin Ingram Date: Fri, 15 Jan 2021 13:54:54 -0600 Subject: [PATCH 103/272] Add failing test --- setuptools/tests/test_egg_info.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index 0297f131083..1d0f07e3067 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -6,6 +6,7 @@ import stat import time +from setuptools.build_meta import prepare_metadata_for_build_wheel from setuptools.command.egg_info import ( egg_info, manifest_maker, EggInfoDeprecationWarning, get_pkg_info_revision, ) @@ -885,7 +886,22 @@ def test_egg_info_includes_setup_py(self, tmpdir_cwd): sources = f.read().split('\n') assert 'setup.py' in sources - def test_egg_info_tag_only_once(self, tmpdir_cwd, env): + @pytest.mark.parametrize( + ('make_metadata_path', 'run_command'), + [ + ( + lambda env: os.path.join('.', 'foo.egg-info', 'PKG-INFO'), + lambda tmpdir_cwd, env: _run_egg_info_command(tmpdir_cwd, env) + ), + ( + lambda env: os.path.join(env, 'foo.dist-info', 'METADATA'), + lambda tmpdir_cwd, env: prepare_metadata_for_build_wheel(env) + ) + ] + ) + def test_egg_info_tag_only_once( + self, tmpdir_cwd, env, make_metadata_path, run_command + ): self._create_project() build_files({ 'setup.cfg': DALS(""" @@ -895,11 +911,10 @@ def test_egg_info_tag_only_once(self, tmpdir_cwd, env): tag_svn_revision = 0 """), }) - self._run_egg_info_command(tmpdir_cwd, env) - egg_info_dir = os.path.join('.', 'foo.egg-info') - with open(os.path.join(egg_info_dir, 'PKG-INFO')) as pkginfo_file: - pkg_info_lines = pkginfo_file.read().split('\n') - assert 'Version: 0.0.0.dev0' in pkg_info_lines + run_command(tmpdir_cwd, env) + with open(make_metadata_path(env)) as metadata_file: + metadata_lines = metadata_file.read().split('\n') + assert 'Version: 0.0.0.dev0' in metadata_lines def test_get_pkg_info_revision_deprecated(self): pytest.warns(EggInfoDeprecationWarning, get_pkg_info_revision) From ed07f8b124f75b43e27e5d636484898476a0be4f Mon Sep 17 00:00:00 2001 From: Dustin Ingram Date: Fri, 15 Jan 2021 14:19:14 -0600 Subject: [PATCH 104/272] Correctly handle normalized tags --- changelog.d/2529.change.rst | 1 + setuptools/command/egg_info.py | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 changelog.d/2529.change.rst diff --git a/changelog.d/2529.change.rst b/changelog.d/2529.change.rst new file mode 100644 index 00000000000..10c41518d40 --- /dev/null +++ b/changelog.d/2529.change.rst @@ -0,0 +1 @@ +Fixed an issue where version tags may be added multiple times diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 0b7ad677f2a..066c248886d 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -130,10 +130,12 @@ def _maybe_tag(self, version): egg_info may be called more than once for a distribution, in which case the version string already contains all tags. """ - return ( - version if self.vtags and version.endswith(self.vtags) - else version + self.vtags - ) + # Remove the tags if they exist. The tags maybe have been normalized + # (e.g. turning .dev into .dev0) so we can't just compare strings + base_version = parse_version(version).base_version + + # Add the tags + return base_version + self.vtags def tags(self): version = '' From 0df40810ec54590c888ae0e4073d73f731c91f4a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 15 Jan 2021 19:16:28 -0500 Subject: [PATCH 105/272] Add support for namespace packages. Closes jaraco/skeleton#40. --- setup.cfg | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 88bc263a478..106763e3d96 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,12 +15,18 @@ classifiers = Programming Language :: Python :: 3 :: Only [options] -packages = find: +packages = find_namespace: include_package_data = true python_requires = >=3.6 install_requires = setup_requires = setuptools_scm[toml] >= 3.4.1 +[options.packages.find] +exclude = + build* + docs* + tests* + [options.extras_require] testing = # upstream From a499dee61ecdabf867853f24a2bc78a8197c97f1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 16 Jan 2021 16:36:47 -0500 Subject: [PATCH 106/272] Avoid hitting network during test_easy_install --- changelog.d/2525.misc.rst | 1 + setuptools/tests/test_easy_install.py | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 changelog.d/2525.misc.rst diff --git a/changelog.d/2525.misc.rst b/changelog.d/2525.misc.rst new file mode 100644 index 00000000000..50d1bfa1b12 --- /dev/null +++ b/changelog.d/2525.misc.rst @@ -0,0 +1 @@ +Avoid hitting network during test_easy_install. diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index dc00e697de6..93ac23e49ec 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -38,6 +38,16 @@ from .textwrap import DALS +@pytest.fixture(autouse=True) +def pip_disable_index(monkeypatch): + """ + Important: Disable the default index for pip to avoid + querying packages in the index and potentially resolving + and installing packages there. + """ + monkeypatch.setenv('PIP_NO_INDEX', 'true') + + class FakeDist: def get_entry_map(self, group): if group != 'console_scripts': From b316312fa192f1299b3baea108f956d44a8b43f8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 16 Jan 2021 16:40:50 -0500 Subject: [PATCH 107/272] Point changelog at 2534 for more info --- changelog.d/{2525.misc.rst => 2534.misc.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/{2525.misc.rst => 2534.misc.rst} (100%) diff --git a/changelog.d/2525.misc.rst b/changelog.d/2534.misc.rst similarity index 100% rename from changelog.d/2525.misc.rst rename to changelog.d/2534.misc.rst From 0d6368684f349c1615600eabff877f7a5a29d6c6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 16 Jan 2021 16:42:48 -0500 Subject: [PATCH 108/272] =?UTF-8?q?Bump=20version:=2051.1.2=20=E2=86=92=20?= =?UTF-8?q?51.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 18 ++++++++++++++++++ changelog.d/2493.change.rst | 2 -- changelog.d/2525.doc.rst | 1 - changelog.d/2534.misc.rst | 1 - setup.cfg | 2 +- 6 files changed, 20 insertions(+), 6 deletions(-) delete mode 100644 changelog.d/2493.change.rst delete mode 100644 changelog.d/2525.doc.rst delete mode 100644 changelog.d/2534.misc.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 432c813062e..facadd5f3b8 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 51.1.2 +current_version = 51.2.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 5f69c6abbcf..a95d7c72f61 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,21 @@ +v51.2.0 +------- + + +Changes +^^^^^^^ +* #2493: Use importlib.import_module() rather than the deprectated loader.load_module() + in pkg_resources namespace delaration -- by :user:`encukou` + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ +* #2525: Fix typo in the document page about entry point. -- by :user:`jtr109` + +Misc +^^^^ +* #2534: Avoid hitting network during test_easy_install. + + v51.1.2 ------- diff --git a/changelog.d/2493.change.rst b/changelog.d/2493.change.rst deleted file mode 100644 index f2c46932405..00000000000 --- a/changelog.d/2493.change.rst +++ /dev/null @@ -1,2 +0,0 @@ -Use importlib.import_module() rather than the deprectated loader.load_module() -in pkg_resources namespace delaration -- by :user:`encukou` diff --git a/changelog.d/2525.doc.rst b/changelog.d/2525.doc.rst deleted file mode 100644 index 5d7ad5d3357..00000000000 --- a/changelog.d/2525.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Fix typo in the document page about entry point. -- by :user:`jtr109` diff --git a/changelog.d/2534.misc.rst b/changelog.d/2534.misc.rst deleted file mode 100644 index 50d1bfa1b12..00000000000 --- a/changelog.d/2534.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Avoid hitting network during test_easy_install. diff --git a/setup.cfg b/setup.cfg index dff72caf38b..451abe835ae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] license_file = LICENSE name = setuptools -version = 51.1.2 +version = 51.2.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From d2b1f7ebd6ebd57b4a50bc6660e93b31129bacb4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 16 Jan 2021 16:43:27 -0500 Subject: [PATCH 109/272] Point changelog at 2534 for more info --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index a95d7c72f61..e51b5e646c8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -31,7 +31,7 @@ v51.1.1 Misc ^^^^ -* #2525: Avoid hitting network during test_virtualenv.test_test_command. +* #2534: Avoid hitting network during test_virtualenv.test_test_command. v51.1.0 From aaf8eb94dad0e5f4dce7bb1b51e586c08e3a4319 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 16 Jan 2021 16:58:28 -0500 Subject: [PATCH 110/272] Disable PIP_NO_INDEX for tests that override the index. Ref #2534. --- setuptools/tests/test_easy_install.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 93ac23e49ec..6aa17e94141 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -455,6 +455,7 @@ def test_setup_requires_honors_fetch_params(self, mock_index, monkeypatch): """ monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) + monkeypatch.setenv('PIP_NO_INDEX', 'false') with contexts.quiet(): # create an sdist that has a build-time dependency. with TestSetupRequires.create_sdist() as dist_file: @@ -628,6 +629,7 @@ def make_dependency_sdist(dist_path, distname, version): def test_setup_requires_honors_pip_env(self, mock_index, monkeypatch): monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) + monkeypatch.setenv('PIP_NO_INDEX', 'false') monkeypatch.setenv(str('PIP_INDEX_URL'), mock_index.url) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: From b091db995ff295d3d4ccc4717e401a1c134183a5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 16 Jan 2021 18:30:18 -0500 Subject: [PATCH 111/272] Exclude _distutils from flake8 also. --- .flake8 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index 5e1c7cae929..a8bbdd53a55 100644 --- a/.flake8 +++ b/.flake8 @@ -1,8 +1,9 @@ [flake8] max-line-length = 88 extend-exclude = - build/lib + build setuptools/_vendor + setuptools/_distutils pkg_resources/_vendor ignore = # W503 violates spec https://github.com/PyCQA/pycodestyle/issues/513 From b31105bdc855d75fc4f9fc7cfe005a81e7cc2f38 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 16 Jan 2021 18:47:18 -0500 Subject: [PATCH 112/272] Rely on tuple argument to endswith Co-authored-by: Sviatoslav Sydorenko --- pkg_resources/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index ba90c8c4abf..a304647fd0c 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -1984,7 +1984,7 @@ def find_eggs_in_zip(importer, path_item, only=False): dists = find_eggs_in_zip(zipimport.zipimporter(subpath), subpath) for dist in dists: yield dist - elif any(map(lower.endswith, ('.dist-info', '.egg-info'))): + elif subitem.lower().endswith(('.dist-info', '.egg-info')): subpath = os.path.join(path_item, subitem) submeta = EggMetadata(zipimport.zipimporter(subpath)) submeta.egg_info = subpath From b994bc637e5817798f356bfd373011ab1d894216 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 16 Jan 2021 18:59:29 -0500 Subject: [PATCH 113/272] Remove unused variable --- pkg_resources/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 73f85459679..c84f1dd9e89 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -1981,7 +1981,6 @@ def find_eggs_in_zip(importer, path_item, only=False): # don't yield nested distros return for subitem in metadata.resource_listdir(''): - lower = subitem.lower() if _is_egg_path(subitem): subpath = os.path.join(path_item, subitem) dists = find_eggs_in_zip(zipimport.zipimporter(subpath), subpath) From d01d3ee286d4aab0ca0d78bd7a47b2556f81f499 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Dec 2020 11:21:30 -0500 Subject: [PATCH 114/272] Quick fix for #1390. Now description cannot contain a newline. --- changelog.d/1390.change.rst | 1 + setuptools/dist.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 changelog.d/1390.change.rst diff --git a/changelog.d/1390.change.rst b/changelog.d/1390.change.rst new file mode 100644 index 00000000000..fcb57f54c55 --- /dev/null +++ b/changelog.d/1390.change.rst @@ -0,0 +1 @@ +Newlines in metadata description/Summary now trigger a ValueError. diff --git a/setuptools/dist.py b/setuptools/dist.py index 662fbe67c59..2d0aac333d3 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -118,6 +118,13 @@ def _read_list(name): self.obsoletes = None +def single_line(val): + # quick and dirty validation for description pypa/setuptools#1390 + if '\n' in val: + raise ValueError("newlines not allowed") + return val + + # Based on Python 3.5 version def write_pkg_file(self, file): # noqa: C901 # is too complex (14) # FIXME """Write the PKG-INFO format data to a file object. @@ -130,7 +137,7 @@ def write_field(key, value): write_field('Metadata-Version', str(version)) write_field('Name', self.get_name()) write_field('Version', self.get_version()) - write_field('Summary', self.get_description()) + write_field('Summary', single_line(self.get_description())) write_field('Home-page', self.get_url()) if version < StrictVersion('1.2'): From dc051ceb9071b7bc93fb8a3eaa8afc3ad57d5490 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 16 Jan 2021 19:14:43 -0500 Subject: [PATCH 115/272] =?UTF-8?q?Bump=20version:=2051.2.0=20=E2=86=92=20?= =?UTF-8?q?51.3.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 14 ++++++++++++++ changelog.d/1390.change.rst | 1 - changelog.d/2481.change.rst | 2 -- changelog.d/2489.change.rst | 2 -- changelog.d/2529.change.rst | 1 - setup.cfg | 2 +- 7 files changed, 16 insertions(+), 8 deletions(-) delete mode 100644 changelog.d/1390.change.rst delete mode 100644 changelog.d/2481.change.rst delete mode 100644 changelog.d/2489.change.rst delete mode 100644 changelog.d/2529.change.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index facadd5f3b8..0789cb98470 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 51.2.0 +current_version = 51.3.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index e51b5e646c8..48669d992ca 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,17 @@ +v51.3.0 +------- + + +Changes +^^^^^^^ +* #1390: Newlines in metadata description/Summary now trigger a ValueError. +* #2481: Define ``create_module()`` and ``exec_module()`` methods in ``VendorImporter`` + to get rid of ``ImportWarning`` -- by :user:`hroncok` +* #2489: ``pkg_resources`` behavior for zipimport now matches the regular behavior, and finds + ``.egg-info`` (previoulsy would only find ``.dist-info``) -- by :user:`thatch` +* #2529: Fixed an issue where version tags may be added multiple times + + v51.2.0 ------- diff --git a/changelog.d/1390.change.rst b/changelog.d/1390.change.rst deleted file mode 100644 index fcb57f54c55..00000000000 --- a/changelog.d/1390.change.rst +++ /dev/null @@ -1 +0,0 @@ -Newlines in metadata description/Summary now trigger a ValueError. diff --git a/changelog.d/2481.change.rst b/changelog.d/2481.change.rst deleted file mode 100644 index dc824c9c2ed..00000000000 --- a/changelog.d/2481.change.rst +++ /dev/null @@ -1,2 +0,0 @@ -Define ``create_module()`` and ``exec_module()`` methods in ``VendorImporter`` -to get rid of ``ImportWarning`` -- by :user:`hroncok` diff --git a/changelog.d/2489.change.rst b/changelog.d/2489.change.rst deleted file mode 100644 index 40eddbe7349..00000000000 --- a/changelog.d/2489.change.rst +++ /dev/null @@ -1,2 +0,0 @@ -``pkg_resources`` behavior for zipimport now matches the regular behavior, and finds -``.egg-info`` (previoulsy would only find ``.dist-info``) -- by :user:`thatch` diff --git a/changelog.d/2529.change.rst b/changelog.d/2529.change.rst deleted file mode 100644 index 10c41518d40..00000000000 --- a/changelog.d/2529.change.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed an issue where version tags may be added multiple times diff --git a/setup.cfg b/setup.cfg index 4e7312a1073..43c4f23b6f5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 51.2.0 +version = 51.3.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 5156278555fa20234db59f81097bee8cd7b5aaf4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 16 Jan 2021 22:05:43 -0500 Subject: [PATCH 116/272] Revert "Merge pull request #2533 from pypa/fix/2529" This reverts commit ef457b2e4eb215ab9d730afbd61a10ed3b118d3c, reversing changes made to d2b1f7ebd6ebd57b4a50bc6660e93b31129bacb4. --- setuptools/command/egg_info.py | 10 ++-- setuptools/tests/test_egg_info.py | 84 +++++++++++++------------------ 2 files changed, 38 insertions(+), 56 deletions(-) diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index bb472036022..1f120b67d18 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -131,12 +131,10 @@ def _maybe_tag(self, version): egg_info may be called more than once for a distribution, in which case the version string already contains all tags. """ - # Remove the tags if they exist. The tags maybe have been normalized - # (e.g. turning .dev into .dev0) so we can't just compare strings - base_version = parse_version(version).base_version - - # Add the tags - return base_version + self.vtags + return ( + version if self.vtags and version.endswith(self.vtags) + else version + self.vtags + ) def tags(self): version = '' diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index 1d0f07e3067..1047468b185 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -6,7 +6,6 @@ import stat import time -from setuptools.build_meta import prepare_metadata_for_build_wheel from setuptools.command.egg_info import ( egg_info, manifest_maker, EggInfoDeprecationWarning, get_pkg_info_revision, ) @@ -20,26 +19,6 @@ from . import contexts -def _run_egg_info_command(tmpdir_cwd, env, cmd=None, output=None): - environ = os.environ.copy().update( - HOME=env.paths['home'], - ) - if cmd is None: - cmd = [ - 'egg_info', - ] - code, data = environment.run_setup_py( - cmd=cmd, - pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]), - data_stream=1, - env=environ, - ) - assert not code, data - - if output: - assert output in data - - class Environment(str): pass @@ -153,7 +132,7 @@ def test_egg_info_save_version_info_setup_defaults(self, tmpdir_cwd, env): def test_expected_files_produced(self, tmpdir_cwd, env): self._create_project() - _run_egg_info_command(tmpdir_cwd, env) + self._run_egg_info_command(tmpdir_cwd, env) actual = os.listdir('foo.egg-info') expected = [ @@ -187,7 +166,7 @@ def test_license_is_a_string(self, tmpdir_cwd, env): # currently configured to use a subprocess, the actual traceback # object is lost and we need to parse it from stderr with pytest.raises(AssertionError) as exc: - _run_egg_info_command(tmpdir_cwd, env) + self._run_egg_info_command(tmpdir_cwd, env) # Hopefully this is not too fragile: the only argument to the # assertion error should be a traceback, ending with: @@ -201,13 +180,13 @@ def test_rebuilt(self, tmpdir_cwd, env): """Ensure timestamps are updated when the command is re-run.""" self._create_project() - _run_egg_info_command(tmpdir_cwd, env) + self._run_egg_info_command(tmpdir_cwd, env) timestamp_a = os.path.getmtime('foo.egg-info') # arbitrary sleep just to handle *really* fast systems time.sleep(.001) - _run_egg_info_command(tmpdir_cwd, env) + self._run_egg_info_command(tmpdir_cwd, env) timestamp_b = os.path.getmtime('foo.egg-info') assert timestamp_a != timestamp_b @@ -222,7 +201,7 @@ def test_manifest_template_is_read(self, tmpdir_cwd, env): 'usage.rst': "Run 'hi'", } }) - _run_egg_info_command(tmpdir_cwd, env) + self._run_egg_info_command(tmpdir_cwd, env) egg_info_dir = os.path.join('.', 'foo.egg-info') sources_txt = os.path.join(egg_info_dir, 'SOURCES.txt') with open(sources_txt) as f: @@ -462,7 +441,7 @@ def test_requires( self, tmpdir_cwd, env, requires, use_setup_cfg, expected_requires, install_cmd_kwargs): self._setup_script_with_requires(requires, use_setup_cfg) - _run_egg_info_command(tmpdir_cwd, env, **install_cmd_kwargs) + self._run_egg_info_command(tmpdir_cwd, env, **install_cmd_kwargs) egg_info_dir = os.path.join('.', 'foo.egg-info') requires_txt = os.path.join(egg_info_dir, 'requires.txt') if os.path.exists(requires_txt): @@ -482,14 +461,14 @@ def test_install_requires_unordered_disallowed(self, tmpdir_cwd, env): req = 'install_requires={"fake-factory==0.5.2", "pytz"}' self._setup_script_with_requires(req) with pytest.raises(AssertionError): - _run_egg_info_command(tmpdir_cwd, env) + self._run_egg_info_command(tmpdir_cwd, env) def test_extras_require_with_invalid_marker(self, tmpdir_cwd, env): tmpl = 'extras_require={{":{marker}": ["barbazquux"]}},' req = tmpl.format(marker=self.invalid_marker) self._setup_script_with_requires(req) with pytest.raises(AssertionError): - _run_egg_info_command(tmpdir_cwd, env) + self._run_egg_info_command(tmpdir_cwd, env) assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == [] def test_extras_require_with_invalid_marker_in_req(self, tmpdir_cwd, env): @@ -497,7 +476,7 @@ def test_extras_require_with_invalid_marker_in_req(self, tmpdir_cwd, env): req = tmpl.format(marker=self.invalid_marker) self._setup_script_with_requires(req) with pytest.raises(AssertionError): - _run_egg_info_command(tmpdir_cwd, env) + self._run_egg_info_command(tmpdir_cwd, env) assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == [] def test_provides_extra(self, tmpdir_cwd, env): @@ -886,22 +865,26 @@ def test_egg_info_includes_setup_py(self, tmpdir_cwd): sources = f.read().split('\n') assert 'setup.py' in sources - @pytest.mark.parametrize( - ('make_metadata_path', 'run_command'), - [ - ( - lambda env: os.path.join('.', 'foo.egg-info', 'PKG-INFO'), - lambda tmpdir_cwd, env: _run_egg_info_command(tmpdir_cwd, env) - ), - ( - lambda env: os.path.join(env, 'foo.dist-info', 'METADATA'), - lambda tmpdir_cwd, env: prepare_metadata_for_build_wheel(env) - ) - ] - ) - def test_egg_info_tag_only_once( - self, tmpdir_cwd, env, make_metadata_path, run_command - ): + def _run_egg_info_command(self, tmpdir_cwd, env, cmd=None, output=None): + environ = os.environ.copy().update( + HOME=env.paths['home'], + ) + if cmd is None: + cmd = [ + 'egg_info', + ] + code, data = environment.run_setup_py( + cmd=cmd, + pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]), + data_stream=1, + env=environ, + ) + assert not code, data + + if output: + assert output in data + + def test_egg_info_tag_only_once(self, tmpdir_cwd, env): self._create_project() build_files({ 'setup.cfg': DALS(""" @@ -911,10 +894,11 @@ def test_egg_info_tag_only_once( tag_svn_revision = 0 """), }) - run_command(tmpdir_cwd, env) - with open(make_metadata_path(env)) as metadata_file: - metadata_lines = metadata_file.read().split('\n') - assert 'Version: 0.0.0.dev0' in metadata_lines + self._run_egg_info_command(tmpdir_cwd, env) + egg_info_dir = os.path.join('.', 'foo.egg-info') + with open(os.path.join(egg_info_dir, 'PKG-INFO')) as pkginfo_file: + pkg_info_lines = pkginfo_file.read().split('\n') + assert 'Version: 0.0.0.dev0' in pkg_info_lines def test_get_pkg_info_revision_deprecated(self): pytest.warns(EggInfoDeprecationWarning, get_pkg_info_revision) From 6b44f948ca40ee490c59d216a0e859d17431742a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 16 Jan 2021 22:09:51 -0500 Subject: [PATCH 117/272] =?UTF-8?q?Bump=20version:=2051.3.0=20=E2=86=92=20?= =?UTF-8?q?51.3.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 9 +++++++++ setup.cfg | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 0789cb98470..2cb50290ea0 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 51.3.0 +current_version = 51.3.1 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 48669d992ca..2be5fa2fac9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v51.3.1 +------- + + +Misc +^^^^ +* #2536: Reverted tag deduplication handling. + + v51.3.0 ------- diff --git a/setup.cfg b/setup.cfg index 43c4f23b6f5..aead43461bf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 51.3.0 +version = 51.3.1 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From fbb705406dca3e8a41ac6be4a28e1611102cac5c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 17 Jan 2021 01:36:19 -0500 Subject: [PATCH 118/272] Remove support for easy_install-based downloads for fetch_build_eggs (setup_requires). --- setuptools/installer.py | 46 +-------------------------- setuptools/tests/test_easy_install.py | 10 +++--- setuptools/tests/test_virtualenv.py | 5 --- 3 files changed, 5 insertions(+), 56 deletions(-) diff --git a/setuptools/installer.py b/setuptools/installer.py index c5822a31f4d..57e2b587aae 100644 --- a/setuptools/installer.py +++ b/setuptools/installer.py @@ -7,7 +7,6 @@ from distutils.errors import DistutilsError import pkg_resources -from setuptools.command.easy_install import easy_install from setuptools.wheel import Wheel @@ -19,54 +18,11 @@ def _fixup_find_links(find_links): return find_links -def _legacy_fetch_build_egg(dist, req): - """Fetch an egg needed for building. - - Legacy path using EasyInstall. - """ - tmp_dist = dist.__class__({'script_args': ['easy_install']}) - opts = tmp_dist.get_option_dict('easy_install') - opts.clear() - opts.update( - (k, v) - for k, v in dist.get_option_dict('easy_install').items() - if k in ( - # don't use any other settings - 'find_links', 'site_dirs', 'index_url', - 'optimize', 'site_dirs', 'allow_hosts', - )) - if dist.dependency_links: - links = dist.dependency_links[:] - if 'find_links' in opts: - links = _fixup_find_links(opts['find_links'][1]) + links - opts['find_links'] = ('setup', links) - install_dir = dist.get_egg_cache_dir() - cmd = easy_install( - tmp_dist, args=["x"], install_dir=install_dir, - exclude_scripts=True, - always_copy=False, build_directory=None, editable=False, - upgrade=False, multi_version=True, no_report=True, user=False - ) - cmd.ensure_finalized() - return cmd.easy_install(req) - - def fetch_build_egg(dist, req): # noqa: C901 # is too complex (16) # FIXME """Fetch an egg needed for building. Use pip/wheel to fetch/build a wheel.""" - # Check pip is available. - try: - pkg_resources.get_distribution('pip') - except pkg_resources.DistributionNotFound: - dist.announce( - 'WARNING: The pip package is not available, falling back ' - 'to EasyInstall for handling setup_requires/test_requires; ' - 'this is deprecated and will be removed in a future version.', - log.WARN - ) - return _legacy_fetch_build_egg(dist, req) - # Warn if wheel is not. + # Warn if wheel is not available try: pkg_resources.get_distribution('wheel') except pkg_resources.DistributionNotFound: diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 6aa17e94141..3340a59c243 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -742,10 +742,10 @@ def test_setup_requires_with_python_requires(self, monkeypatch, tmpdir): assert eggs == ['dep 1.0'] @pytest.mark.parametrize( - 'use_legacy_installer,with_dependency_links_in_setup_py', - itertools.product((False, True), (False, True))) + 'with_dependency_links_in_setup_py', + (False, True)) def test_setup_requires_with_find_links_in_setup_cfg( - self, monkeypatch, use_legacy_installer, + self, monkeypatch, with_dependency_links_in_setup_py): monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) @@ -767,11 +767,9 @@ def test_setup_requires_with_find_links_in_setup_cfg( fp.write(DALS( ''' from setuptools import installer, setup - if {use_legacy_installer}: - installer.fetch_build_egg = installer._legacy_fetch_build_egg setup(setup_requires='python-xlib==42', dependency_links={dependency_links!r}) - ''').format(use_legacy_installer=use_legacy_installer, # noqa + ''').format( dependency_links=dependency_links)) with open(test_setup_cfg, 'w') as fp: fp.write(DALS( diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index 5a942d84c54..8681ed27412 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -186,11 +186,6 @@ def test_test_command_install_requirements(virtualenv, tmpdir): _check_test_command_install_requirements(virtualenv, tmpdir) -def test_test_command_install_requirements_when_using_easy_install( - bare_virtualenv, tmpdir): - _check_test_command_install_requirements(bare_virtualenv, tmpdir) - - def test_no_missing_dependencies(bare_virtualenv): """ Quick and dirty test to ensure all external dependencies are vendored. From 2f891b433c42eb1554644199058c9190790ebf85 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 17 Jan 2021 12:14:25 -0500 Subject: [PATCH 119/272] Repair Descriptions with newlines and emit a warning that the value will be disallowed in the future. --- changelog.d/1390.misc.rst | 1 + setuptools/dist.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/1390.misc.rst diff --git a/changelog.d/1390.misc.rst b/changelog.d/1390.misc.rst new file mode 100644 index 00000000000..5e4fb11488d --- /dev/null +++ b/changelog.d/1390.misc.rst @@ -0,0 +1 @@ +Validation of Description field now is more lenient, emitting a warning and mangling the value to be valid (replacing newlines with spaces). diff --git a/setuptools/dist.py b/setuptools/dist.py index 2d0aac333d3..172d66b1f4a 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -121,7 +121,9 @@ def _read_list(name): def single_line(val): # quick and dirty validation for description pypa/setuptools#1390 if '\n' in val: - raise ValueError("newlines not allowed") + # TODO after 2021-07-31: Replace with `raise ValueError("newlines not allowed")` + warnings.UserWarning("newlines not allowed and will break in the future") + val = val.replace('\n', ' ') return val From c5e0397b231f36d6349357a33c48618f82facb58 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 17 Jan 2021 13:35:16 -0500 Subject: [PATCH 120/272] =?UTF-8?q?Bump=20version:=2051.3.1=20=E2=86=92=20?= =?UTF-8?q?51.3.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 9 +++++++++ changelog.d/1390.misc.rst | 1 - setup.cfg | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/1390.misc.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 2cb50290ea0..4d607217411 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 51.3.1 +current_version = 51.3.2 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 2be5fa2fac9..2de874ca960 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v51.3.2 +------- + + +Misc +^^^^ +* #1390: Validation of Description field now is more lenient, emitting a warning and mangling the value to be valid (replacing newlines with spaces). + + v51.3.1 ------- diff --git a/changelog.d/1390.misc.rst b/changelog.d/1390.misc.rst deleted file mode 100644 index 5e4fb11488d..00000000000 --- a/changelog.d/1390.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Validation of Description field now is more lenient, emitting a warning and mangling the value to be valid (replacing newlines with spaces). diff --git a/setup.cfg b/setup.cfg index aead43461bf..2476ede8b04 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 51.3.1 +version = 51.3.2 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 9d61fdd3078805cad8ccd84c769a8a27e033a1a8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 17 Jan 2021 13:37:03 -0500 Subject: [PATCH 121/272] Add changelog. --- changelog.d/2537.breaking.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2537.breaking.rst diff --git a/changelog.d/2537.breaking.rst b/changelog.d/2537.breaking.rst new file mode 100644 index 00000000000..184d8e8758a --- /dev/null +++ b/changelog.d/2537.breaking.rst @@ -0,0 +1 @@ +Remove fallback support for fetch_build_eggs using easy_install. Now pip is required for setup_requires to succeed. From 49364a9eb82a986da1a1e6ad24022f7aac6e10d3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 17 Jan 2021 17:13:37 -0500 Subject: [PATCH 122/272] Fix AttributeError in Description validation. Fixes #2539. --- changelog.d/2539.misc.rst | 1 + setuptools/dist.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/2539.misc.rst diff --git a/changelog.d/2539.misc.rst b/changelog.d/2539.misc.rst new file mode 100644 index 00000000000..20114be805a --- /dev/null +++ b/changelog.d/2539.misc.rst @@ -0,0 +1 @@ +Fix AttributeError in Description validation. diff --git a/setuptools/dist.py b/setuptools/dist.py index 172d66b1f4a..050388de16e 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -122,7 +122,7 @@ def single_line(val): # quick and dirty validation for description pypa/setuptools#1390 if '\n' in val: # TODO after 2021-07-31: Replace with `raise ValueError("newlines not allowed")` - warnings.UserWarning("newlines not allowed and will break in the future") + warnings.warn("newlines not allowed and will break in the future") val = val.replace('\n', ' ') return val From 925b6be6796c185e5d832a89ce33fbe38c0df5f6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 17 Jan 2021 17:14:28 -0500 Subject: [PATCH 123/272] =?UTF-8?q?Bump=20version:=2051.3.2=20=E2=86=92=20?= =?UTF-8?q?51.3.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 9 +++++++++ changelog.d/2539.misc.rst | 1 - setup.cfg | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/2539.misc.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 4d607217411..debcfeeb642 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 51.3.2 +current_version = 51.3.3 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 2de874ca960..c094960f9aa 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v51.3.3 +------- + + +Misc +^^^^ +* #2539: Fix AttributeError in Description validation. + + v51.3.2 ------- diff --git a/changelog.d/2539.misc.rst b/changelog.d/2539.misc.rst deleted file mode 100644 index 20114be805a..00000000000 --- a/changelog.d/2539.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Fix AttributeError in Description validation. diff --git a/setup.cfg b/setup.cfg index 2476ede8b04..536ec70fabe 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 51.3.2 +version = 51.3.3 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From d3885f25e37b28fe5a50274a5db9819d5e2ce042 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Wed, 18 Nov 2020 18:38:02 +0100 Subject: [PATCH 124/272] Parallelize the test runs via pytest-xdist Resolves #2458 --- pytest.ini | 3 +++ setup.cfg | 1 + 2 files changed, 4 insertions(+) diff --git a/pytest.ini b/pytest.ini index 03fc773cf47..df30b822737 100644 --- a/pytest.ini +++ b/pytest.ini @@ -4,6 +4,9 @@ addopts= --doctest-modules --doctest-glob=pkg_resources/api_tests.txt -r sxX + + # `pytest-xdist`: + -n auto doctest_optionflags=ALLOW_UNICODE ELLIPSIS # workaround for warning pytest-dev/pytest#6178 junit_family=xunit2 diff --git a/setup.cfg b/setup.cfg index 536ec70fabe..bda5ab6f1b3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,6 +58,7 @@ testing = paver pip>=19.1 # For proper file:// URLs support. jaraco.envs + pytest-xdist docs = # Keep these in sync with docs/requirements.txt From c9188cbf991dbaac6d94b0dd57d3132760fc9e89 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 1 Jan 2021 02:24:08 +0100 Subject: [PATCH 125/272] Sanitize CWD out of sys.path in xdist mode --- setuptools/tests/test_build_meta.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 6d3a997ee06..b0455a62cc8 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -1,8 +1,10 @@ import os import shutil +import sys import tarfile import importlib from concurrent import futures +from contextlib import suppress import pytest @@ -44,6 +46,15 @@ def __init__(self, *args, **kwargs): def __call__(self, name, *args, **kw): """Handles aribrary function invocations on the build backend.""" + with suppress(ValueError): + # NOTE: pytest-xdist tends to inject '' into `sys.path` which + # NOTE: may break certain isolation expectations. To address + # NOTE: this, we remove this entry from there so the import + # NOTE: machinery behaves the same as in the default + # NOTE: sequential mode. + # Ref: https://github.com/pytest-dev/pytest-xdist/issues/376 + sys.path.remove('') + os.chdir(self.cwd) os.environ.update(self.env) mod = importlib.import_module(self.backend_name) From be6abaec7183e43c164be21112d0b57307748e1d Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 1 Jan 2021 02:26:30 +0100 Subject: [PATCH 126/272] Clarify `test_build_sdist_relative_path_import` --- setuptools/tests/test_build_meta.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index b0455a62cc8..63c7c275b3c 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -349,6 +349,7 @@ def test_build_sdist_relative_path_import(self, tmpdir_cwd): build_files(self._relative_path_import_files) build_backend = self.get_build_backend() with pytest.raises(ImportError): + with pytest.raises(ImportError, match="^No module named 'hello'$"): build_backend.build_sdist("temp") @pytest.mark.parametrize('setup_literal, requirements', [ From 8a7a014b8abebcbec942a12d5c63759ada956802 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 1 Jan 2021 02:27:43 +0100 Subject: [PATCH 127/272] Make `get_build_backend` cwd path customizable --- setuptools/tests/test_build_meta.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 63c7c275b3c..a117a9bebae 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -136,8 +136,10 @@ def run(): class TestBuildMetaBackend: backend_name = 'setuptools.build_meta' - def get_build_backend(self): - return BuildBackend(cwd='.', backend_name=self.backend_name) + def get_build_backend(self, cwd_path=None): + if cwd_path is None: + cwd_path = '.' + return BuildBackend(cwd=cwd_path, backend_name=self.backend_name) @pytest.fixture(params=defns) def build_backend(self, tmpdir, request): From 08ded165701faff86313674b8ee92730902e7a3c Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 1 Jan 2021 02:28:22 +0100 Subject: [PATCH 128/272] Replace `tmpdir_cwd` fixture with `tmp_path` --- setuptools/tests/test_build_meta.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index a117a9bebae..3f1ba0465fb 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -347,12 +347,11 @@ def test_build_sdist_builds_targz_even_if_zip_indicated(self, tmpdir_cwd): """) } - def test_build_sdist_relative_path_import(self, tmpdir_cwd): - build_files(self._relative_path_import_files) - build_backend = self.get_build_backend() - with pytest.raises(ImportError): + def test_build_sdist_relative_path_import(self, tmp_path): + build_files(self._relative_path_import_files, prefix=str(tmp_path)) + build_backend = self.get_build_backend(cwd_path=tmp_path) with pytest.raises(ImportError, match="^No module named 'hello'$"): - build_backend.build_sdist("temp") + build_backend.build_sdist(tmp_path / "temp") @pytest.mark.parametrize('setup_literal, requirements', [ ("'foo'", ['foo']), From 2e077b73e8a391f460b365382408d70439494d43 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 1 Jan 2021 23:10:35 +0100 Subject: [PATCH 129/272] Make `test_pip_upgrade_from_source` xdist-friendly --- setuptools/tests/fixtures.py | 28 ++++++++++++++++++++++++++++ setuptools/tests/test_virtualenv.py | 4 ++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py index e8cb7f52376..0480033c5b2 100644 --- a/setuptools/tests/fixtures.py +++ b/setuptools/tests/fixtures.py @@ -1,8 +1,14 @@ +import pathlib +import shutil + import pytest from . import contexts +SRC_DIR = pathlib.Path(__file__).parents[2] + + @pytest.fixture def user_override(monkeypatch): """ @@ -21,3 +27,25 @@ def user_override(monkeypatch): def tmpdir_cwd(tmpdir): with tmpdir.as_cwd() as orig: yield orig + + +@pytest.fixture +def src_dir(): + """The project source directory available via fixture.""" + return SRC_DIR + + +@pytest.fixture +def tmp_src(src_dir, tmp_path): + """Make a copy of the source dir under `$tmp/src`. + + This fixture is useful whenever it's necessary to run `setup.py` + or `pip install` against the source directory when there's no + control over the number of simultaneous invocations. Such + concurrent runs create and delete directories with the same names + under the target directory and so they influence each other's runs + when they are not being executed sequentially. + """ + tmp_src_path = tmp_path / 'src' + shutil.copytree(src_dir, tmp_src_path) + return tmp_src_path diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index 5a942d84c54..79468b1baa6 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -85,7 +85,7 @@ def _get_pip_versions(): @pytest.mark.parametrize('pip_version', _get_pip_versions()) -def test_pip_upgrade_from_source(pip_version, virtualenv): +def test_pip_upgrade_from_source(pip_version, tmp_src, virtualenv): """ Check pip can upgrade setuptools from source. """ @@ -104,7 +104,7 @@ def test_pip_upgrade_from_source(pip_version, virtualenv): virtualenv.run(' && '.join(( 'python setup.py -q sdist -d {dist}', 'python setup.py -q bdist_wheel -d {dist}', - )).format(dist=dist_dir), cd=SOURCE_DIR) + )).format(dist=dist_dir), cd=tmp_src) sdist = glob.glob(os.path.join(dist_dir, '*.zip'))[0] wheel = glob.glob(os.path.join(dist_dir, '*.whl'))[0] # Then update from wheel. From fecbc2d2b439385bfee6ac52fa004a61ccde35f6 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 1 Jan 2021 23:54:14 +0100 Subject: [PATCH 130/272] Isolate src for `test_distutils_adoption` --- setuptools/tests/test_distutils_adoption.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setuptools/tests/test_distutils_adoption.py b/setuptools/tests/test_distutils_adoption.py index a53773df8cb..0e89921c904 100644 --- a/setuptools/tests/test_distutils_adoption.py +++ b/setuptools/tests/test_distutils_adoption.py @@ -21,10 +21,10 @@ def run(self, cmd, *args, **kwargs): @pytest.fixture -def venv(tmpdir): +def venv(tmp_path, tmp_src): env = VirtualEnv() - env.root = path.Path(tmpdir) - env.req = os.getcwd() + env.root = path.Path(tmp_path / 'venv') + env.req = str(tmp_src) return env.create() From 5f3d12316dc4e3c3f638786668cee38ff5a73bd3 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 2 Jan 2021 00:15:33 +0100 Subject: [PATCH 131/272] Use tmp src copy in `test_clean_env_install` --- setuptools/tests/test_virtualenv.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index 79468b1baa6..d72dcbd0e5a 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -43,11 +43,11 @@ def bare_virtualenv(): SOURCE_DIR = os.path.join(os.path.dirname(__file__), '../..') -def test_clean_env_install(bare_virtualenv): +def test_clean_env_install(bare_virtualenv, tmp_src): """ Check setuptools can be installed in a clean environment. """ - bare_virtualenv.run(['python', 'setup.py', 'install'], cd=SOURCE_DIR) + bare_virtualenv.run(['python', 'setup.py', 'install'], cd=tmp_src) def _get_pip_versions(): From 7fe4a4054a92782a434d25d4ff85231537892c7f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 17 Jan 2021 21:42:33 -0500 Subject: [PATCH 132/272] Rely on pytest-enabler to enable pytest-xdist when present and enabled. --- pyproject.toml | 3 +++ pytest.ini | 3 --- setup.cfg | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0bc2a46f4fb..4e80bdc1a7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,9 @@ addopts = "--flake8" [pytest.enabler.cov] addopts = "--cov" +[pytest.enabler.xdist] +addopts = "-n auto" + [tool.towncrier] package = "setuptools" package_dir = "setuptools" diff --git a/pytest.ini b/pytest.ini index df30b822737..03fc773cf47 100644 --- a/pytest.ini +++ b/pytest.ini @@ -4,9 +4,6 @@ addopts= --doctest-modules --doctest-glob=pkg_resources/api_tests.txt -r sxX - - # `pytest-xdist`: - -n auto doctest_optionflags=ALLOW_UNICODE ELLIPSIS # workaround for warning pytest-dev/pytest#6178 junit_family=xunit2 diff --git a/setup.cfg b/setup.cfg index bda5ab6f1b3..36c7daeebc0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -47,7 +47,7 @@ testing = pytest-black >= 0.3.7; python_implementation != "PyPy" pytest-cov pytest-mypy; python_implementation != "PyPy" - pytest-enabler + pytest-enabler >= 1.0.1 # local mock From 3c8e758caa11abe63040058ba136a68d2b620ea3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 17 Jan 2021 21:49:57 -0500 Subject: [PATCH 133/272] Avoid indirection in src_dir --- setuptools/tests/fixtures.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py index 0480033c5b2..4a990eb950e 100644 --- a/setuptools/tests/fixtures.py +++ b/setuptools/tests/fixtures.py @@ -6,9 +6,6 @@ from . import contexts -SRC_DIR = pathlib.Path(__file__).parents[2] - - @pytest.fixture def user_override(monkeypatch): """ @@ -32,7 +29,7 @@ def tmpdir_cwd(tmpdir): @pytest.fixture def src_dir(): """The project source directory available via fixture.""" - return SRC_DIR + return pathlib.Path(__file__).parents[2] @pytest.fixture From 31b0896bba77f21984dfad5a0b82fcd57bda9658 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 18 Jan 2021 10:30:11 -0500 Subject: [PATCH 134/272] Rely on rootdir to determine the source. Avoids coupling with position in the test suite. --- setuptools/tests/fixtures.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py index 4a990eb950e..d975c0fc5b9 100644 --- a/setuptools/tests/fixtures.py +++ b/setuptools/tests/fixtures.py @@ -1,4 +1,3 @@ -import pathlib import shutil import pytest @@ -27,13 +26,7 @@ def tmpdir_cwd(tmpdir): @pytest.fixture -def src_dir(): - """The project source directory available via fixture.""" - return pathlib.Path(__file__).parents[2] - - -@pytest.fixture -def tmp_src(src_dir, tmp_path): +def tmp_src(request, tmp_path): """Make a copy of the source dir under `$tmp/src`. This fixture is useful whenever it's necessary to run `setup.py` @@ -44,5 +37,5 @@ def tmp_src(src_dir, tmp_path): when they are not being executed sequentially. """ tmp_src_path = tmp_path / 'src' - shutil.copytree(src_dir, tmp_src_path) + shutil.copytree(request.config.rootdir, tmp_src_path) return tmp_src_path From f767b4f59b14aa94d7c085173cb9360ba2d187eb Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 18 Jan 2021 10:48:38 -0500 Subject: [PATCH 135/272] Extract workaround for pytest-dev/pytest-xdist#376 as a fixture. Invoke the repair at the session level and only when xdist is present. --- setuptools/tests/fixtures.py | 19 +++++++++++++++++++ setuptools/tests/test_build_meta.py | 11 ----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py index d975c0fc5b9..d74b5f031ac 100644 --- a/setuptools/tests/fixtures.py +++ b/setuptools/tests/fixtures.py @@ -1,3 +1,5 @@ +import contextlib +import sys import shutil import pytest @@ -39,3 +41,20 @@ def tmp_src(request, tmp_path): tmp_src_path = tmp_path / 'src' shutil.copytree(request.config.rootdir, tmp_src_path) return tmp_src_path + + +@pytest.fixture(autouse=True, scope="session") +def workaround_xdist_376(request): + """ + Workaround pytest-dev/pytest-xdist#376 + + ``pytest-xdist`` tends to inject '' into ``sys.path``, + which may break certain isolation expectations. + Remove the entry so the import + machinery behaves the same irrespective of xdist. + """ + if not request.config.pluginmanager.has_plugin('xdist'): + return + + with contextlib.suppress(ValueError): + sys.path.remove('') diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 3f1ba0465fb..5dee8577078 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -1,10 +1,8 @@ import os import shutil -import sys import tarfile import importlib from concurrent import futures -from contextlib import suppress import pytest @@ -46,15 +44,6 @@ def __init__(self, *args, **kwargs): def __call__(self, name, *args, **kw): """Handles aribrary function invocations on the build backend.""" - with suppress(ValueError): - # NOTE: pytest-xdist tends to inject '' into `sys.path` which - # NOTE: may break certain isolation expectations. To address - # NOTE: this, we remove this entry from there so the import - # NOTE: machinery behaves the same as in the default - # NOTE: sequential mode. - # Ref: https://github.com/pytest-dev/pytest-xdist/issues/376 - sys.path.remove('') - os.chdir(self.cwd) os.environ.update(self.env) mod = importlib.import_module(self.backend_name) From daf01571d508234fcff707b1a1156c7496c0c131 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 18 Jan 2021 11:02:06 -0500 Subject: [PATCH 136/272] Simplify get_build_backend to simply allow override of cwd. --- setuptools/tests/test_build_meta.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 5dee8577078..5331e2f8af6 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -11,7 +11,7 @@ class BuildBackendBase: - def __init__(self, cwd=None, env={}, backend_name='setuptools.build_meta'): + def __init__(self, cwd='.', env={}, backend_name='setuptools.build_meta'): self.cwd = cwd self.env = env self.backend_name = backend_name @@ -125,10 +125,8 @@ def run(): class TestBuildMetaBackend: backend_name = 'setuptools.build_meta' - def get_build_backend(self, cwd_path=None): - if cwd_path is None: - cwd_path = '.' - return BuildBackend(cwd=cwd_path, backend_name=self.backend_name) + def get_build_backend(self, **kwargs): + return BuildBackend(backend_name=self.backend_name, **kwargs) @pytest.fixture(params=defns) def build_backend(self, tmpdir, request): @@ -338,7 +336,7 @@ def test_build_sdist_builds_targz_even_if_zip_indicated(self, tmpdir_cwd): def test_build_sdist_relative_path_import(self, tmp_path): build_files(self._relative_path_import_files, prefix=str(tmp_path)) - build_backend = self.get_build_backend(cwd_path=tmp_path) + build_backend = self.get_build_backend(cwd=tmp_path) with pytest.raises(ImportError, match="^No module named 'hello'$"): build_backend.build_sdist(tmp_path / "temp") From 77aefc128699182e5b1271162f0b7c557d81b1d5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 18 Jan 2021 11:22:05 -0500 Subject: [PATCH 137/272] Restore test_build_sdist_relative_path_import to its former simple implementation. --- setuptools/tests/test_build_meta.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 5331e2f8af6..e117d8e6295 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -125,8 +125,8 @@ def run(): class TestBuildMetaBackend: backend_name = 'setuptools.build_meta' - def get_build_backend(self, **kwargs): - return BuildBackend(backend_name=self.backend_name, **kwargs) + def get_build_backend(self): + return BuildBackend(backend_name=self.backend_name) @pytest.fixture(params=defns) def build_backend(self, tmpdir, request): @@ -334,11 +334,11 @@ def test_build_sdist_builds_targz_even_if_zip_indicated(self, tmpdir_cwd): """) } - def test_build_sdist_relative_path_import(self, tmp_path): - build_files(self._relative_path_import_files, prefix=str(tmp_path)) - build_backend = self.get_build_backend(cwd=tmp_path) + def test_build_sdist_relative_path_import(self, tmpdir_cwd): + build_files(self._relative_path_import_files) + build_backend = self.get_build_backend() with pytest.raises(ImportError, match="^No module named 'hello'$"): - build_backend.build_sdist(tmp_path / "temp") + build_backend.build_sdist("temp") @pytest.mark.parametrize('setup_literal, requirements', [ ("'foo'", ['foo']), From 347f7497d9668049b50a26c381dc661c2b641a7b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 18 Jan 2021 11:29:28 -0500 Subject: [PATCH 138/272] Simplify and enhance tests in test_build_meta. Ref #2459. --- setuptools/tests/test_build_meta.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 6d3a997ee06..e117d8e6295 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -11,7 +11,7 @@ class BuildBackendBase: - def __init__(self, cwd=None, env={}, backend_name='setuptools.build_meta'): + def __init__(self, cwd='.', env={}, backend_name='setuptools.build_meta'): self.cwd = cwd self.env = env self.backend_name = backend_name @@ -126,7 +126,7 @@ class TestBuildMetaBackend: backend_name = 'setuptools.build_meta' def get_build_backend(self): - return BuildBackend(cwd='.', backend_name=self.backend_name) + return BuildBackend(backend_name=self.backend_name) @pytest.fixture(params=defns) def build_backend(self, tmpdir, request): @@ -337,7 +337,7 @@ def test_build_sdist_builds_targz_even_if_zip_indicated(self, tmpdir_cwd): def test_build_sdist_relative_path_import(self, tmpdir_cwd): build_files(self._relative_path_import_files) build_backend = self.get_build_backend() - with pytest.raises(ImportError): + with pytest.raises(ImportError, match="^No module named 'hello'$"): build_backend.build_sdist("temp") @pytest.mark.parametrize('setup_literal, requirements', [ From 3b571b08feda091838f55d6d0ec3a72325264051 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 18 Jan 2021 12:08:11 -0500 Subject: [PATCH 139/272] Add changelog. --- changelog.d/2459.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2459.change.rst diff --git a/changelog.d/2459.change.rst b/changelog.d/2459.change.rst new file mode 100644 index 00000000000..3b8d11a9ed9 --- /dev/null +++ b/changelog.d/2459.change.rst @@ -0,0 +1 @@ +Tests now run in parallel via pytest-xdist, completing in about half the time. Special thanks to :user:`webknjaz` for hard work implementing test isolation. To run without parallelization, disable the plugin with ``tox -- -p no:xdist``. From 8222d6f7b992d3b184434acb31cd66b0f2e41401 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 18 Jan 2021 12:18:26 -0500 Subject: [PATCH 140/272] Prefer 'rootdir' for resolving the project root. --- setuptools/tests/test_virtualenv.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index d72dcbd0e5a..7aa88b83ff0 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -40,9 +40,6 @@ def bare_virtualenv(): yield venv -SOURCE_DIR = os.path.join(os.path.dirname(__file__), '../..') - - def test_clean_env_install(bare_virtualenv, tmp_src): """ Check setuptools can be installed in a clean environment. @@ -113,12 +110,12 @@ def test_pip_upgrade_from_source(pip_version, tmp_src, virtualenv): virtualenv.run('pip install --no-cache-dir --upgrade ' + sdist) -def _check_test_command_install_requirements(virtualenv, tmpdir): +def _check_test_command_install_requirements(virtualenv, tmpdir, cwd): """ Check the test command will install all required dependencies. """ # Install setuptools. - virtualenv.run('python setup.py develop', cd=SOURCE_DIR) + virtualenv.run('python setup.py develop', cd=cwd) def sdist(distname, version): dist_path = tmpdir.join('%s-%s.tar.gz' % (distname, version)) @@ -175,7 +172,7 @@ def sdist(distname, version): assert tmpdir.join('success').check() -def test_test_command_install_requirements(virtualenv, tmpdir): +def test_test_command_install_requirements(virtualenv, tmpdir, request): # Ensure pip/wheel packages are installed. virtualenv.run( "python -c \"__import__('pkg_resources').require(['pip', 'wheel'])\"") @@ -183,18 +180,19 @@ def test_test_command_install_requirements(virtualenv, tmpdir): virtualenv.run("python -m pip uninstall -y setuptools") # disable index URL so bits and bobs aren't requested from PyPI virtualenv.env['PIP_NO_INDEX'] = '1' - _check_test_command_install_requirements(virtualenv, tmpdir) + _check_test_command_install_requirements(virtualenv, tmpdir, request.config.rootdir) def test_test_command_install_requirements_when_using_easy_install( - bare_virtualenv, tmpdir): - _check_test_command_install_requirements(bare_virtualenv, tmpdir) + bare_virtualenv, tmpdir, request): + _check_test_command_install_requirements( + bare_virtualenv, tmpdir, request.config.rootdir) -def test_no_missing_dependencies(bare_virtualenv): +def test_no_missing_dependencies(bare_virtualenv, request): """ Quick and dirty test to ensure all external dependencies are vendored. """ for command in ('upload',): # sorted(distutils.command.__all__): - bare_virtualenv.run( - ['python', 'setup.py', command, '-h'], cd=SOURCE_DIR) + cmd = ['python', 'setup.py', command, '-h'] + bare_virtualenv.run(cmd, cd=request.config.rootdir) From 183a306ef87fd15df27dc4327182a944033ea3a0 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 19 Jan 2021 20:37:26 -0500 Subject: [PATCH 141/272] Remove bootstrap and tox-pip and instead rely on pep517. --- bootstrap.py | 57 --------------------------------------- pyproject.toml | 1 - setup.py | 12 --------- tools/tox_pip.py | 70 ------------------------------------------------ tox.ini | 6 ----- 5 files changed, 146 deletions(-) delete mode 100644 bootstrap.py delete mode 100644 tools/tox_pip.py diff --git a/bootstrap.py b/bootstrap.py deleted file mode 100644 index 118671f62c1..00000000000 --- a/bootstrap.py +++ /dev/null @@ -1,57 +0,0 @@ -""" -If setuptools is not already installed in the environment, it's not possible -to invoke setuptools' own commands. This routine will bootstrap this local -environment by creating a minimal egg-info directory and then invoking the -egg-info command to flesh out the egg-info directory. -""" - -import os -import sys -import textwrap -import subprocess -import io - - -minimal_egg_info = textwrap.dedent(""" - [distutils.commands] - egg_info = setuptools.command.egg_info:egg_info - - [distutils.setup_keywords] - include_package_data = setuptools.dist:assert_bool - install_requires = setuptools.dist:check_requirements - extras_require = setuptools.dist:check_extras - entry_points = setuptools.dist:check_entry_points - - [egg_info.writers] - PKG-INFO = setuptools.command.egg_info:write_pkg_info - dependency_links.txt = setuptools.command.egg_info:overwrite_arg - entry_points.txt = setuptools.command.egg_info:write_entries - requires.txt = setuptools.command.egg_info:write_requirements - """) - - -def ensure_egg_info(): - if os.path.exists('setuptools.egg-info'): - return - print("adding minimal entry_points") - add_minimal_info() - run_egg_info() - - -def add_minimal_info(): - """ - Build a minimal egg-info, enough to invoke egg_info - """ - - os.mkdir('setuptools.egg-info') - with io.open('setuptools.egg-info/entry_points.txt', 'w') as ep: - ep.write(minimal_egg_info) - - -def run_egg_info(): - cmd = [sys.executable, 'setup.py', 'egg_info'] - print("Regenerating egg_info") - subprocess.check_call(cmd) - - -__name__ == '__main__' and ensure_egg_info() diff --git a/pyproject.toml b/pyproject.toml index 4e80bdc1a7e..414ffed581a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,5 @@ [build-system] requires = [ - # avoid self install on Python 2; ref #1996 "setuptools >= 40.8; python_version > '3'", "wheel", ] diff --git a/setup.py b/setup.py index 28d3dada34f..378fda1487f 100755 --- a/setup.py +++ b/setup.py @@ -10,17 +10,6 @@ here = os.path.dirname(__file__) -def require_metadata(): - "Prevent improper installs without necessary metadata. See #659" - egg_info_dir = os.path.join(here, 'setuptools.egg-info') - if not os.path.exists(egg_info_dir): - msg = ( - "Cannot build setuptools without metadata. " - "Run `bootstrap.py`." - ) - raise RuntimeError(msg) - - def read_commands(): command_ns = {} cmd_module_path = 'setuptools/command/__init__.py' @@ -189,5 +178,4 @@ def _restore_install_lib(self): if __name__ == '__main__': # allow setup.py to run from another directory here and os.chdir(here) - require_metadata() dist = setuptools.setup(**setup_params) diff --git a/tools/tox_pip.py b/tools/tox_pip.py deleted file mode 100644 index be2ff1d01d7..00000000000 --- a/tools/tox_pip.py +++ /dev/null @@ -1,70 +0,0 @@ -import os -import subprocess -import sys -import re - - -def remove_setuptools(): - """ - Remove setuptools from the current environment. - """ - print("Removing setuptools") - cmd = [sys.executable, '-m', 'pip', 'uninstall', '-y', 'setuptools'] - # set cwd to something other than '.' to avoid detecting - # '.' as the installed package. - subprocess.check_call(cmd, cwd=os.environ['TOX_WORK_DIR']) - - -def bootstrap(): - print("Running bootstrap") - cmd = [sys.executable, '-m', 'bootstrap'] - subprocess.check_call(cmd) - - -def is_install_self(args): - """ - Do the args represent an install of .? - """ - def strip_extras(arg): - match = re.match(r'(.*)?\[.*\]$', arg) - return match.group(1) if match else arg - - return ( - 'install' in args - and any( - arg in ['.', os.getcwd()] - for arg in map(strip_extras, args) - ) - ) - - -def pip(*args): - cmd = [sys.executable, '-m', 'pip'] + list(args) - return subprocess.check_call(cmd) - - -def test_dependencies(): - from ConfigParser import ConfigParser - - def clean(dep): - spec, _, _ = dep.partition('#') - return spec.strip() - - parser = ConfigParser() - parser.read('setup.cfg') - raw = parser.get('options.extras_require', 'tests').split('\n') - return filter(None, map(clean, raw)) - - -def run(args): - os.environ['PIP_USE_PEP517'] = 'true' - - if is_install_self(args): - remove_setuptools() - bootstrap() - - pip(*args) - - -if __name__ == '__main__': - run(sys.argv[1:]) diff --git a/tox.ini b/tox.ini index 8083d8c27b4..8ab2b8cf02f 100644 --- a/tox.ini +++ b/tox.ini @@ -11,8 +11,6 @@ commands = pytest {posargs} usedevelop = True extras = testing -install_command = {[helpers]pip} install {opts} {packages} -list_dependencies_command = {[helpers]pip} freeze --all setenv = COVERAGE_FILE={toxworkdir}/.coverage.{envname} passenv = @@ -74,7 +72,3 @@ commands = python -m twine upload dist/* python -m jaraco.develop.create-github-release python -m jaraco.tidelift.publish-release-notes - -[helpers] -# Custom pip behavior -pip = python {toxinidir}/tools/tox_pip.py From 6b628e370caa6cf42faea1253e005881adebf041 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 19 Jan 2021 21:05:31 -0500 Subject: [PATCH 142/272] Update changelog. Fixes #1527. --- changelog.d/1527.breaking.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1527.breaking.rst diff --git a/changelog.d/1527.breaking.rst b/changelog.d/1527.breaking.rst new file mode 100644 index 00000000000..7eb8a63f735 --- /dev/null +++ b/changelog.d/1527.breaking.rst @@ -0,0 +1 @@ +Removed bootstrap script. Now Setuptools requires pip or another pep517-compliant builder such as 'build' to build. Now Setuptools can be installed from Github main branch. From 71815558fb8cd44028d838b693f2083a3e969c74 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 19 Jan 2021 21:09:54 -0500 Subject: [PATCH 143/272] Remove bootstrap from docs build --- docs/conf.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 8cb959dfa3c..18cd7bdc490 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,11 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -import subprocess -import sys -import os - - extensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker'] master_doc = "index" @@ -82,14 +74,6 @@ } -# hack to run the bootstrap script so that jaraco.packaging.sphinx -# can invoke setup.py -'READTHEDOCS' in os.environ and subprocess.check_call( - [sys.executable, '-m', 'bootstrap'], - cwd=os.path.join(os.path.dirname(__file__), os.path.pardir), -) - - # Add support for linking usernames github_url = 'https://github.com' github_sponsors_url = f'{github_url}/sponsors' From fa81391fe65fa727f79f1be73f058e83ffe97193 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 20 Jan 2021 21:13:41 -0500 Subject: [PATCH 144/272] Remove eggsecutable --- setup.py | 2 -- setuptools/command/bdist_egg.py | 49 ++---------------------------- setuptools/command/easy_install.py | 10 ------ setuptools/tests/test_bdist_egg.py | 15 --------- 4 files changed, 2 insertions(+), 74 deletions(-) diff --git a/setup.py b/setup.py index 28d3dada34f..3d84c65ac47 100755 --- a/setup.py +++ b/setup.py @@ -171,8 +171,6 @@ def _restore_install_lib(self): "dependency_links.txt = setuptools.command.egg_info:overwrite_arg", ], "console_scripts": list(_gen_console_scripts()), - "setuptools.installation": - ['eggsecutable = setuptools.command.easy_install:bootstrap'], }, dependency_links=[ pypi_link( diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 206f2419ba1..e6b1609f7ba 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -2,7 +2,6 @@ Build .egg distributions""" -from distutils.errors import DistutilsSetupError from distutils.dir_util import remove_tree, mkpath from distutils import log from types import CodeType @@ -11,12 +10,10 @@ import re import textwrap import marshal -import warnings from pkg_resources import get_build_platform, Distribution, ensure_directory -from pkg_resources import EntryPoint from setuptools.extension import Library -from setuptools import Command, SetuptoolsDeprecationWarning +from setuptools import Command from sysconfig import get_path, get_python_version @@ -268,49 +265,7 @@ def zip_safe(self): return analyze_egg(self.bdist_dir, self.stubs) def gen_header(self): - epm = EntryPoint.parse_map(self.distribution.entry_points or '') - ep = epm.get('setuptools.installation', {}).get('eggsecutable') - if ep is None: - return 'w' # not an eggsecutable, do it the usual way. - - warnings.warn( - "Eggsecutables are deprecated and will be removed in a future " - "version.", - SetuptoolsDeprecationWarning - ) - - if not ep.attrs or ep.extras: - raise DistutilsSetupError( - "eggsecutable entry point (%r) cannot have 'extras' " - "or refer to a module" % (ep,) - ) - - pyver = '{}.{}'.format(*sys.version_info) - pkg = ep.module_name - full = '.'.join(ep.attrs) - base = ep.attrs[0] - basename = os.path.basename(self.egg_output) - - header = ( - "#!/bin/sh\n" - 'if [ `basename $0` = "%(basename)s" ]\n' - 'then exec python%(pyver)s -c "' - "import sys, os; sys.path.insert(0, os.path.abspath('$0')); " - "from %(pkg)s import %(base)s; sys.exit(%(full)s())" - '" "$@"\n' - 'else\n' - ' echo $0 is not the correct name for this egg file.\n' - ' echo Please rename it back to %(basename)s and try again.\n' - ' exec false\n' - 'fi\n' - ) % locals() - - if not self.dry_run: - mkpath(os.path.dirname(self.egg_output), dry_run=self.dry_run) - f = open(self.egg_output, 'w') - f.write(header) - f.close() - return 'a' + return 'w' def copy_metadata_to(self, target_dir): "Copy metadata (egg info) to the target_dir" diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index f1e487d4d21..544e8fd4445 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -2284,16 +2284,6 @@ def current_umask(): return tmp -def bootstrap(): - # This function is called when setuptools*.egg is run using /bin/sh - import setuptools - - argv0 = os.path.dirname(setuptools.__path__[0]) - sys.argv[0] = argv0 - sys.argv.append(argv0) - main() - - def main(argv=None, **kw): from setuptools import setup from setuptools.dist import Distribution diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py index 8760ea304c4..fb5b90b1a38 100644 --- a/setuptools/tests/test_bdist_egg.py +++ b/setuptools/tests/test_bdist_egg.py @@ -7,7 +7,6 @@ import pytest from setuptools.dist import Distribution -from setuptools import SetuptoolsDeprecationWarning from . import contexts @@ -65,17 +64,3 @@ def test_exclude_source_files(self, setup_context, user_override): names = list(zi.filename for zi in zip.filelist) assert 'hi.pyc' in names assert 'hi.py' not in names - - def test_eggsecutable_warning(self, setup_context, user_override): - dist = Distribution(dict( - script_name='setup.py', - script_args=['bdist_egg'], - name='foo', - py_modules=['hi'], - entry_points={ - 'setuptools.installation': - ['eggsecutable = my_package.some_module:main_func']}, - )) - dist.parse_command_line() - with pytest.warns(SetuptoolsDeprecationWarning): - dist.run_commands() From e3e7ff854038788d56d6d7f6624357b81341e876 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 23 Jan 2021 14:20:57 -0500 Subject: [PATCH 145/272] For compatibility, add a bootstrap script with a warning. --- bootstrap.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 bootstrap.py diff --git a/bootstrap.py b/bootstrap.py new file mode 100644 index 00000000000..229b9965037 --- /dev/null +++ b/bootstrap.py @@ -0,0 +1,7 @@ +import warnings + + +msg = "bootstrap.py is no longer needed. Use a PEP-517-compatible builder instead." + + +__name__ == '__main__' and warnings.warn(msg) From c0660de32f80ad71b3940abcb26b237ca2103876 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 23 Jan 2021 19:07:21 -0500 Subject: [PATCH 146/272] Update changelog. --- changelog.d/2545.breaking.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2545.breaking.rst diff --git a/changelog.d/2545.breaking.rst b/changelog.d/2545.breaking.rst new file mode 100644 index 00000000000..0c69fdf34d7 --- /dev/null +++ b/changelog.d/2545.breaking.rst @@ -0,0 +1 @@ +Removed support for eggsecutables. From 4b0408a18dcda286af6668b7ef6934e53d1f247c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 20 Jan 2021 21:02:24 -0500 Subject: [PATCH 147/272] Remove easy_install script and module. --- easy_install.py | 5 ----- setup.cfg | 1 - setup.py | 17 ----------------- setuptools/tests/test_namespaces.py | 5 +++-- 4 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 easy_install.py diff --git a/easy_install.py b/easy_install.py deleted file mode 100644 index d87e984034b..00000000000 --- a/easy_install.py +++ /dev/null @@ -1,5 +0,0 @@ -"""Run the EasyInstall command""" - -if __name__ == '__main__': - from setuptools.command.easy_install import main - main() diff --git a/setup.cfg b/setup.cfg index 36c7daeebc0..006851daac6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,7 +24,6 @@ project_urls = [options] packages = find_namespace: -py_modules = easy_install # disabled as it causes tests to be included #2505 # include_package_data = true python_requires = >=3.6 diff --git a/setup.py b/setup.py index 3d84c65ac47..31eda0fbb06 100755 --- a/setup.py +++ b/setup.py @@ -30,22 +30,6 @@ def read_commands(): return command_ns['__all__'] -def _gen_console_scripts(): - yield "easy_install = setuptools.command.easy_install:main" - - # Gentoo distributions manage the python-version-specific scripts - # themselves, so those platforms define an environment variable to - # suppress the creation of the version-specific scripts. - var_names = ( - 'SETUPTOOLS_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT', - 'DISTRIBUTE_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT', - ) - if any(os.environ.get(var) not in (None, "", "0") for var in var_names): - return - tmpl = "easy_install-{shortver} = setuptools.command.easy_install:main" - yield tmpl.format(shortver='{}.{}'.format(*sys.version_info)) - - package_data = dict( setuptools=['script (dev).tmpl', 'script.tmpl', 'site-patch.py'], ) @@ -170,7 +154,6 @@ def _restore_install_lib(self): "depends.txt = setuptools.command.egg_info:warn_depends_obsolete", "dependency_links.txt = setuptools.command.egg_info:overwrite_arg", ], - "console_scripts": list(_gen_console_scripts()), }, dependency_links=[ pypi_link( diff --git a/setuptools/tests/test_namespaces.py b/setuptools/tests/test_namespaces.py index 6c8c522dc07..270f90c98b0 100644 --- a/setuptools/tests/test_namespaces.py +++ b/setuptools/tests/test_namespaces.py @@ -62,8 +62,9 @@ def test_pkg_resources_import(self, tmpdir): target.mkdir() install_cmd = [ sys.executable, - '-m', 'easy_install', - '-d', str(target), + '-m', 'pip', + 'install', + '-t', str(target), str(pkg), ] with test.test.paths_on_pythonpath([str(target)]): From 2885ca26494e6f555fae85f8f9983c2361c93829 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 23 Jan 2021 19:35:27 -0500 Subject: [PATCH 148/272] Remove 'main' function from 'easy_install'. --- setuptools/command/easy_install.py | 46 +-------------------------- setuptools/tests/test_easy_install.py | 13 ++++---- 2 files changed, 7 insertions(+), 52 deletions(-) diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 544e8fd4445..eeb21b5083a 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -67,7 +67,7 @@ __all__ = [ 'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg', - 'main', 'get_exe_prefixes', + 'get_exe_prefixes', ] @@ -2284,50 +2284,6 @@ def current_umask(): return tmp -def main(argv=None, **kw): - from setuptools import setup - from setuptools.dist import Distribution - - class DistributionWithoutHelpCommands(Distribution): - common_usage = "" - - def _show_help(self, *args, **kw): - with _patch_usage(): - Distribution._show_help(self, *args, **kw) - - if argv is None: - argv = sys.argv[1:] - - with _patch_usage(): - setup( - script_args=['-q', 'easy_install', '-v'] + argv, - script_name=sys.argv[0] or 'easy_install', - distclass=DistributionWithoutHelpCommands, - **kw - ) - - -@contextlib.contextmanager -def _patch_usage(): - import distutils.core - USAGE = textwrap.dedent(""" - usage: %(script)s [options] requirement_or_url ... - or: %(script)s --help - """).lstrip() - - def gen_usage(script_name): - return USAGE % dict( - script=os.path.basename(script_name), - ) - - saved = distutils.core.gen_usage - distutils.core.gen_usage = gen_usage - try: - yield - finally: - distutils.core.gen_usage = saved - - class EasyInstallDeprecationWarning(SetuptoolsDeprecationWarning): """ Warning for EasyInstall deprecations, bypassing suppression. diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 3340a59c243..66598066d74 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -15,6 +15,7 @@ import mock import time import re +import subprocess import pytest @@ -25,7 +26,6 @@ EasyInstallDeprecationWarning, ScriptWriter, PthDistributions, WindowsScriptWriter, ) -from setuptools.command import easy_install as easy_install_pkg from setuptools.dist import Distribution from pkg_resources import normalize_path, working_set from pkg_resources import Distribution as PRDistribution @@ -461,17 +461,16 @@ def test_setup_requires_honors_fetch_params(self, mock_index, monkeypatch): with TestSetupRequires.create_sdist() as dist_file: with contexts.tempdir() as temp_install_dir: with contexts.environment(PYTHONPATH=temp_install_dir): - ei_params = [ + cmd = [ + sys.executable, + '-m', 'setup', + 'easy_install', '--index-url', mock_index.url, '--exclude-scripts', '--install-dir', temp_install_dir, dist_file, ] - with sandbox.save_argv(['easy_install']): - # attempt to install the dist. It should - # fail because it doesn't exist. - with pytest.raises(SystemExit): - easy_install_pkg.main(ei_params) + subprocess.Popen(cmd).wait() # there should have been one requests to the server assert [r.path for r in mock_index.requests] == ['/does-not-exist/'] From 4fb7735edd1cb7e746b7fb25fdba2aca145bde10 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 23 Jan 2021 19:48:03 -0500 Subject: [PATCH 149/272] Update changelog --- changelog.d/2544.breaking.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2544.breaking.rst diff --git a/changelog.d/2544.breaking.rst b/changelog.d/2544.breaking.rst new file mode 100644 index 00000000000..169c41b95e4 --- /dev/null +++ b/changelog.d/2544.breaking.rst @@ -0,0 +1 @@ +Removed 'easy_install' top-level model (runpy entry point) and 'easy_install' console script. From e1ffc2abbae4f2aa78dd09ee9827d754b7702b7b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 23 Jan 2021 19:49:42 -0500 Subject: [PATCH 150/272] =?UTF-8?q?Bump=20version:=2051.3.3=20=E2=86=92=20?= =?UTF-8?q?52.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 15 +++++++++++++++ changelog.d/2459.change.rst | 1 - changelog.d/2537.breaking.rst | 1 - changelog.d/2544.breaking.rst | 1 - changelog.d/2545.breaking.rst | 1 - setup.cfg | 2 +- 7 files changed, 17 insertions(+), 6 deletions(-) delete mode 100644 changelog.d/2459.change.rst delete mode 100644 changelog.d/2537.breaking.rst delete mode 100644 changelog.d/2544.breaking.rst delete mode 100644 changelog.d/2545.breaking.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index debcfeeb642..c3bdafab955 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 51.3.3 +current_version = 52.0.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index c094960f9aa..79941d8efe9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,18 @@ +v52.0.0 +------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ +* #2537: Remove fallback support for fetch_build_eggs using easy_install. Now pip is required for setup_requires to succeed. +* #2544: Removed 'easy_install' top-level model (runpy entry point) and 'easy_install' console script. +* #2545: Removed support for eggsecutables. + +Changes +^^^^^^^ +* #2459: Tests now run in parallel via pytest-xdist, completing in about half the time. Special thanks to :user:`webknjaz` for hard work implementing test isolation. To run without parallelization, disable the plugin with ``tox -- -p no:xdist``. + + v51.3.3 ------- diff --git a/changelog.d/2459.change.rst b/changelog.d/2459.change.rst deleted file mode 100644 index 3b8d11a9ed9..00000000000 --- a/changelog.d/2459.change.rst +++ /dev/null @@ -1 +0,0 @@ -Tests now run in parallel via pytest-xdist, completing in about half the time. Special thanks to :user:`webknjaz` for hard work implementing test isolation. To run without parallelization, disable the plugin with ``tox -- -p no:xdist``. diff --git a/changelog.d/2537.breaking.rst b/changelog.d/2537.breaking.rst deleted file mode 100644 index 184d8e8758a..00000000000 --- a/changelog.d/2537.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Remove fallback support for fetch_build_eggs using easy_install. Now pip is required for setup_requires to succeed. diff --git a/changelog.d/2544.breaking.rst b/changelog.d/2544.breaking.rst deleted file mode 100644 index 169c41b95e4..00000000000 --- a/changelog.d/2544.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Removed 'easy_install' top-level model (runpy entry point) and 'easy_install' console script. diff --git a/changelog.d/2545.breaking.rst b/changelog.d/2545.breaking.rst deleted file mode 100644 index 0c69fdf34d7..00000000000 --- a/changelog.d/2545.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Removed support for eggsecutables. diff --git a/setup.cfg b/setup.cfg index 006851daac6..e0c4edc2e6a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 51.3.3 +version = 52.0.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From c121d289da5d19cf6df2bf6b64ac28916a060161 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 1 Feb 2021 10:11:49 -0500 Subject: [PATCH 151/272] =?UTF-8?q?Bump=20version:=2052.0.0=20=E2=86=92=20?= =?UTF-8?q?53.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 9 +++++++++ changelog.d/1527.breaking.rst | 1 - setup.cfg | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/1527.breaking.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index c3bdafab955..d11952599e7 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 52.0.0 +current_version = 53.0.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 79941d8efe9..93eae6870ce 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v53.0.0 +------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ +* #1527: Removed bootstrap script. Now Setuptools requires pip or another pep517-compliant builder such as 'build' to build. Now Setuptools can be installed from Github main branch. + + v52.0.0 ------- diff --git a/changelog.d/1527.breaking.rst b/changelog.d/1527.breaking.rst deleted file mode 100644 index 7eb8a63f735..00000000000 --- a/changelog.d/1527.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Removed bootstrap script. Now Setuptools requires pip or another pep517-compliant builder such as 'build' to build. Now Setuptools can be installed from Github main branch. diff --git a/setup.cfg b/setup.cfg index e0c4edc2e6a..14ff445daa1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 52.0.0 +version = 53.0.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 14f91af8370eaa1c7c7c19510aa9d4d5a65c069d Mon Sep 17 00:00:00 2001 From: Pablo Woolvett Date: Thu, 4 Feb 2021 13:59:15 -0300 Subject: [PATCH 152/272] docs(userguide): Marker example for extras_require Signed-off-by: Pablo Woolvett --- docs/userguide/declarative_config.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/userguide/declarative_config.rst b/docs/userguide/declarative_config.rst index bc66869b6ef..f2e8b81f755 100644 --- a/docs/userguide/declarative_config.rst +++ b/docs/userguide/declarative_config.rst @@ -243,6 +243,19 @@ data_files dict 40.6.0 **find_namespace directive** - The ``find_namespace:`` directive is supported since Python >=3.3. + Notes: 1. In the ``package_data`` section, a key named with a single asterisk (``*``) refers to all packages, in lieu of the empty string used in ``setup.py``. + +2. In the ``extras_require`` section, values are parsed as ``list-semi``. This implies that in +order to include markers, they **must** be *dangling*: + +.. code-block:: ini + + [options.extras_require] + rest = docutils>=0.3; pack ==1.1, ==1.3 + pdf = + ReportLab>=1.2 + RXP + importlib-metadata; python_version < "3.8" From f957da57a1312d29deea8cc902562b9ac55bcbda Mon Sep 17 00:00:00 2001 From: Pablo Woolvett Date: Thu, 4 Feb 2021 14:04:22 -0300 Subject: [PATCH 153/272] newsfragment Signed-off-by: Pablo Woolvett --- changelog.d/2553.doc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2553.doc.rst diff --git a/changelog.d/2553.doc.rst b/changelog.d/2553.doc.rst new file mode 100644 index 00000000000..51c609616e8 --- /dev/null +++ b/changelog.d/2553.doc.rst @@ -0,0 +1 @@ +Added userguide example for markers in extras_require -- by :user:`webknjaz` From 65db33b158a377a2d3f74ea28478a66a3097f273 Mon Sep 17 00:00:00 2001 From: pwoolvett Date: Thu, 4 Feb 2021 16:44:53 -0300 Subject: [PATCH 154/272] Update 2553.doc.rst --- changelog.d/2553.doc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/2553.doc.rst b/changelog.d/2553.doc.rst index 51c609616e8..fa03329ad91 100644 --- a/changelog.d/2553.doc.rst +++ b/changelog.d/2553.doc.rst @@ -1 +1 @@ -Added userguide example for markers in extras_require -- by :user:`webknjaz` +Added userguide example for markers in extras_require -- by :user:`pwoolvett` From e70c2afc1868a7d9bb2e2887ebf19f6c84dcf283 Mon Sep 17 00:00:00 2001 From: Andrey Bienkowski Date: Tue, 9 Feb 2021 09:20:47 +0300 Subject: [PATCH 155/272] quickstart: recommend PyPA build instead of pep517.build see https://github.com/pypa/pep517/issues/91 --- docs/conf.py | 5 ++++- docs/userguide/quickstart.rst | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 18cd7bdc490..0a5136b0af7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -73,6 +73,9 @@ ), } +intersphinx_mapping = { + 'pypa-build': ('https://pypa-build.readthedocs.io/en/latest/', None) +} # Add support for linking usernames github_url = 'https://github.com' @@ -80,7 +83,7 @@ extlinks = { 'user': (f'{github_sponsors_url}/%s', '@'), # noqa: WPS323 } -extensions += ['sphinx.ext.extlinks'] +extensions += ['sphinx.ext.extlinks', 'sphinx.ext.intersphinx'] # Be strict about any broken references: nitpicky = True diff --git a/docs/userguide/quickstart.rst b/docs/userguide/quickstart.rst index 1d557d47bd6..e7594ba33e7 100644 --- a/docs/userguide/quickstart.rst +++ b/docs/userguide/quickstart.rst @@ -59,11 +59,11 @@ This is what your project would look like:: setup.cfg mypackage/__init__.py -Then, you need an installer, such as `pep517 `_ -which you can obtain via ``pip install pep517``. After downloading it, invoke +Then, you need an installer, such as :std:doc:`PyPA build ` +which you can obtain via ``pip install build``. After downloading it, invoke the installer:: - python -m pep517.build . + python -m build You now have your distribution ready (e.g. a ``tar.gz`` file and a ``.whl`` file in the ``dist`` directory), which you can upload to PyPI! From 51298a2cc4faa7253e9fe41d7a9574cf9aac997c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 9 Feb 2021 23:08:58 -0500 Subject: [PATCH 156/272] Normalize indentation --- setup.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 106763e3d96..8df8d273a3c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,9 +23,9 @@ setup_requires = setuptools_scm[toml] >= 3.4.1 [options.packages.find] exclude = - build* - docs* - tests* + build* + docs* + tests* [options.extras_require] testing = From cb00954729e1deaef431697bae8b8a6a7198c2ce Mon Sep 17 00:00:00 2001 From: Simone Pierazzini Date: Thu, 18 Feb 2021 06:40:17 +0100 Subject: [PATCH 157/272] Correctly parse cmdclass in setup.cfg. Fixes #2570 --- changelog.d/2570.change.rst | 1 + setuptools/config.py | 17 +++++++++++++++++ setuptools/tests/test_config.py | 24 ++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 changelog.d/2570.change.rst diff --git a/changelog.d/2570.change.rst b/changelog.d/2570.change.rst new file mode 100644 index 00000000000..165089ed310 --- /dev/null +++ b/changelog.d/2570.change.rst @@ -0,0 +1 @@ +Correctly parse cmdclass in setup.cfg. diff --git a/setuptools/config.py b/setuptools/config.py index af3a3bcbd56..4a6cd4694b0 100644 --- a/setuptools/config.py +++ b/setuptools/config.py @@ -574,6 +574,7 @@ def parsers(self): parse_list_semicolon = partial(self._parse_list, separator=';') parse_bool = self._parse_bool parse_dict = self._parse_dict + parse_cmdclass = self._parse_cmdclass return { 'zip_safe': parse_bool, @@ -594,6 +595,22 @@ def parsers(self): 'entry_points': self._parse_file, 'py_modules': parse_list, 'python_requires': SpecifierSet, + 'cmdclass': parse_cmdclass, + } + + def _parse_cmdclass(self, value): + def resolve_class(qualified_class_name): + idx = qualified_class_name.rfind('.') + class_name = qualified_class_name[idx+1:] + pkg_name = qualified_class_name[:idx] + + module = __import__(pkg_name) + + return getattr(module, class_name) + + return { + k: resolve_class(v) + for k, v in self._parse_dict(value).items() } def _parse_packages(self, value): diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 1dee12718f2..16892cb1344 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -1,3 +1,6 @@ +import types +import sys + import contextlib import configparser @@ -7,6 +10,7 @@ from mock import patch from setuptools.dist import Distribution, _Distribution from setuptools.config import ConfigHandler, read_configuration +from distutils.core import Command from .textwrap import DALS @@ -853,6 +857,26 @@ def test_python_requires_invalid(self, tmpdir): with get_dist(tmpdir) as dist: dist.parse_config_files() + def test_cmdclass(self, tmpdir): + class CustomCmd(Command): + pass + + m = types.ModuleType('custom_build', 'test package') + + m.__dict__['CustomCmd'] = CustomCmd + + sys.modules['custom_build'] = m + + fake_env( + tmpdir, + '[options]\n' + 'cmdclass =\n' + ' customcmd = custom_build.CustomCmd\n' + ) + + with get_dist(tmpdir) as dist: + assert dist.cmdclass == {'customcmd': CustomCmd} + saved_dist_init = _Distribution.__init__ From 37a6284c9fcd71a3d4b2fe5dbc802fcf5cbe0786 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Thu, 18 Feb 2021 23:02:29 -0500 Subject: [PATCH 158/272] Fix sphinx upload_docs --- setup.cfg | 1 + setuptools/command/upload_docs.py | 7 +++- setuptools/tests/requirements.txt | 1 + setuptools/tests/test_sphinx_upload_docs.py | 42 +++++++++++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 setuptools/tests/test_sphinx_upload_docs.py diff --git a/setup.cfg b/setup.cfg index e0c4edc2e6a..3368d88dfaa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,6 +58,7 @@ testing = pip>=19.1 # For proper file:// URLs support. jaraco.envs pytest-xdist + sphinx docs = # Keep these in sync with docs/requirements.txt diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index 2559458a1d3..95383319ef8 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -2,7 +2,7 @@ """upload_docs Implements a Distutils 'upload_docs' subcommand (upload documentation to -PyPI's pythonhosted.org). +sites other than PyPi such as devpi). """ from base64 import standard_b64encode @@ -59,7 +59,10 @@ def finalize_options(self): if self.upload_dir is None: if self.has_sphinx(): build_sphinx = self.get_finalized_command('build_sphinx') - self.target_dir = build_sphinx.builder_target_dir + for (builder, builder_dir) in build_sphinx.builder_target_dirs: + if builder == "html": + self.target_dir = builder_dir + break else: build = self.get_finalized_command('build') self.target_dir = os.path.join(build.build_base, 'docs') diff --git a/setuptools/tests/requirements.txt b/setuptools/tests/requirements.txt index d0d07f70c04..b2d84a941e8 100644 --- a/setuptools/tests/requirements.txt +++ b/setuptools/tests/requirements.txt @@ -11,3 +11,4 @@ paver; python_version>="3.6" futures; python_version=="2.7" pip>=19.1 # For proper file:// URLs support. jaraco.envs +sphinx diff --git a/setuptools/tests/test_sphinx_upload_docs.py b/setuptools/tests/test_sphinx_upload_docs.py new file mode 100644 index 00000000000..4287b00e4ee --- /dev/null +++ b/setuptools/tests/test_sphinx_upload_docs.py @@ -0,0 +1,42 @@ +import pytest +import os + +from setuptools.command.upload_docs import upload_docs +from setuptools.dist import Distribution + + +@pytest.fixture +def sphinx_doc_sample_project(tmpdir_cwd): + # setup.py + with open('setup.py', 'wt') as f: + f.write('from setuptools import setup; setup()\n') + + os.makedirs('build/docs') + + # A test conf.py for Sphinx + with open('build/docs/conf.py', 'w') as f: + f.write("project = 'test'") + + # A test index.rst for Sphinx + with open('build/docs/index.rst', 'w') as f: + f.write(".. toctree::\ + :maxdepth: 2\ + :caption: Contents:") + + +@pytest.mark.usefixtures('sphinx_doc_sample_project') +@pytest.mark.usefixtures('user_override') +class TestSphinxUploadDocs: + def test_sphinx_doc(self): + params = dict( + name='foo', + packages=['test'], + ) + dist = Distribution(params) + + cmd = upload_docs(dist) + + cmd.initialize_options() + assert cmd.upload_dir is None + assert cmd.has_sphinx() is True + cmd.finalize_options() From df9ff438af59bc90c2f37a4180d1560d2ebca541 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Fri, 19 Feb 2021 19:26:28 -0500 Subject: [PATCH 159/272] Add changelog --- changelog.d/2573.change.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog.d/2573.change.rst diff --git a/changelog.d/2573.change.rst b/changelog.d/2573.change.rst new file mode 100644 index 00000000000..b06bd8c9549 --- /dev/null +++ b/changelog.d/2573.change.rst @@ -0,0 +1,2 @@ +Fixed error in uploading a Sphinx doc with the :code:`upload_docs` command. An html builder will be used. +Note: :code:`upload_docs` is deprecated for PyPi, but is supported for other sites -- by :user:`melissa-kun-li` \ No newline at end of file From 4d72bbd3906ea609cce5e5ed8b89b379ae8d65e7 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Fri, 19 Feb 2021 20:59:24 -0500 Subject: [PATCH 160/272] Update fix and documentation --- setuptools/command/upload_docs.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index 95383319ef8..845bff4421f 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -31,7 +31,7 @@ class upload_docs(upload): # supported by Warehouse (and won't be). DEFAULT_REPOSITORY = 'https://pypi.python.org/pypi/' - description = 'Upload documentation to PyPI' + description = 'Upload documentation to sites other than PyPi such as devpi' user_options = [ ('repository=', 'r', @@ -59,10 +59,7 @@ def finalize_options(self): if self.upload_dir is None: if self.has_sphinx(): build_sphinx = self.get_finalized_command('build_sphinx') - for (builder, builder_dir) in build_sphinx.builder_target_dirs: - if builder == "html": - self.target_dir = builder_dir - break + self.target_dir = dict(build_sphinx.builder_target_dirs)['html'] else: build = self.get_finalized_command('build') self.target_dir = os.path.join(build.build_base, 'docs') @@ -70,7 +67,7 @@ def finalize_options(self): self.ensure_dirname('upload_dir') self.target_dir = self.upload_dir if 'pypi.python.org' in self.repository: - log.warn("Upload_docs command is deprecated. Use RTD instead.") + log.warn("Upload_docs command is deprecated for PyPi. Use RTD instead.") self.announce('Using upload directory %s' % self.target_dir) def create_zipfile(self, filename): From ba68d13940659709fff8035e17bef7ae7c574618 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Fri, 19 Feb 2021 20:59:58 -0500 Subject: [PATCH 161/272] Update sphinx upload_docs test --- setuptools/tests/test_sphinx_upload_docs.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setuptools/tests/test_sphinx_upload_docs.py b/setuptools/tests/test_sphinx_upload_docs.py index 4287b00e4ee..a48ba7f8b38 100644 --- a/setuptools/tests/test_sphinx_upload_docs.py +++ b/setuptools/tests/test_sphinx_upload_docs.py @@ -25,7 +25,6 @@ def sphinx_doc_sample_project(tmpdir_cwd): @pytest.mark.usefixtures('sphinx_doc_sample_project') -@pytest.mark.usefixtures('user_override') class TestSphinxUploadDocs: def test_sphinx_doc(self): params = dict( From 5c57b5cc1e1d247fec64858d8cc4e93b5ffb11a3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 20 Feb 2021 12:31:39 -0500 Subject: [PATCH 162/272] Switch to jaraco.path for building files --- setup.cfg | 1 + setuptools/tests/files.py | 38 --------------------------- setuptools/tests/test_build_ext.py | 5 ++-- setuptools/tests/test_build_meta.py | 26 +++++++++--------- setuptools/tests/test_easy_install.py | 4 +-- setuptools/tests/test_egg_info.py | 26 +++++++++--------- setuptools/tests/test_glob.py | 5 ++-- setuptools/tests/test_wheel.py | 4 +-- 8 files changed, 36 insertions(+), 73 deletions(-) delete mode 100644 setuptools/tests/files.py diff --git a/setup.cfg b/setup.cfg index e0c4edc2e6a..2158905b18a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,6 +58,7 @@ testing = pip>=19.1 # For proper file:// URLs support. jaraco.envs pytest-xdist + jaraco.path docs = # Keep these in sync with docs/requirements.txt diff --git a/setuptools/tests/files.py b/setuptools/tests/files.py deleted file mode 100644 index 71194b9de03..00000000000 --- a/setuptools/tests/files.py +++ /dev/null @@ -1,38 +0,0 @@ -import os - - -def build_files(file_defs, prefix=""): - """ - Build a set of files/directories, as described by the - file_defs dictionary. - - Each key/value pair in the dictionary is interpreted as - a filename/contents - pair. If the contents value is a dictionary, a directory - is created, and the - dictionary interpreted as the files within it, recursively. - - For example: - - {"README.txt": "A README file", - "foo": { - "__init__.py": "", - "bar": { - "__init__.py": "", - }, - "baz.py": "# Some code", - } - } - """ - for name, contents in file_defs.items(): - full_name = os.path.join(prefix, name) - if isinstance(contents, dict): - os.makedirs(full_name, exist_ok=True) - build_files(contents, prefix=full_name) - else: - if isinstance(contents, bytes): - with open(full_name, 'wb') as f: - f.write(contents) - else: - with open(full_name, 'w') as f: - f.write(contents) diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 838fdb42998..be03893a1ba 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -2,12 +2,13 @@ import distutils.command.build_ext as orig from distutils.sysconfig import get_config_var +from jaraco import path + from setuptools.command.build_ext import build_ext, get_abi3_suffix from setuptools.dist import Distribution from setuptools.extension import Extension from . import environment -from .files import build_files from .textwrap import DALS @@ -106,7 +107,7 @@ def test_build_ext_config_handling(tmpdir_cwd): build-base = foo_build """), } - build_files(files) + path.build(files) code, output = environment.run_setup_py( cmd=['build'], data_stream=(0, 2), ) diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index e117d8e6295..f33a69688d1 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -5,8 +5,8 @@ from concurrent import futures import pytest +from jaraco import path -from .files import build_files from .textwrap import DALS @@ -130,7 +130,7 @@ def get_build_backend(self): @pytest.fixture(params=defns) def build_backend(self, tmpdir, request): - build_files(request.param, prefix=str(tmpdir)) + path.build(request.param, prefix=str(tmpdir)) with tmpdir.as_cwd(): yield self.get_build_backend() @@ -170,7 +170,7 @@ def test_build_with_existing_file_present(self, build_type, tmpdir_cwd): """), } - build_files(files) + path.build(files) dist_dir = os.path.abspath('preexisting-' + build_type) @@ -262,7 +262,7 @@ def test_build_sdist_pyproject_toml_exists(self, tmpdir_cwd): build-backend = "setuptools.build_meta """), } - build_files(files) + path.build(files) build_backend = self.get_build_backend() targz_path = build_backend.build_sdist("temp") with tarfile.open(os.path.join("temp", targz_path)) as tar: @@ -271,7 +271,7 @@ def test_build_sdist_pyproject_toml_exists(self, tmpdir_cwd): def test_build_sdist_setup_py_exists(self, tmpdir_cwd): # If build_sdist is called from a script other than setup.py, # ensure setup.py is included - build_files(defns[0]) + path.build(defns[0]) build_backend = self.get_build_backend() targz_path = build_backend.build_sdist("temp") @@ -293,7 +293,7 @@ def test_build_sdist_setup_py_manifest_excluded(self, tmpdir_cwd): """) } - build_files(files) + path.build(files) build_backend = self.get_build_backend() targz_path = build_backend.build_sdist("temp") @@ -315,7 +315,7 @@ def test_build_sdist_builds_targz_even_if_zip_indicated(self, tmpdir_cwd): """) } - build_files(files) + path.build(files) build_backend = self.get_build_backend() build_backend.build_sdist("temp") @@ -335,7 +335,7 @@ def test_build_sdist_builds_targz_even_if_zip_indicated(self, tmpdir_cwd): } def test_build_sdist_relative_path_import(self, tmpdir_cwd): - build_files(self._relative_path_import_files) + path.build(self._relative_path_import_files) build_backend = self.get_build_backend() with pytest.raises(ImportError, match="^No module named 'hello'$"): build_backend.build_sdist("temp") @@ -374,7 +374,7 @@ def run(): """), } - build_files(files) + path.build(files) build_backend = self.get_build_backend() @@ -409,7 +409,7 @@ def run(): """), } - build_files(files) + path.build(files) build_backend = self.get_build_backend() @@ -437,7 +437,7 @@ def run(): } def test_sys_argv_passthrough(self, tmpdir_cwd): - build_files(self._sys_argv_0_passthrough) + path.build(self._sys_argv_0_passthrough) build_backend = self.get_build_backend() with pytest.raises(AssertionError): build_backend.build_sdist("temp") @@ -449,13 +449,13 @@ class TestBuildMetaLegacyBackend(TestBuildMetaBackend): # build_meta_legacy-specific tests def test_build_sdist_relative_path_import(self, tmpdir_cwd): # This must fail in build_meta, but must pass in build_meta_legacy - build_files(self._relative_path_import_files) + path.build(self._relative_path_import_files) build_backend = self.get_build_backend() build_backend.build_sdist("temp") def test_sys_argv_passthrough(self, tmpdir_cwd): - build_files(self._sys_argv_0_passthrough) + path.build(self._sys_argv_0_passthrough) build_backend = self.get_build_backend() build_backend.build_sdist("temp") diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 66598066d74..a3b2d6e66ca 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -18,6 +18,7 @@ import subprocess import pytest +from jaraco import path from setuptools import sandbox from setuptools.sandbox import run_setup @@ -34,7 +35,6 @@ import pkg_resources from . import contexts -from .files import build_files from .textwrap import DALS @@ -794,7 +794,7 @@ def test_setup_requires_with_transitive_extra_dependency( # Create source tree for `dep`. dep_pkg = os.path.join(temp_dir, 'dep') os.mkdir(dep_pkg) - build_files({ + path.build({ 'setup.py': DALS(""" import setuptools diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index 1047468b185..5dfad7e269e 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -6,15 +6,15 @@ import stat import time +import pytest +from jaraco import path + from setuptools.command.egg_info import ( egg_info, manifest_maker, EggInfoDeprecationWarning, get_pkg_info_revision, ) from setuptools.dist import Distribution -import pytest - from . import environment -from .files import build_files from .textwrap import DALS from . import contexts @@ -37,7 +37,7 @@ class TestEggInfo: """) def _create_project(self): - build_files({ + path.build({ 'setup.py': self.setup_script, 'hello.py': DALS(""" def run(): @@ -56,7 +56,7 @@ def env(self): for dirname in subs ) list(map(os.mkdir, env.paths.values())) - build_files({ + path.build({ env.paths['home']: { '.pydistutils.cfg': DALS(""" [egg_info] @@ -106,7 +106,7 @@ def test_egg_info_save_version_info_setup_defaults(self, tmpdir_cwd, env): the file should remain unchanged. """ setup_cfg = os.path.join(env.paths['home'], 'setup.cfg') - build_files({ + path.build({ setup_cfg: DALS(""" [egg_info] tag_build = @@ -159,7 +159,7 @@ def test_license_is_a_string(self, tmpdir_cwd, env): setup() """) - build_files({'setup.py': setup_script, + path.build({'setup.py': setup_script, 'setup.cfg': setup_config}) # This command should fail with a ValueError, but because it's @@ -193,7 +193,7 @@ def test_rebuilt(self, tmpdir_cwd, env): def test_manifest_template_is_read(self, tmpdir_cwd, env): self._create_project() - build_files({ + path.build({ 'MANIFEST.in': DALS(""" recursive-include docs *.rst """), @@ -216,7 +216,7 @@ def _setup_script_with_requires(self, requires, use_setup_cfg=False): ''' ) % ('' if use_setup_cfg else requires) setup_config = requires if use_setup_cfg else '' - build_files({'setup.py': setup_script, + path.build({'setup.py': setup_script, 'setup.cfg': setup_config}) mismatch_marker = "python_version<'{this_ver}'".format( @@ -546,7 +546,7 @@ def test_doesnt_provides_extra(self, tmpdir_cwd, env): def test_setup_cfg_license_file( self, tmpdir_cwd, env, files, license_in_sources): self._create_project() - build_files(files) + path.build(files) environment.run_setup_py( cmd=['egg_info'], @@ -645,7 +645,7 @@ def test_setup_cfg_license_file( def test_setup_cfg_license_files( self, tmpdir_cwd, env, files, incl_licenses, excl_licenses): self._create_project() - build_files(files) + path.build(files) environment.run_setup_py( cmd=['egg_info'], @@ -750,7 +750,7 @@ def test_setup_cfg_license_files( def test_setup_cfg_license_file_license_files( self, tmpdir_cwd, env, files, incl_licenses, excl_licenses): self._create_project() - build_files(files) + path.build(files) environment.run_setup_py( cmd=['egg_info'], @@ -886,7 +886,7 @@ def _run_egg_info_command(self, tmpdir_cwd, env, cmd=None, output=None): def test_egg_info_tag_only_once(self, tmpdir_cwd, env): self._create_project() - build_files({ + path.build({ 'setup.cfg': DALS(""" [egg_info] tag_build = dev diff --git a/setuptools/tests/test_glob.py b/setuptools/tests/test_glob.py index a0728c5d12e..e99587f5688 100644 --- a/setuptools/tests/test_glob.py +++ b/setuptools/tests/test_glob.py @@ -1,9 +1,8 @@ import pytest +from jaraco import path from setuptools.glob import glob -from .files import build_files - @pytest.mark.parametrize('tree, pattern, matches', ( ('', b'', []), @@ -31,5 +30,5 @@ )) def test_glob(monkeypatch, tmpdir, tree, pattern, matches): monkeypatch.chdir(tmpdir) - build_files({name: '' for name in tree.split()}) + path.build({name: '' for name in tree.split()}) assert list(sorted(glob(pattern))) == list(sorted(matches)) diff --git a/setuptools/tests/test_wheel.py b/setuptools/tests/test_wheel.py index e56eac14d1c..7345b135fd1 100644 --- a/setuptools/tests/test_wheel.py +++ b/setuptools/tests/test_wheel.py @@ -15,6 +15,7 @@ import zipfile import pytest +from jaraco import path from pkg_resources import Distribution, PathMetadata, PY_MAJOR from setuptools.extern.packaging.utils import canonicalize_name @@ -22,7 +23,6 @@ from setuptools.wheel import Wheel from .contexts import tempdir -from .files import build_files from .textwrap import DALS @@ -91,7 +91,7 @@ def build_wheel(extra_file_defs=None, **kwargs): if extra_file_defs: file_defs.update(extra_file_defs) with tempdir() as source_dir: - build_files(file_defs, source_dir) + path.build(file_defs, source_dir) subprocess.check_call((sys.executable, 'setup.py', '-q', 'bdist_wheel'), cwd=source_dir) yield glob.glob(os.path.join(source_dir, 'dist', '*.whl'))[0] From 346d98c700e2048bc7667970f23694d17d2c5642 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 20 Feb 2021 12:32:25 -0500 Subject: [PATCH 163/272] =?UTF-8?q?=F0=9F=91=B9=20Feed=20the=20hobgoblins?= =?UTF-8?q?=20(delint).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setuptools/tests/test_egg_info.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index 5dfad7e269e..bf95b03ce66 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -159,8 +159,10 @@ def test_license_is_a_string(self, tmpdir_cwd, env): setup() """) - path.build({'setup.py': setup_script, - 'setup.cfg': setup_config}) + path.build({ + 'setup.py': setup_script, + 'setup.cfg': setup_config, + }) # This command should fail with a ValueError, but because it's # currently configured to use a subprocess, the actual traceback @@ -216,8 +218,10 @@ def _setup_script_with_requires(self, requires, use_setup_cfg=False): ''' ) % ('' if use_setup_cfg else requires) setup_config = requires if use_setup_cfg else '' - path.build({'setup.py': setup_script, - 'setup.cfg': setup_config}) + path.build({ + 'setup.py': setup_script, + 'setup.cfg': setup_config, + }) mismatch_marker = "python_version<'{this_ver}'".format( this_ver=sys.version_info[0], From 23cae26198fdda29e75cd0c1076ad601b0532d6b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 20 Feb 2021 12:40:33 -0500 Subject: [PATCH 164/272] Pin minimum jaraco.path version Co-authored-by: Benoit Pierre --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 2158905b18a..a3b9ca1b731 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,7 +58,7 @@ testing = pip>=19.1 # For proper file:// URLs support. jaraco.envs pytest-xdist - jaraco.path + jaraco.path>=3.2.0 docs = # Keep these in sync with docs/requirements.txt From 9be50723119ba4a636364b4dc17912f94d4632ec Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 20 Feb 2021 12:53:32 -0500 Subject: [PATCH 165/272] Use path builder in upload_docs tests. --- setuptools/tests/test_sphinx_upload_docs.py | 27 ++++++++---------- setuptools/tests/test_upload_docs.py | 31 ++++++++------------- 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/setuptools/tests/test_sphinx_upload_docs.py b/setuptools/tests/test_sphinx_upload_docs.py index a48ba7f8b38..cc5b8293bf4 100644 --- a/setuptools/tests/test_sphinx_upload_docs.py +++ b/setuptools/tests/test_sphinx_upload_docs.py @@ -1,5 +1,6 @@ import pytest -import os + +from jaraco import path from setuptools.command.upload_docs import upload_docs from setuptools.dist import Distribution @@ -7,21 +8,17 @@ @pytest.fixture def sphinx_doc_sample_project(tmpdir_cwd): - # setup.py - with open('setup.py', 'wt') as f: - f.write('from setuptools import setup; setup()\n') - - os.makedirs('build/docs') - - # A test conf.py for Sphinx - with open('build/docs/conf.py', 'w') as f: - f.write("project = 'test'") - - # A test index.rst for Sphinx - with open('build/docs/index.rst', 'w') as f: - f.write(".. toctree::\ + path.build({ + 'setup.py': 'from setuptools import setup; setup()', + 'build': { + 'docs': { + 'conf.py': 'project="test"', + 'index.rst': ".. toctree::\ :maxdepth: 2\ - :caption: Contents:") + :caption: Contents:", + }, + }, + }) @pytest.mark.usefixtures('sphinx_doc_sample_project') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index a26e32a61d2..55978aadc70 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -3,6 +3,7 @@ import contextlib import pytest +from jaraco import path from setuptools.command.upload_docs import upload_docs from setuptools.dist import Distribution @@ -10,28 +11,20 @@ from .textwrap import DALS from . import contexts -SETUP_PY = DALS( - """ - from setuptools import setup - - setup(name='foo') - """) - @pytest.fixture def sample_project(tmpdir_cwd): - # setup.py - with open('setup.py', 'wt') as f: - f.write(SETUP_PY) - - os.mkdir('build') - - # A test document. - with open('build/index.html', 'w') as f: - f.write("Hello world.") - - # An empty folder. - os.mkdir('build/empty') + path.build({ + 'setup.py': DALS(""" + from setuptools import setup + + setup(name='foo') + """), + 'build': { + 'index.html': 'Hello world.', + 'empty': {}, + } + }) @pytest.mark.usefixtures('sample_project') From ea9c5778539b73db8d366a7544d2d314cb85f1ed Mon Sep 17 00:00:00 2001 From: Thea Date: Sat, 20 Feb 2021 21:23:48 +0100 Subject: [PATCH 166/272] Include link to new developer guide in the old one --- docs/setuptools.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/setuptools.rst b/docs/setuptools.rst index 05516a4e310..e6fa7a69e7b 100644 --- a/docs/setuptools.rst +++ b/docs/setuptools.rst @@ -54,7 +54,7 @@ Feature Highlights: Developer's Guide ----------------- - +The developer's guide has been updated. See the `most recent version. `_ From 65f727e9a695947d8013c952b4defde6789e2ff7 Mon Sep 17 00:00:00 2001 From: Thea Date: Sat, 20 Feb 2021 22:11:06 +0100 Subject: [PATCH 167/272] Use :doc: instead of direct link --- docs/setuptools.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/setuptools.rst b/docs/setuptools.rst index e6fa7a69e7b..761fc722d2e 100644 --- a/docs/setuptools.rst +++ b/docs/setuptools.rst @@ -54,7 +54,7 @@ Feature Highlights: Developer's Guide ----------------- -The developer's guide has been updated. See the `most recent version. `_ +The developer's guide has been updated. See the :doc:`most recent version `. From 869e223f903678775e6903bf8f6ca9b6cc805977 Mon Sep 17 00:00:00 2001 From: Thea Date: Sat, 20 Feb 2021 22:32:29 +0100 Subject: [PATCH 168/272] Reference index in the userguide directory --- docs/setuptools.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/setuptools.rst b/docs/setuptools.rst index e6fa7a69e7b..541bec515ab 100644 --- a/docs/setuptools.rst +++ b/docs/setuptools.rst @@ -54,7 +54,7 @@ Feature Highlights: Developer's Guide ----------------- -The developer's guide has been updated. See the `most recent version. `_ +The developer's guide has been updated. See the :doc:`most recent version `. From 743af7249d56e55a7c2c5f3111958ceee008d8ea Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 Feb 2021 13:04:46 -0500 Subject: [PATCH 169/272] Exclude dist from discovered packages. Fixes jaraco/skeleton#46. --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index 8df8d273a3c..af246415cf9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,6 +24,7 @@ setup_requires = setuptools_scm[toml] >= 3.4.1 [options.packages.find] exclude = build* + dist* docs* tests* From 38fff62edb5e282f144dc77cc1bf5555367336d9 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Sat, 6 Feb 2021 23:03:13 +0300 Subject: [PATCH 170/272] Added an .editorconfig. Pull request jaraco/skeleton#43. --- .editorconfig | 15 +++++++++++++++ pytest.ini | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..6385b573438 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +charset = utf-8 +indent_style = tab +indent_size = 4 +insert_final_newline = true +end_of_line = lf + +[*.py] +indent_style = space + +[*.{yml,yaml}] +indent_style = space +indent_size = 2 diff --git a/pytest.ini b/pytest.ini index d7f0b115595..016063b546e 100644 --- a/pytest.ini +++ b/pytest.ini @@ -5,5 +5,5 @@ doctest_optionflags=ALLOW_UNICODE ELLIPSIS # workaround for warning pytest-dev/pytest#6178 junit_family=xunit2 filterwarnings= - # https://github.com/pytest-dev/pytest/issues/6928 - ignore:direct construction of .*Item has been deprecated:DeprecationWarning + # https://github.com/pytest-dev/pytest/issues/6928 + ignore:direct construction of .*Item has been deprecated:DeprecationWarning From 5e416793c008c5ef285c37828072fbea5ced6d08 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 Feb 2021 21:34:35 -0500 Subject: [PATCH 171/272] It's no longer necessary to filter this warning and it's not a warning anymore. --- pytest.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/pytest.ini b/pytest.ini index 016063b546e..6bf69af1420 100644 --- a/pytest.ini +++ b/pytest.ini @@ -5,5 +5,3 @@ doctest_optionflags=ALLOW_UNICODE ELLIPSIS # workaround for warning pytest-dev/pytest#6178 junit_family=xunit2 filterwarnings= - # https://github.com/pytest-dev/pytest/issues/6928 - ignore:direct construction of .*Item has been deprecated:DeprecationWarning From d9a13c77ce2a3efea70c97d219ca4335c0f03c40 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 Feb 2021 21:36:53 -0500 Subject: [PATCH 172/272] Bump minimum pytest --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index af246415cf9..81f70eeab73 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ exclude = [options.extras_require] testing = # upstream - pytest >= 3.5, !=3.7.3 + pytest >= 4.6 pytest-checkdocs >= 1.2.3 pytest-flake8 pytest-black >= 0.3.7; python_implementation != "PyPy" From 21b122e06969a9d85c65ce8276519d34da7dc747 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Tue, 23 Feb 2021 21:23:35 -0500 Subject: [PATCH 173/272] Preserve case-sensitive keys in setup.cfg --- setuptools/dist.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setuptools/dist.py b/setuptools/dist.py index 050388de16e..c31020f0c4d 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -583,6 +583,7 @@ def _parse_config_files(self, filenames=None): # noqa: C901 self.announce("Distribution.parse_config_files():") parser = ConfigParser() + parser.optionxform = str for filename in filenames: with io.open(filename, encoding='utf-8') as reader: if DEBUG: From 90d8740c353ddf20c1c76d8c06cd923c19b8cc84 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Tue, 23 Feb 2021 21:06:55 -0500 Subject: [PATCH 174/272] Add case-sensitive entry point name test --- setuptools/tests/test_config.py | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 1dee12718f2..6cc1d0a46b8 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -802,6 +802,40 @@ def test_entry_points(self, tmpdir): with get_dist(tmpdir) as dist: assert dist.entry_points == expected + def test_case_sensitive_entry_points(self, tmpdir): + _, config = fake_env( + tmpdir, + '[options.entry_points]\n' + 'GROUP1 = point1 = pack.module:func, ' + '.point2 = pack.module2:func_rest [rest]\n' + 'group2 = point3 = pack.module:func2\n' + ) + + with get_dist(tmpdir) as dist: + assert dist.entry_points == { + 'GROUP1': [ + 'point1 = pack.module:func', + '.point2 = pack.module2:func_rest [rest]', + ], + 'group2': ['point3 = pack.module:func2'] + } + + expected = ( + '[blogtool.parsers]\n' + '.rst = some.nested.module:SomeClass.some_classmethod[reST]\n' + ) + + tmpdir.join('entry_points').write(expected) + + # From file. + config.write( + '[options]\n' + 'entry_points = file: entry_points\n' + ) + + with get_dist(tmpdir) as dist: + assert dist.entry_points == expected + def test_data_files(self, tmpdir): fake_env( tmpdir, From 39659040bda0664ee08588ecd2faa41b4ea406a1 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Wed, 24 Feb 2021 00:31:16 -0500 Subject: [PATCH 175/272] Add change note --- changelog.d/1937.breaking.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1937.breaking.rst diff --git a/changelog.d/1937.breaking.rst b/changelog.d/1937.breaking.rst new file mode 100644 index 00000000000..94dc739ab62 --- /dev/null +++ b/changelog.d/1937.breaking.rst @@ -0,0 +1 @@ +Preserved case-sensitivity of keys in setup.cfg so that entry point names are case-sensitive. Changed sensitivity of configparser -- by :user:`melissa-kun-li` \ No newline at end of file From 3dd8e559112d2b2af58caed77a105be7e925f1c4 Mon Sep 17 00:00:00 2001 From: Thea Date: Wed, 24 Feb 2021 23:12:59 +0100 Subject: [PATCH 176/272] Add ini to display code block in doc --- docs/userguide/entry_point.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userguide/entry_point.rst b/docs/userguide/entry_point.rst index 738207282cb..63d30a4893c 100644 --- a/docs/userguide/entry_point.rst +++ b/docs/userguide/entry_point.rst @@ -64,7 +64,7 @@ After installing the package, a user may invoke that function by simply calling The syntax for entry points is specified as follows: -.. code-block:: +.. code-block:: ini = [.[.]][:.] From 7f3e6d688e5ff080ee6bd7ccc6bd81a87c05cfd7 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Wed, 24 Feb 2021 23:57:59 -0500 Subject: [PATCH 177/272] Update test for case-sensitive entry point names --- setuptools/tests/test_config.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 6cc1d0a46b8..649075609a2 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -820,22 +820,6 @@ def test_case_sensitive_entry_points(self, tmpdir): 'group2': ['point3 = pack.module:func2'] } - expected = ( - '[blogtool.parsers]\n' - '.rst = some.nested.module:SomeClass.some_classmethod[reST]\n' - ) - - tmpdir.join('entry_points').write(expected) - - # From file. - config.write( - '[options]\n' - 'entry_points = file: entry_points\n' - ) - - with get_dist(tmpdir) as dist: - assert dist.entry_points == expected - def test_data_files(self, tmpdir): fake_env( tmpdir, From 11529db0de4081404b37fab17711660faa85abb8 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Thu, 25 Feb 2021 00:00:23 -0500 Subject: [PATCH 178/272] Update change log --- changelog.d/1937.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1937.change.rst diff --git a/changelog.d/1937.change.rst b/changelog.d/1937.change.rst new file mode 100644 index 00000000000..acd43059680 --- /dev/null +++ b/changelog.d/1937.change.rst @@ -0,0 +1 @@ +Preserved case-sensitivity of keys in setup.cfg so that entry point names are case-sensitive. Changed sensitivity of configparser. NOTE: Any projects relying on case-insensitivity will need to adapt to accept the original case as published. -- by :user:`melissa-kun-li` \ No newline at end of file From 898a0b59427f143efe0bcc0cabf69007fb3ee439 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 25 Feb 2021 08:57:04 -0500 Subject: [PATCH 179/272] Remove 'breaking' changelog, superseded by 'change'. --- changelog.d/1937.breaking.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 changelog.d/1937.breaking.rst diff --git a/changelog.d/1937.breaking.rst b/changelog.d/1937.breaking.rst deleted file mode 100644 index 94dc739ab62..00000000000 --- a/changelog.d/1937.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Preserved case-sensitivity of keys in setup.cfg so that entry point names are case-sensitive. Changed sensitivity of configparser -- by :user:`melissa-kun-li` \ No newline at end of file From fa14483daaf6f0479d109d1b3cab3f1e1bef6894 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 25 Feb 2021 08:58:43 -0500 Subject: [PATCH 180/272] =?UTF-8?q?Bump=20version:=2053.0.0=20=E2=86=92=20?= =?UTF-8?q?53.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 11 +++++++++++ changelog.d/1937.change.rst | 1 - changelog.d/2573.change.rst | 2 -- setup.cfg | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) delete mode 100644 changelog.d/1937.change.rst delete mode 100644 changelog.d/2573.change.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index d11952599e7..a408627e474 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 53.0.0 +current_version = 53.1.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 93eae6870ce..7e8c28bf0b1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,14 @@ +v53.1.0 +------- + + +Changes +^^^^^^^ +* #1937: Preserved case-sensitivity of keys in setup.cfg so that entry point names are case-sensitive. Changed sensitivity of configparser. NOTE: Any projects relying on case-insensitivity will need to adapt to accept the original case as published. -- by :user:`melissa-kun-li` +* #2573: Fixed error in uploading a Sphinx doc with the :code:`upload_docs` command. An html builder will be used. + Note: :code:`upload_docs` is deprecated for PyPi, but is supported for other sites -- by :user:`melissa-kun-li` + + v53.0.0 ------- diff --git a/changelog.d/1937.change.rst b/changelog.d/1937.change.rst deleted file mode 100644 index acd43059680..00000000000 --- a/changelog.d/1937.change.rst +++ /dev/null @@ -1 +0,0 @@ -Preserved case-sensitivity of keys in setup.cfg so that entry point names are case-sensitive. Changed sensitivity of configparser. NOTE: Any projects relying on case-insensitivity will need to adapt to accept the original case as published. -- by :user:`melissa-kun-li` \ No newline at end of file diff --git a/changelog.d/2573.change.rst b/changelog.d/2573.change.rst deleted file mode 100644 index b06bd8c9549..00000000000 --- a/changelog.d/2573.change.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed error in uploading a Sphinx doc with the :code:`upload_docs` command. An html builder will be used. -Note: :code:`upload_docs` is deprecated for PyPi, but is supported for other sites -- by :user:`melissa-kun-li` \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 3c85d998825..12ce13861da 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 53.0.0 +version = 53.1.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 693e4a0cd296d5e107c39ba1986174e29ed409c8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Feb 2021 11:37:33 -0500 Subject: [PATCH 181/272] Only Python 3 is relevant now --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 414ffed581a..58659eab07a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "setuptools >= 40.8; python_version > '3'", + "setuptools >= 40.8", "wheel", ] build-backend = "setuptools.build_meta" From 1a549254c1828161417ff1053b8cdea34b9ad1dd Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Feb 2021 13:51:32 -0500 Subject: [PATCH 182/272] Trim excess whitespace --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 7e8c28bf0b1..864ee10566c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,7 @@ v53.1.0 Changes ^^^^^^^ * #1937: Preserved case-sensitivity of keys in setup.cfg so that entry point names are case-sensitive. Changed sensitivity of configparser. NOTE: Any projects relying on case-insensitivity will need to adapt to accept the original case as published. -- by :user:`melissa-kun-li` -* #2573: Fixed error in uploading a Sphinx doc with the :code:`upload_docs` command. An html builder will be used. +* #2573: Fixed error in uploading a Sphinx doc with the :code:`upload_docs` command. An html builder will be used. Note: :code:`upload_docs` is deprecated for PyPi, but is supported for other sites -- by :user:`melissa-kun-li` From accbc3aa9f6692e43a079bb3d1847ab4eb5c3ce5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Feb 2021 11:49:01 -0500 Subject: [PATCH 183/272] Try omitting setuptools as build requirement. After all, Setuptools is right here. --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 58659eab07a..70e3473d44d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,5 @@ [build-system] requires = [ - "setuptools >= 40.8", "wheel", ] build-backend = "setuptools.build_meta" From 0a1f89c272be2720e9c737108153fcf88a1d8640 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Feb 2021 12:01:24 -0500 Subject: [PATCH 184/272] Restore pyproject.toml in sdist --- MANIFEST.in | 1 - 1 file changed, 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index eba40c5de68..3e8f09de37a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -15,4 +15,3 @@ include launcher.c include msvc-build-launcher.cmd include pytest.ini include tox.ini -exclude pyproject.toml # Temporary workaround for #1644. From 30bd8a5702d38d7b98bd325e94fb50886b2b3d4e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Feb 2021 14:14:46 -0500 Subject: [PATCH 185/272] Add minimal entry points for bootstrapping --- bootstrap.egg-info/entry_points.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 bootstrap.egg-info/entry_points.txt diff --git a/bootstrap.egg-info/entry_points.txt b/bootstrap.egg-info/entry_points.txt new file mode 100644 index 00000000000..834d674e57a --- /dev/null +++ b/bootstrap.egg-info/entry_points.txt @@ -0,0 +1,14 @@ +[distutils.commands] +egg_info = setuptools.command.egg_info:egg_info + +[distutils.setup_keywords] +include_package_data = setuptools.dist:assert_bool +install_requires = setuptools.dist:check_requirements +extras_require = setuptools.dist:check_extras +entry_points = setuptools.dist:check_entry_points + +[egg_info.writers] +PKG-INFO = setuptools.command.egg_info:write_pkg_info +dependency_links.txt = setuptools.command.egg_info:overwrite_arg +entry_points.txt = setuptools.command.egg_info:write_entries +requires.txt = setuptools.command.egg_info:write_requirements From 7f838213da6d49c59e11aef6b8ebe0fcbc113801 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Feb 2021 19:43:15 -0500 Subject: [PATCH 186/272] Add metadata --- bootstrap.egg-info/PKG-INFO | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 bootstrap.egg-info/PKG-INFO diff --git a/bootstrap.egg-info/PKG-INFO b/bootstrap.egg-info/PKG-INFO new file mode 100644 index 00000000000..6e11ceeb9b7 --- /dev/null +++ b/bootstrap.egg-info/PKG-INFO @@ -0,0 +1,2 @@ +Name: setuptools-bootstrap +Version: 1.0 From 3d3c69e3800e66de8e6e3b5fc5672886f2b1068e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Feb 2021 20:05:37 -0500 Subject: [PATCH 187/272] Remove pip 19 from the upgrade from source tests. --- setuptools/tests/test_virtualenv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index fcd5da5d45f..ea74ebe2d28 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -69,7 +69,9 @@ def _get_pip_versions(): 'pip==9.0.3', 'pip==10.0.1', 'pip==18.1', - 'pip==19.0.1', + # fails due to pypa/pip#6599 + # 'pip==19.3.1', + 'pip==20.0.2', 'https://github.com/pypa/pip/archive/master.zip', ] From ac3154576db19ae91a3cb1c26b7eba279fd12191 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Feb 2021 20:55:35 -0500 Subject: [PATCH 188/272] Rely on pytest-checkdocs 2.4 to avoid picking up 'bootstrap' as the local project. --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index f4bf489a9c5..7adf85691bb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,7 +41,7 @@ exclude = testing = # upstream pytest >= 3.5, !=3.7.3 - pytest-checkdocs >= 1.2.3 + pytest-checkdocs >= 2.4 pytest-flake8 pytest-black >= 0.3.7; python_implementation != "PyPy" pytest-cov From 1da02dc4d8dd591a67e83a663379ab5c926de47f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 26 Feb 2021 21:28:00 -0500 Subject: [PATCH 189/272] Update changelog. --- changelog.d/2582.breaking.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2582.breaking.rst diff --git a/changelog.d/2582.breaking.rst b/changelog.d/2582.breaking.rst new file mode 100644 index 00000000000..15dfbdb11e2 --- /dev/null +++ b/changelog.d/2582.breaking.rst @@ -0,0 +1 @@ +Simplified build-from source story. Build requirements no longer include setuptools itself. Project can no longer be installed from source on pip 19.x, but install from source is still supported on pip < 19 and pip >= 20 and install from wheel is still supported with pip >= 9. From 4451606b2572870050bbabe7f6672a96d0c4d745 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Feb 2021 13:57:27 -0500 Subject: [PATCH 190/272] Prefer xfail to skip on known failure mode. --- setuptools/tests/test_virtualenv.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index ea74ebe2d28..5a16f529178 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -1,6 +1,8 @@ import glob import os import sys +import itertools +from collections import UserString import pathlib @@ -65,22 +67,33 @@ def _get_pip_versions(): # No network, disable most of these tests network = False + def mark_param(orig, *marks): + result = UserString(orig) if not isinstance(orig, UserString) else orig + result.marks = getattr(result, 'marks', ()) + marks + return result + + def make_param(marked_param): + marks = getattr(marked_param, 'marks', ()) + return pytest.param(marked_param, marks=marks) + + def skip_network(param): + return mark_param(param, pytest.mark.skip) if not network else param + network_versions = [ 'pip==9.0.3', 'pip==10.0.1', 'pip==18.1', - # fails due to pypa/pip#6599 - # 'pip==19.3.1', + mark_param('pip==19.3.1', pytest.mark.xfail(reason='pypa/pip#6599')), 'pip==20.0.2', 'https://github.com/pypa/pip/archive/master.zip', ] - versions = [None] + [ - pytest.param(v, **({} if network else {'marks': pytest.mark.skip})) - for v in network_versions - ] + versions = itertools.chain( + [None], + map(skip_network, network_versions) + ) - return versions + return list(map(make_param, versions)) @pytest.mark.parametrize('pip_version', _get_pip_versions()) From 61b3376a257be3e74ac6fa0633cb72dc8a600453 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Feb 2021 13:59:56 -0500 Subject: [PATCH 191/272] Expand on the change in the changelog. --- changelog.d/2582.breaking.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/2582.breaking.rst b/changelog.d/2582.breaking.rst index 15dfbdb11e2..908ababe781 100644 --- a/changelog.d/2582.breaking.rst +++ b/changelog.d/2582.breaking.rst @@ -1 +1 @@ -Simplified build-from source story. Build requirements no longer include setuptools itself. Project can no longer be installed from source on pip 19.x, but install from source is still supported on pip < 19 and pip >= 20 and install from wheel is still supported with pip >= 9. +Simplified build-from-source story by providing bootstrapping metadata in a separate egg-info directory. Build requirements no longer include setuptools itself. Sdist once again includes the pyproject.toml. Project can no longer be installed from source on pip 19.x, but install from source is still supported on pip < 19 and pip >= 20 and install from wheel is still supported with pip >= 9. From ce7632f3a75ab8771ec3bc71cf21136a22de55ff Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Feb 2021 14:50:01 -0500 Subject: [PATCH 192/272] Rely more on pytest param to append markers. --- setuptools/tests/test_virtualenv.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index 5a16f529178..f13f7997e3d 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -2,7 +2,6 @@ import os import sys import itertools -from collections import UserString import pathlib @@ -67,23 +66,19 @@ def _get_pip_versions(): # No network, disable most of these tests network = False - def mark_param(orig, *marks): - result = UserString(orig) if not isinstance(orig, UserString) else orig - result.marks = getattr(result, 'marks', ()) + marks - return result - - def make_param(marked_param): - marks = getattr(marked_param, 'marks', ()) - return pytest.param(marked_param, marks=marks) + def mark(param, *marks): + if not isinstance(param, type(pytest.param(''))): + param = pytest.param(param) + return param._replace(marks=param.marks + marks) def skip_network(param): - return mark_param(param, pytest.mark.skip) if not network else param + return param if network else mark(param, pytest.mark.skip(reason="no network")) network_versions = [ 'pip==9.0.3', 'pip==10.0.1', 'pip==18.1', - mark_param('pip==19.3.1', pytest.mark.xfail(reason='pypa/pip#6599')), + mark('pip==19.3.1', pytest.mark.xfail(reason='pypa/pip#6599')), 'pip==20.0.2', 'https://github.com/pypa/pip/archive/master.zip', ] @@ -93,7 +88,7 @@ def skip_network(param): map(skip_network, network_versions) ) - return list(map(make_param, versions)) + return list(versions) @pytest.mark.parametrize('pip_version', _get_pip_versions()) From 85f824f49d69177f68245b9788acaf5ace97afb7 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Sat, 27 Feb 2021 21:31:09 -0500 Subject: [PATCH 193/272] handle AttributeError by raising DisutilsSetupError in check_specifier --- setuptools/dist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index c31020f0c4d..6ae3886b1f9 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -292,7 +292,7 @@ def check_specifier(dist, attr, value): """Verify that value is a valid version specifier""" try: packaging.specifiers.SpecifierSet(value) - except packaging.specifiers.InvalidSpecifier as error: + except (packaging.specifiers.InvalidSpecifier, AttributeError) as error: tmpl = ( "{attr!r} must be a string " "containing valid version specifiers; {error}" From 20ced7533c2b737e9d99deacd97633f84b26567d Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Sun, 28 Feb 2021 00:59:58 -0500 Subject: [PATCH 194/272] test check_specifier --- setuptools/tests/test_dist.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/setuptools/tests/test_dist.py b/setuptools/tests/test_dist.py index cb47fb5848b..e4bba47bce8 100644 --- a/setuptools/tests/test_dist.py +++ b/setuptools/tests/test_dist.py @@ -9,6 +9,7 @@ _get_unpatched, check_package_data, DistDeprecationWarning, + check_specifier, ) from setuptools import sic from setuptools import Distribution @@ -323,3 +324,15 @@ def test_check_package_data(package_data, expected_message): with pytest.raises( DistutilsSetupError, match=re.escape(expected_message)): check_package_data(None, str('package_data'), package_data) + + +def test_check_specifier(): + # valid specifier value + attrs = {'name': 'foo', 'python_requires': '>=3.0, !=3.1'} + dist = Distribution(attrs) + check_specifier(dist, attrs, attrs['python_requires']) + + # invalid specifier value + attrs = {'name': 'foo', 'python_requires': ['>=3.0', '!=3.1']} + with pytest.raises(DistutilsSetupError): + dist = Distribution(attrs) From adf32a23250c56b8c3856c768b5776bb78f695a3 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Sun, 28 Feb 2021 02:11:42 -0500 Subject: [PATCH 195/272] Add changelog --- changelog.d/1932.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1932.change.rst diff --git a/changelog.d/1932.change.rst b/changelog.d/1932.change.rst new file mode 100644 index 00000000000..a7af5b72ac0 --- /dev/null +++ b/changelog.d/1932.change.rst @@ -0,0 +1 @@ +Handled :code:`AttributeError` by raising :code:`DistutilsSetupError` in :code:`dist.check_specifier()` when specifier is not a string -- by :user:`melissa-kun-li` \ No newline at end of file From f07e7ea59a484f4e7c2d5c8c6def50c836af334a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 28 Feb 2021 16:47:11 -0500 Subject: [PATCH 196/272] =?UTF-8?q?Bump=20version:=2053.1.0=20=E2=86=92=20?= =?UTF-8?q?54.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 18 ++++++++++++++++++ changelog.d/1932.change.rst | 1 - changelog.d/2553.doc.rst | 1 - changelog.d/2570.change.rst | 1 - changelog.d/2582.breaking.rst | 1 - setup.cfg | 2 +- 7 files changed, 20 insertions(+), 6 deletions(-) delete mode 100644 changelog.d/1932.change.rst delete mode 100644 changelog.d/2553.doc.rst delete mode 100644 changelog.d/2570.change.rst delete mode 100644 changelog.d/2582.breaking.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a408627e474..25490e49c92 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 53.1.0 +current_version = 54.0.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 864ee10566c..62f911aa891 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,21 @@ +v54.0.0 +------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ +* #2582: Simplified build-from-source story by providing bootstrapping metadata in a separate egg-info directory. Build requirements no longer include setuptools itself. Sdist once again includes the pyproject.toml. Project can no longer be installed from source on pip 19.x, but install from source is still supported on pip < 19 and pip >= 20 and install from wheel is still supported with pip >= 9. + +Changes +^^^^^^^ +* #1932: Handled :code:`AttributeError` by raising :code:`DistutilsSetupError` in :code:`dist.check_specifier()` when specifier is not a string -- by :user:`melissa-kun-li` +* #2570: Correctly parse cmdclass in setup.cfg. + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ +* #2553: Added userguide example for markers in extras_require -- by :user:`pwoolvett` + + v53.1.0 ------- diff --git a/changelog.d/1932.change.rst b/changelog.d/1932.change.rst deleted file mode 100644 index a7af5b72ac0..00000000000 --- a/changelog.d/1932.change.rst +++ /dev/null @@ -1 +0,0 @@ -Handled :code:`AttributeError` by raising :code:`DistutilsSetupError` in :code:`dist.check_specifier()` when specifier is not a string -- by :user:`melissa-kun-li` \ No newline at end of file diff --git a/changelog.d/2553.doc.rst b/changelog.d/2553.doc.rst deleted file mode 100644 index fa03329ad91..00000000000 --- a/changelog.d/2553.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Added userguide example for markers in extras_require -- by :user:`pwoolvett` diff --git a/changelog.d/2570.change.rst b/changelog.d/2570.change.rst deleted file mode 100644 index 165089ed310..00000000000 --- a/changelog.d/2570.change.rst +++ /dev/null @@ -1 +0,0 @@ -Correctly parse cmdclass in setup.cfg. diff --git a/changelog.d/2582.breaking.rst b/changelog.d/2582.breaking.rst deleted file mode 100644 index 908ababe781..00000000000 --- a/changelog.d/2582.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Simplified build-from-source story by providing bootstrapping metadata in a separate egg-info directory. Build requirements no longer include setuptools itself. Sdist once again includes the pyproject.toml. Project can no longer be installed from source on pip 19.x, but install from source is still supported on pip < 19 and pip >= 20 and install from wheel is still supported with pip >= 9. diff --git a/setup.cfg b/setup.cfg index 7adf85691bb..d60a9b2633d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 53.1.0 +version = 54.0.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 8307bd497dba77f5ef40f504842e023334eba04b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 28 Feb 2021 16:50:09 -0500 Subject: [PATCH 197/272] Term is builder. --- docs/userguide/quickstart.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/userguide/quickstart.rst b/docs/userguide/quickstart.rst index e7594ba33e7..75dc302f414 100644 --- a/docs/userguide/quickstart.rst +++ b/docs/userguide/quickstart.rst @@ -59,9 +59,9 @@ This is what your project would look like:: setup.cfg mypackage/__init__.py -Then, you need an installer, such as :std:doc:`PyPA build ` +Then, you need an builder, such as :std:doc:`PyPA build ` which you can obtain via ``pip install build``. After downloading it, invoke -the installer:: +the builder:: python -m build From 666f44463ce9749f1040694f9954cd93a4b80bdc Mon Sep 17 00:00:00 2001 From: Amy Date: Sun, 28 Feb 2021 22:29:48 -0500 Subject: [PATCH 198/272] Add sphinx-inline-tabs extension --- docs/conf.py | 2 +- docs/requirements.txt | 1 + setup.cfg | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 18cd7bdc490..9082fb1d416 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,4 @@ -extensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker'] +extensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker', 'sphinx_inline_tabs'] master_doc = "index" diff --git a/docs/requirements.txt b/docs/requirements.txt index 104d68faef1..0292759301c 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -3,5 +3,6 @@ sphinx jaraco.packaging>=6.1 rst.linker>=1.9 pygments-github-lexers==0.0.5 +sphinx-inline-tabs setuptools>=34 diff --git a/setup.cfg b/setup.cfg index 14ff445daa1..9de9f87f883 100644 --- a/setup.cfg +++ b/setup.cfg @@ -65,6 +65,7 @@ docs = sphinx jaraco.packaging >= 8.2 rst.linker >= 1.9 + sphinx-inline-tabs # local pygments-github-lexers==0.0.5 From 474f833a1181ca07b17fe4c52a9680c70335181e Mon Sep 17 00:00:00 2001 From: Amy Date: Sun, 28 Feb 2021 23:07:47 -0500 Subject: [PATCH 199/272] Replace adjacent code blocks with tabbed containers --- docs/userguide/dependency_management.rst | 228 +++++++++++++---------- docs/userguide/package_discovery.rst | 112 ++++++----- docs/userguide/quickstart.rst | 43 +++-- 3 files changed, 223 insertions(+), 160 deletions(-) diff --git a/docs/userguide/dependency_management.rst b/docs/userguide/dependency_management.rst index 0eb2186494c..6108d9b2e99 100644 --- a/docs/userguide/dependency_management.rst +++ b/docs/userguide/dependency_management.rst @@ -49,23 +49,27 @@ be able to run. ``setuptools`` support automatically download and install these dependencies when the package is installed. Although there is more finess to it, let's start with a simple example. -.. code-block:: ini +.. tab:: setup.cfg - [options] - #... - install_requires = - docutils - BazSpam ==1.1 + .. code-block:: ini + + [options] + #... + install_requires = + docutils + BazSpam ==1.1 + +.. tab:: setup.py -.. code-block:: python + .. code-block:: python - setup( - #..., - install_requires = [ - 'docutils', - 'BazSpam ==1.1' - ] - ) + setup( + #..., + install_requires = [ + 'docutils', + 'BazSpam ==1.1' + ] + ) When your project is installed (e.g. using pip), all of the dependencies not @@ -82,41 +86,49 @@ specific dependencies. For example, the ``enum`` package was added in Python 3.4, therefore, package that depends on it can elect to install it only when the Python version is older than 3.4. To accomplish this -.. code-block:: ini - - [options] - #... - install_requires = - enum34;python_version<'3.4' +.. tab:: setup.cfg -.. code-block:: python + .. code-block:: ini - setup( + [options] #... - install_requires=[ - "enum34;python_version<'3.4'",] - ) + install_requires = + enum34;python_version<'3.4' + +.. tab:: setup.py + + .. code-block:: python + + setup( + #... + install_requires=[ + "enum34;python_version<'3.4'",] + ) Similarly, if you also wish to declare ``pywin32`` with a minimal version of 1.0 and only install it if the user is using a Windows operating system: -.. code-block:: ini - - [options] - #... - install_requires = - enum34;python_version<'3.4' - pywin32 >= 1.0;platform_system=='Windows' +.. tab:: setup.cfg -.. code-block:: python + .. code-block:: ini - setup( + [options] #... - install_requires=[ - "enum34;python_version<'3.4'", - "pywin32 >= 1.0;platform_system=='Windows'" - ] - ) + install_requires = + enum34;python_version<'3.4' + pywin32 >= 1.0;platform_system=='Windows' + +.. tab:: setup.py + + .. code-block:: python + + setup( + #... + install_requires=[ + "enum34;python_version<'3.4'", + "pywin32 >= 1.0;platform_system=='Windows'" + ] + ) The environmental markers that may be used for testing platform types are detailed in `PEP 508 `_. @@ -181,20 +193,24 @@ The ``dependency_links`` option takes the form of a list of URL strings. For example, this will cause a search of the specified page for eggs or source distributions, if the package's dependencies aren't already installed: -.. code-block:: ini - - [options] - #... - dependency_links = http://peak.telecommunity.com/snapshots/ +.. tab:: setup.cfg -.. code-block:: python + .. code-block:: ini - setup( + [options] #... - dependency_links=[ - "http://peak.telecommunity.com/snapshots/" - ], - ) + dependency_links = http://peak.telecommunity.com/snapshots/ + +.. tab:: setup.py + + .. code-block:: python + + setup( + #... + dependency_links=[ + "http://peak.telecommunity.com/snapshots/" + ], + ) Optional dependencies @@ -211,24 +227,28 @@ ancillary functions such as "tests" and "docs". For example, Package-A offers optional PDF support and requires two other dependencies for it to work: -.. code-block:: ini +.. tab:: setup.cfg - [metadata] - name = Package-A + .. code-block:: ini - [options.extras_require] - PDF = ReportLab>=1.2; RXP + [metadata] + name = Package-A + [options.extras_require] + PDF = ReportLab>=1.2; RXP -.. code-block:: python - setup( - name="Project-A", - #... - extras_require={ - "PDF": ["ReportLab>=1.2", "RXP"], - } - ) +.. tab:: setup.py + + .. code-block:: python + + setup( + name="Project-A", + #... + extras_require={ + "PDF": ["ReportLab>=1.2", "RXP"], + } + ) The name ``PDF`` is an arbitary identifier of such a list of dependencies, to which other components can refer and have them installed. There are two common @@ -236,31 +256,35 @@ use cases. First is the console_scripts entry point: -.. code-block:: ini +.. tab:: setup.cfg - [metadata] - name = Project A - #... + .. code-block:: ini - [options] - #... - entry_points= - [console_scripts] - rst2pdf = project_a.tools.pdfgen [PDF] - rst2html = project_a.tools.htmlgen - -.. code-block:: python - - setup( - name = "Project-A" - #..., - entry_points={ - "console_scripts": [ - "rst2pdf = project_a.tools.pdfgen [PDF]", - "rst2html = project_a.tools.htmlgen", - ], - } - ) + [metadata] + name = Project A + #... + + [options] + #... + entry_points= + [console_scripts] + rst2pdf = project_a.tools.pdfgen [PDF] + rst2html = project_a.tools.htmlgen + +.. tab:: setup.py + + .. code-block:: python + + setup( + name = "Project-A" + #..., + entry_points={ + "console_scripts": [ + "rst2pdf = project_a.tools.pdfgen [PDF]", + "rst2html = project_a.tools.htmlgen", + ], + } + ) This syntax indicates that the entry point (in this case a console script) is only valid when the PDF extra is installed. It is up to the installer @@ -273,24 +297,28 @@ The second use case is that other package can use this "extra" for their own dependencies. For example, if "Project-B" needs "project A" with PDF support installed, it might declare the dependency like this: -.. code-block:: ini +.. tab:: setup.cfg - [metadata] - name = Project-B - #... + .. code-block:: ini - [options] - #... - install_requires = - Project-A[PDF] + [metadata] + name = Project-B + #... + + [options] + #... + install_requires = + Project-A[PDF] + +.. tab:: setup.py -.. code-block:: python + .. code-block:: python - setup( - name="Project-B", - install_requires=["Project-A[PDF]"], - ... - ) + setup( + name="Project-B", + install_requires=["Project-A[PDF]"], + ... + ) This will cause ReportLab to be installed along with project A, if project B is installed -- even if project A was already installed. In this way, a project diff --git a/docs/userguide/package_discovery.rst b/docs/userguide/package_discovery.rst index de4ef6682f6..842ade828d4 100644 --- a/docs/userguide/package_discovery.rst +++ b/docs/userguide/package_discovery.rst @@ -19,36 +19,44 @@ Package Discovery and Namespace Package support for namespace package. Normally, you would specify the package to be included manually in the following manner: -.. code-block:: ini - - [options] - #... - packages = - mypkg1 - mypkg2 +.. tab:: setup.cfg -.. code-block:: python + .. code-block:: ini - setup( + [options] #... - packages = ['mypkg1', 'mypkg2'] - ) + packages = + mypkg1 + mypkg2 + +.. tab:: setup.py + + .. code-block:: python + + setup( + #... + packages = ['mypkg1', 'mypkg2'] + ) This can get tiresome reallly quickly. To speed things up, we introduce two functions provided by setuptools: -.. code-block:: ini +.. tab:: setup.cfg - [options] - packages = find: - #or - packages = find_namespace: + .. code-block:: ini -.. code-block:: python + [options] + packages = find: + #or + packages = find_namespace: - from setuptools import find_packages - #or - from setuptools import find_namespace_packages +.. tab:: setup.py + + .. code-block:: python + + from setuptools import find_packages + #or + from setuptools import find_namespace_packages Using ``find:`` or ``find_packages`` @@ -71,30 +79,34 @@ it, consider the following directory To have your setup.cfg or setup.py to automatically include packages found in ``src`` that starts with the name ``pkg`` and not ``additional``: -.. code-block:: ini +.. tab:: setup.cfg - [options] - packages = find: - package_dir = - =src + .. code-block:: ini - [options.packages.find] - where = src - include = pkg* - exclude = additional + [options] + packages = find: + package_dir = + =src -.. code-block:: python + [options.packages.find] + where = src + include = pkg* + exclude = additional - setup( - #... - packages = find_packages( - where = 'src', - include = ['pkg*',], - exclude = ['additional',] - ), - package_dir = {"":"src"} - #... - ) +.. tab:: setup.py + + .. code-block:: python + + setup( + #... + packages = find_packages( + where = 'src', + include = ['pkg*',], + exclude = ['additional',] + ), + package_dir = {"":"src"} + #... + ) .. _Namespace Packages: @@ -195,17 +207,21 @@ following: And the ``namespace_packages`` keyword in your ``setup.cfg`` or ``setup.py``: -.. code-block:: ini +.. tab:: setup.cfg - [options] - namespace_packages = timmins + .. code-block:: ini -.. code-block:: python + [options] + namespace_packages = timmins + +.. tab:: setup.py + + .. code-block:: python - setup( - # ... - namespace_packages = ['timmins'] - ) + setup( + # ... + namespace_packages = ['timmins'] + ) And your directory should look like this diff --git a/docs/userguide/quickstart.rst b/docs/userguide/quickstart.rst index 1d557d47bd6..16cd4f71924 100644 --- a/docs/userguide/quickstart.rst +++ b/docs/userguide/quickstart.rst @@ -37,26 +37,45 @@ package your project: requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" -Then, you will need a ``setup.cfg`` to specify your package information, -such as metadata, contents, dependencies, etc. Here we demonstrate the minimum +Then, you will need a ``setup.cfg`` or ``setup.py`` to specify your package +information, such as metadata, contents, dependencies, etc. Here we demonstrate +the minimum -.. code-block:: ini +.. tab:: setup.cfg - [metadata] - name = mypackage - version = 0.0.1 + .. code-block:: ini - [options] - packages = mypackage - install_requires = - requests - importlib; python_version == "2.6" + [metadata] + name = mypackage + version = 0.0.1 + + [options] + packages = mypackage + install_requires = + requests + importlib; python_version == "2.6" + +.. tab:: setup.py + + .. code-block:: python + + from setuptools import setup + + setup( + name='mypackage"' + version='0.0.1', + packages=['mypackage'], + install_requires=[ + 'requests', + 'importlib; python_version == "2.6"', + ], + ) This is what your project would look like:: ~/mypackage/ pyproject.toml - setup.cfg + setup.cfg # or setup.py mypackage/__init__.py Then, you need an installer, such as `pep517 `_ From c88c4e8a443e34f739547aeb76f4d9e752c0c31c Mon Sep 17 00:00:00 2001 From: Amy Date: Sun, 28 Feb 2021 23:33:22 -0500 Subject: [PATCH 200/272] Add changelog --- changelog.d/2584.doc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2584.doc.rst diff --git a/changelog.d/2584.doc.rst b/changelog.d/2584.doc.rst new file mode 100644 index 00000000000..34740499635 --- /dev/null +++ b/changelog.d/2584.doc.rst @@ -0,0 +1 @@ +Added ``sphinx-inline-tabs`` extension to allow for comparison of ``setup.py`` and its equivalent ``setup.cfg`` -- by :user:`amy-lei` \ No newline at end of file From a2e9ae4cb75f9b00ddf37713ec307e5f00869737 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Tue, 2 Mar 2021 19:36:41 -0500 Subject: [PATCH 201/272] Add compatibility method to warn for future underscore change --- setuptools/dist.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index 6ae3886b1f9..fe5bd6f8f0f 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -598,7 +598,7 @@ def _parse_config_files(self, filenames=None): # noqa: C901 continue val = parser.get(section, opt) - opt = opt.replace('-', '_') + opt = self.dash_to_underscore_warning(opt) opt_dict[opt] = (filename, val) # Make the ConfigParser forget everything (so we retain @@ -623,6 +623,21 @@ def _parse_config_files(self, filenames=None): # noqa: C901 except ValueError as e: raise DistutilsOptionError(e) from e + def dash_to_underscore_warning(self, opt): + if opt in ( + 'home-page', 'download-url', 'author-email', + 'maintainer-email', 'long-description', 'build-base', + 'project-urls', 'license-file', 'license-files', + 'long-description-content-type', + ): + underscore_opt = opt.replace('-', '_') + warnings.warn( + "Usage of dash-separated '%s' will not be supported in future " + "versions. Please use the underscore name '%s' instead" + % (opt, underscore_opt)) + return underscore_opt + return opt + # FIXME: 'Distribution._set_command_options' is too complex (14) def _set_command_options(self, command_obj, option_dict=None): # noqa: C901 """ From d027d6d2140daf87079dd3bd186585a5b063269e Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Tue, 2 Mar 2021 20:13:06 -0500 Subject: [PATCH 202/272] Modify existing tests to be compatible with future underscore change --- setuptools/command/easy_install.py | 2 +- setuptools/tests/test_build_ext.py | 2 +- setuptools/tests/test_config.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index eeb21b5083a..0917804f412 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1190,7 +1190,7 @@ def _set_fetcher_options(self, base): for key, val in ei_opts.items(): if key not in fetch_directives: continue - fetch_options[key.replace('_', '-')] = val[1] + fetch_options[key] = val[1] # create a settings dictionary suitable for `edit_config` settings = dict(easy_install=fetch_options) cfg_filename = os.path.join(base, 'setup.cfg') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index be03893a1ba..b6deebe4e21 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -104,7 +104,7 @@ def test_build_ext_config_handling(tmpdir_cwd): 'setup.cfg': DALS( """ [build] - build-base = foo_build + build_base = foo_build """), } path.build(files) diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 6db86c7c583..0983f8362d4 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -210,8 +210,8 @@ def test_aliases(self, tmpdir): fake_env( tmpdir, '[metadata]\n' - 'author-email = test@test.com\n' - 'home-page = http://test.test.com/test/\n' + 'author_email = test@test.com\n' + 'home_page = http://test.test.com/test/\n' 'summary = Short summary\n' 'platform = a, b\n' 'classifier =\n' From 08d6a2f2b0fb4b57f749d0adaaca3efc158419cd Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Tue, 2 Mar 2021 22:54:53 -0500 Subject: [PATCH 203/272] Add test for conversion warning --- setuptools/tests/test_config.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 0983f8362d4..4a399179221 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -507,6 +507,25 @@ def test_not_utf8(self, tmpdir): with get_dist(tmpdir): pass + def test_dash_to_underscore_warning(self, tmpdir): + # dash_to_underscore_warning() is a method in setuptools.dist + # remove this test and method when dash convert to underscore in setup.cfg + # is no longer supported + fake_env( + tmpdir, + '[metadata]\n' + 'author-email = test@test.com\n' + 'maintainer_email = foo@foo.com\n' + ) + msg = ("Usage of dash-separated 'author-email' will not be supported " + "in future versions. " + "Please use the underscore name 'author_email' instead") + with pytest.warns(UserWarning, match=msg): + with get_dist(tmpdir) as dist: + metadata = dist.metadata + assert metadata.author_email == 'test@test.com' + assert metadata.maintainer_email == 'foo@foo.com' + class TestOptions: From 67a5991997659326fd1439a58e2140731144f08c Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Tue, 2 Mar 2021 23:25:39 -0500 Subject: [PATCH 204/272] Add test for dash preserved extras_require in setup.cfg --- setuptools/tests/test_config.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 4a399179221..eac26749d4b 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -791,6 +791,20 @@ def test_extras_require(self, tmpdir): } assert dist.metadata.provides_extras == set(['pdf', 'rest']) + def test_dash_preserved_extras_require(self, tmpdir): + fake_env( + tmpdir, + '[options.extras_require]\n' + 'foo-a = foo\n' + 'foo_b = test\n' + ) + + with get_dist(tmpdir) as dist: + assert dist.extras_require == { + 'foo-a': ['foo'], + 'foo_b': ['test'] + } + def test_entry_points(self, tmpdir): _, config = fake_env( tmpdir, From 4cd5f1a23bced5679f219387afacc59dd360bce5 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Tue, 2 Mar 2021 23:53:19 -0500 Subject: [PATCH 205/272] Add changelog --- changelog.d/1608.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1608.change.rst diff --git a/changelog.d/1608.change.rst b/changelog.d/1608.change.rst new file mode 100644 index 00000000000..77fcfd57b7c --- /dev/null +++ b/changelog.d/1608.change.rst @@ -0,0 +1 @@ +Removed the general conversion of dashes to underscores in the keys of :code:`setup.cfg` to support the usage of dashes. Added a compatibility method to warn users when they use a specific dash-separated key which in the future will only allow an underscore. Note: the method performs the dash to underscore conversion to preserve compatibility, but future versions will no longer support it -- by :user:`melissa-kun-li` \ No newline at end of file From 9c2b717818046a0d8679b4a97c63db2dc1e32d54 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Wed, 3 Mar 2021 16:42:16 -0500 Subject: [PATCH 206/272] Update warning for dash to underscore conversion --- changelog.d/1608.change.rst | 2 +- setuptools/dist.py | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/changelog.d/1608.change.rst b/changelog.d/1608.change.rst index 77fcfd57b7c..c0f493b16cc 100644 --- a/changelog.d/1608.change.rst +++ b/changelog.d/1608.change.rst @@ -1 +1 @@ -Removed the general conversion of dashes to underscores in the keys of :code:`setup.cfg` to support the usage of dashes. Added a compatibility method to warn users when they use a specific dash-separated key which in the future will only allow an underscore. Note: the method performs the dash to underscore conversion to preserve compatibility, but future versions will no longer support it -- by :user:`melissa-kun-li` \ No newline at end of file +Removed the conversion of dashes to underscores in the :code:`extras_require` and :code:`data_files` of :code:`setup.cfg` to support the usage of dashes. Method will warn users when they use a dash-separated key which in the future will only allow an underscore. Note: the method performs the dash to underscore conversion to preserve compatibility, but future versions will no longer support it -- by :user:`melissa-kun-li` \ No newline at end of file diff --git a/setuptools/dist.py b/setuptools/dist.py index fe5bd6f8f0f..40440a406a3 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -598,7 +598,7 @@ def _parse_config_files(self, filenames=None): # noqa: C901 continue val = parser.get(section, opt) - opt = self.dash_to_underscore_warning(opt) + opt = self.dash_to_underscore_warning(opt, section) opt_dict[opt] = (filename, val) # Make the ConfigParser forget everything (so we retain @@ -622,21 +622,19 @@ def _parse_config_files(self, filenames=None): # noqa: C901 setattr(self, alias or opt, val) except ValueError as e: raise DistutilsOptionError(e) from e - - def dash_to_underscore_warning(self, opt): - if opt in ( - 'home-page', 'download-url', 'author-email', - 'maintainer-email', 'long-description', 'build-base', - 'project-urls', 'license-file', 'license-files', - 'long-description-content-type', + + def dash_to_underscore_warning(self, opt, section): + if section in ( + 'options.extras_require', 'options.data_files', ): - underscore_opt = opt.replace('-', '_') + return opt + underscore_opt = opt.replace('-', '_') + if '-' in opt: warnings.warn( "Usage of dash-separated '%s' will not be supported in future " "versions. Please use the underscore name '%s' instead" % (opt, underscore_opt)) - return underscore_opt - return opt + return underscore_opt # FIXME: 'Distribution._set_command_options' is too complex (14) def _set_command_options(self, command_obj, option_dict=None): # noqa: C901 From 1af7000887487cfe1aa4d127a15e7802656f1e8a Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Wed, 3 Mar 2021 17:02:45 -0500 Subject: [PATCH 207/272] Dash to underscore compatibility --- setuptools/dist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index 40440a406a3..c074468ba91 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -622,7 +622,7 @@ def _parse_config_files(self, filenames=None): # noqa: C901 setattr(self, alias or opt, val) except ValueError as e: raise DistutilsOptionError(e) from e - + def dash_to_underscore_warning(self, opt, section): if section in ( 'options.extras_require', 'options.data_files', From b40d7f4174083c92ad532eccf9b13c2d8570accf Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Mar 2021 11:07:23 -0500 Subject: [PATCH 208/272] =?UTF-8?q?Bump=20version:=2054.0.0=20=E2=86=92=20?= =?UTF-8?q?54.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 9 +++++++++ changelog.d/1608.change.rst | 1 - setup.cfg | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/1608.change.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 25490e49c92..9a230643748 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 54.0.0 +current_version = 54.1.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 62f911aa891..3920b27e931 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v54.1.0 +------- + + +Changes +^^^^^^^ +* #1608: Removed the conversion of dashes to underscores in the :code:`extras_require` and :code:`data_files` of :code:`setup.cfg` to support the usage of dashes. Method will warn users when they use a dash-separated key which in the future will only allow an underscore. Note: the method performs the dash to underscore conversion to preserve compatibility, but future versions will no longer support it -- by :user:`melissa-kun-li` + + v54.0.0 ------- diff --git a/changelog.d/1608.change.rst b/changelog.d/1608.change.rst deleted file mode 100644 index c0f493b16cc..00000000000 --- a/changelog.d/1608.change.rst +++ /dev/null @@ -1 +0,0 @@ -Removed the conversion of dashes to underscores in the :code:`extras_require` and :code:`data_files` of :code:`setup.cfg` to support the usage of dashes. Method will warn users when they use a dash-separated key which in the future will only allow an underscore. Note: the method performs the dash to underscore conversion to preserve compatibility, but future versions will no longer support it -- by :user:`melissa-kun-li` \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index d60a9b2633d..18950611bc5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 54.0.0 +version = 54.1.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 265fb0eda039711e749bec09b512b91e9ce56627 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 5 Mar 2021 11:12:28 -0500 Subject: [PATCH 209/272] Extend extensions later in the file. Fixes flake8 failure and isolates the (sole) change from other concerns. --- docs/conf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 9082fb1d416..581d8d5e756 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,4 @@ -extensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker', 'sphinx_inline_tabs'] +extensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker'] master_doc = "index" @@ -93,3 +93,6 @@ html_theme = 'alabaster' templates_path = ['_templates'] html_sidebars = {'index': ['tidelift-sidebar.html']} + +# Add support for inline tabs +extensions += ['sphinx_inline_tabs'] From 132a6cde2a47f34680527258a3753a692e23b266 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Fri, 5 Mar 2021 23:03:15 -0500 Subject: [PATCH 210/272] Warn for uppercase usage in setup.cfg metadata --- setuptools/dist.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/setuptools/dist.py b/setuptools/dist.py index c074468ba91..43a51ad8083 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -599,6 +599,7 @@ def _parse_config_files(self, filenames=None): # noqa: C901 val = parser.get(section, opt) opt = self.dash_to_underscore_warning(opt, section) + opt = self.uppercase_warning(opt, section) opt_dict[opt] = (filename, val) # Make the ConfigParser forget everything (so we retain @@ -636,6 +637,17 @@ def dash_to_underscore_warning(self, opt, section): % (opt, underscore_opt)) return underscore_opt + def uppercase_warning(self, opt, section): + if section in ('metadata',) and (any(c.isupper() for c in opt)): + lowercase_opt = opt.lower() + warnings.warn( + "Usage of uppercase key '%s' in '%s' will be deprecated in future " + "versions. Please use lowercase '%s' instead" + % (opt, section, lowercase_opt) + ) + return lowercase_opt + return opt + # FIXME: 'Distribution._set_command_options' is too complex (14) def _set_command_options(self, command_obj, option_dict=None): # noqa: C901 """ From fa48ac3626c21efc5261b4f112270ca40d2e004d Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Fri, 5 Mar 2021 23:20:59 -0500 Subject: [PATCH 211/272] Test for uppercase metadata warning --- setuptools/tests/test_config.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index eac26749d4b..454ffb245e5 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -526,6 +526,24 @@ def test_dash_to_underscore_warning(self, tmpdir): assert metadata.author_email == 'test@test.com' assert metadata.maintainer_email == 'foo@foo.com' + def test_uppercase_warning(self, tmpdir): + # remove this test and the method uppercase_warning() in setuptools.dist + # when no longer needed + fake_env( + tmpdir, + '[metadata]\n' + 'Name = foo\n' + 'description = Some description\n' + ) + msg = ("Usage of uppercase key 'Name' in 'metadata' will be deprecated in " + "future versions. " + "Please use lowercase 'name' instead") + with pytest.warns(UserWarning, match=msg): + with get_dist(tmpdir) as dist: + metadata = dist.metadata + assert metadata.name == 'foo' + assert metadata.description == 'Some description' + class TestOptions: From 28c7abc9516821cb701be5576ccd274a3b0c0389 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Sat, 6 Mar 2021 00:00:37 -0500 Subject: [PATCH 212/272] Add changelog --- changelog.d/2592.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2592.change.rst diff --git a/changelog.d/2592.change.rst b/changelog.d/2592.change.rst new file mode 100644 index 00000000000..3dbe816fd8e --- /dev/null +++ b/changelog.d/2592.change.rst @@ -0,0 +1 @@ +Warned for usage of uppercase keys in :code:`metadata` in :code:`setup.cfg`, restored some compatiblity by transforming to lowercase if not. Followed the change of keys in :code:`setup.cfg` now being case-sensitive -- by :user:`melissa-kun-li` \ No newline at end of file From bf9fae2c0df316dc837d56ae68880620733d5ff6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 6 Mar 2021 09:57:43 -0500 Subject: [PATCH 213/272] Require twine 3 with keyring unconditionally required. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 249f97c24f1..a9a50b01a60 100644 --- a/tox.ini +++ b/tox.ini @@ -25,7 +25,7 @@ commands = skip_install = True deps = build - twine[keyring]>=1.13 + twine>=3 path jaraco.develop>=7.1 passenv = From 9acf04c1461fd013fc0a1bd95158e74c7cf437d4 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 7 Mar 2021 01:38:02 +0100 Subject: [PATCH 214/272] Introduce issue forms in the repo --- .github/ISSUE_TEMPLATE/bug-report.yml | 130 ++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 15 ++ .../ISSUE_TEMPLATE/documentation-report.yml | 93 +++++++++++++ .github/ISSUE_TEMPLATE/feature-request.yml | 105 ++++++++++++++ 4 files changed, 343 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug-report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/documentation-report.yml create mode 100644 .github/ISSUE_TEMPLATE/feature-request.yml diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 00000000000..5f551a4be74 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,130 @@ +--- +name: 🐛 Bug report +description: >- + Create a report to help us improve when + something is not working correctly +title: '[BUG] ' +labels: +- bug +- Needs Triage +issue_body: false # default: true, adds a classic WSYWIG textarea, if on + +body: +- type: markdown + attributes: + value: > + **Thank you for wanting to report a bug in setuptools!** + + + ⚠ + Verify first that your issue is not + [already reported on GitHub][issue search] and keep in mind and + keep in mind that we may have to keep the current behavior because + [every change breaks someone's workflow][XKCD 1172]. + We try to be mindful about this. + + Also test if the latest release and main branch are affected too. + + + If you are seeking community support, please consider + [starting a discussion][Discussions]. + + + Thank you for your collaboration! + + + [Discussions]: https://github.com/pypa/setuptools/discussions + + [issue search]: https://github.com/pypa/setuptools/search?q=is%3Aissue&type=issues + + [XKCD 1172]: https://xkcd.com/1172/ + +- type: markdown + attributes: + value: >- + **Environment** +- type: input + attributes: + label: setuptools version + placeholder: For example, setuptools===60.4.2 + validations: + required: true +- type: input + attributes: + label: Python version + placeholder: For example, Python 3.10 + validations: + required: true +- type: input + attributes: + label: OS + placeholder: For example, Gentoo Linux, RHEL 8, Arch Linux, macOS etc. + validations: + required: true +- type: textarea + attributes: + label: Additional environment information + description: >- + Feel free to add more information about your environment here. + placeholder: >- + This is only happening when I run setuptools on my fridge's patched firmware 🤯 + +- type: textarea + attributes: + label: Description + description: >- + A clear and concise description of what the bug is. + placeholder: >- + I tried doing X and I expected it to result in Y because the docs + mentioned Z but what happened next what totally unexpected! + And here's why... + validations: + required: true + +- type: textarea + attributes: + label: Expected behavior + description: >- + A clear and concise description of what you expected to happen. + placeholder: >- + I tried doing X and I expected it to result in Y. I'm confused... + validations: + required: true + +- type: textarea + attributes: + label: How to Reproduce + description: >- + Describe the steps to reproduce this bug. + placeholder: | + 1. Integrate setuptools via '...' + 2. Then run '...' + 3. An error occurs. + validations: + required: true + +- type: textarea + attributes: + label: Output + description: >- + Paste the output of the steps above, including the commands + themselves and setuptools' output/traceback etc. + value: | + ```console + + ``` + validations: + required: true + + +- type: checkboxes + attributes: + label: Code of Conduct + description: | + Read the [PSF Code of Conduct][CoC] first. + + [CoC]: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md + options: + - label: I agree to follow the PSF Code of Conduct + required: true +... diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000000..dde102ca116 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,15 @@ +# Ref: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser +blank_issues_enabled: false # default: true +contact_links: +- name: 🤔 Have questions or need support? + url: https://github.com/pypa/setuptools/discussions + about: This is a place for the community to exchange ideas and recipes +- name: 💬 Discourse + url: https://discuss.python.org/c/packaging + about: | + Please ask typical Q&A here: general ideas for Python packaging, + questions about structuring projects and so on +- name: >- + 💬 IRC: #pypa @ Freenode + url: https://webchat.freenode.net/#pypa + about: Chat with devs diff --git a/.github/ISSUE_TEMPLATE/documentation-report.yml b/.github/ISSUE_TEMPLATE/documentation-report.yml new file mode 100644 index 00000000000..a947dad83ed --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation-report.yml @@ -0,0 +1,93 @@ +--- +name: 📝 Documentation Report +title: '[Docs] ' +description: Ask us about docs +labels: +- documentation +- Needs Triage +# NOTE: issue body is enabled to allow screenshots +issue_body: true # default: true, adds a classic WSYWIG textarea, if on + +body: +- type: markdown + attributes: + value: > + **Thank you for wanting to report a problem with setuptools + documentation!** + + + Please fill out your suggestions below. If the problem seems + straightforward, feel free to go ahead and + submit a pull request instead! + + + ⚠ + Verify first that your issue is not [already reported on + GitHub][issue search]. + + + If you are seeking community support, please consider + [starting a discussion][Discussions]. + + + Thank you for your collaboration! + + + [issue search]: https://github.com/pypa/setuptools/search?q=is%3Aissue&type=issues + + [Discussions]: https://github.com/pypa/setuptools/discussions + +- type: textarea + attributes: + label: Summary + description: > + Explain the problem briefly below, add suggestions to wording + or structure. + + + **HINT:** Did you know the documentation has a `View on GitHub` + link on every page? Feel free to use it to start a pull request + right from the GitHub UI! + placeholder: >- + I was reading the setuptools documentation of version X and I'm + having problems understanding Y. It would be very helpful if that + got rephrased as Z. + validations: + required: true + +- type: textarea + attributes: + label: OS / Environment + description: >- + Provide all relevant information below, e.g. OS version, + browser, etc. + placeholder: Fedora 33, Firefox etc. + + +- type: checkboxes + attributes: + label: Code of Conduct + description: | + Read the [PSF Code of Conduct][CoC] first. + + [CoC]: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md + options: + - label: I agree to follow the PSF Code of Conduct + required: true + + +- type: markdown + attributes: + value: > + + + ### Additional Information + + + Describe how this improves the documentation, e.g. before/after + situation or screenshots. + + + **HINT:** You can paste https://gist.github.com links for + larger files. +... diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 00000000000..7dec35a8dca --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,105 @@ +--- +name: ✨ Feature request +description: Suggest an idea for setuptools +title: '[FR] ' +labels: +- enhancement +- Needs Triage +issue_body: false # default: true, adds a classic WSYWIG textarea, if on + +body: +- type: markdown + attributes: + value: > + **Thank you for wanting to suggest a feature for setuptools!** + + + 💡 + Before you go ahead with your request, please first consider if it + would be useful for majority of the setuptools users. As a general + rule of thumb, any feature that is only of interest to a small sub + group should be implemented in a third-party plugin or maybe even + just your project alone. Be mindful of the fact that the core + setuptools features have a broad impact. + + +
+ + ❗ Every change breaks someone's workflow. + + + + [![❗ Every change breaks someone's workflow.](https://imgs.xkcd.com/comics/workflow.png) + ](https://xkcd.com/1172/) +
+ + + ⚠ + Verify first that your idea is not [already requested on GitHub][issue search]. + + + + [issue search]: https://github.com/pypa/setuptools/search?q=is%3Aissue&type=issues + +- type: textarea + attributes: + label: What's the problem this feature will solve? + description: >- + What are you trying to do, that you are unable to achieve + with setuptools as it currently stands? + placeholder: >- + I'm trying to do X and I'm missing feature Y for this to be + easily achievable. + validations: + required: true + +- type: textarea + attributes: + label: Describe the solution you'd like + description: > + Clear and concise description of what you want to happen. + + + Provide examples of real world use cases that this would enable + and how it solves the problem described above. + placeholder: >- + When I do X, I want to achieve Y in a situation when Z. + validations: + required: true + +- type: textarea + attributes: + label: Alternative Solutions + description: >- + Have you tried to workaround the problem using other tools? Or a + different approach to solving this issue? Please elaborate here. + placeholder: >- + I tried doing X, Y and Z. But they are subobpimal because of P. + +- type: textarea + attributes: + label: Additional context + description: > + Add any other context, links, etc. about the feature here. + Describe how the feature would be used, why it is needed and what + it would solve. + + + **HINT:** You can paste https://gist.github.com links for + larger files. + placeholder: >- + I asked on https://stackoverflow.com/.... and the community + advised me to do X, Y and Z. + + +- type: checkboxes + attributes: + label: Code of Conduct + description: | + Read the [PSF Code of Conduct][CoC] first. + + [CoC]: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md + options: + - label: I agree to follow the PSF Code of Conduct + required: true +... From 0bffc7c1c673f9735bdac71a2949fae809ec07a3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 6 Mar 2021 21:47:15 -0500 Subject: [PATCH 215/272] Apply suggestions in code review. Co-authored-by: Sviatoslav Sydorenko --- changelog.d/2592.change.rst | 4 +++- setuptools/dist.py | 23 ++++++++++++----------- setuptools/tests/test_config.py | 5 +++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/changelog.d/2592.change.rst b/changelog.d/2592.change.rst index 3dbe816fd8e..a38ae0c4c43 100644 --- a/changelog.d/2592.change.rst +++ b/changelog.d/2592.change.rst @@ -1 +1,3 @@ -Warned for usage of uppercase keys in :code:`metadata` in :code:`setup.cfg`, restored some compatiblity by transforming to lowercase if not. Followed the change of keys in :code:`setup.cfg` now being case-sensitive -- by :user:`melissa-kun-li` \ No newline at end of file +Made option keys in the ``[metadata]`` section of ``setup.cfg`` case-sensitive. Users having +uppercase option spellings will get a warning suggesting to make them to lowercase +-- by :user:`melissa-kun-li` diff --git a/setuptools/dist.py b/setuptools/dist.py index 43a51ad8083..70c0e6becb8 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -599,7 +599,7 @@ def _parse_config_files(self, filenames=None): # noqa: C901 val = parser.get(section, opt) opt = self.dash_to_underscore_warning(opt, section) - opt = self.uppercase_warning(opt, section) + opt = self.make_option_lowercase(opt, section) opt_dict[opt] = (filename, val) # Make the ConfigParser forget everything (so we retain @@ -637,16 +637,17 @@ def dash_to_underscore_warning(self, opt, section): % (opt, underscore_opt)) return underscore_opt - def uppercase_warning(self, opt, section): - if section in ('metadata',) and (any(c.isupper() for c in opt)): - lowercase_opt = opt.lower() - warnings.warn( - "Usage of uppercase key '%s' in '%s' will be deprecated in future " - "versions. Please use lowercase '%s' instead" - % (opt, section, lowercase_opt) - ) - return lowercase_opt - return opt + def make_option_lowercase(self, opt, section): + if section != 'metadata' or opt.islower(): + return opt + + lowercase_opt = opt.lower() + warnings.warn( + "Usage of uppercase key '%s' in '%s' will be deprecated in future " + "versions. Please use lowercase '%s' instead" + % (opt, section, lowercase_opt) + ) + return lowercase_opt # FIXME: 'Distribution._set_command_options' is too complex (14) def _set_command_options(self, command_obj, option_dict=None): # noqa: C901 diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 454ffb245e5..1ff5ee41859 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -541,8 +541,9 @@ def test_uppercase_warning(self, tmpdir): with pytest.warns(UserWarning, match=msg): with get_dist(tmpdir) as dist: metadata = dist.metadata - assert metadata.name == 'foo' - assert metadata.description == 'Some description' + + assert metadata.name == 'foo' + assert metadata.description == 'Some description' class TestOptions: From 66323adeae5cb2d143d00db13fd96686c0887233 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 6 Mar 2021 21:49:29 -0500 Subject: [PATCH 216/272] Make change a bugfix --- changelog.d/{2592.change.rst => 2592.bugfix.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/{2592.change.rst => 2592.bugfix.rst} (100%) diff --git a/changelog.d/2592.change.rst b/changelog.d/2592.bugfix.rst similarity index 100% rename from changelog.d/2592.change.rst rename to changelog.d/2592.bugfix.rst From c71b7bdbd0148bda4924d4c9fc84c574e5e4c227 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 6 Mar 2021 22:02:58 -0500 Subject: [PATCH 217/272] The term is misc :/ --- changelog.d/{2592.bugfix.rst => 2592.misc.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/{2592.bugfix.rst => 2592.misc.rst} (100%) diff --git a/changelog.d/2592.bugfix.rst b/changelog.d/2592.misc.rst similarity index 100% rename from changelog.d/2592.bugfix.rst rename to changelog.d/2592.misc.rst From d2ae3cd2cfc66c300bc6661ca33f0ba1f651fd56 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 6 Mar 2021 22:04:03 -0500 Subject: [PATCH 218/272] =?UTF-8?q?Bump=20version:=2054.1.0=20=E2=86=92=20?= =?UTF-8?q?54.1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 15 +++++++++++++++ changelog.d/2584.doc.rst | 1 - changelog.d/2592.misc.rst | 3 --- setup.cfg | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) delete mode 100644 changelog.d/2584.doc.rst delete mode 100644 changelog.d/2592.misc.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 9a230643748..1d2c2278391 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 54.1.0 +current_version = 54.1.1 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 3920b27e931..bedd1faa017 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,18 @@ +v54.1.1 +------- + + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ +* #2584: Added ``sphinx-inline-tabs`` extension to allow for comparison of ``setup.py`` and its equivalent ``setup.cfg`` -- by :user:`amy-lei` + +Misc +^^^^ +* #2592: Made option keys in the ``[metadata]`` section of ``setup.cfg`` case-sensitive. Users having + uppercase option spellings will get a warning suggesting to make them to lowercase + -- by :user:`melissa-kun-li` + + v54.1.0 ------- diff --git a/changelog.d/2584.doc.rst b/changelog.d/2584.doc.rst deleted file mode 100644 index 34740499635..00000000000 --- a/changelog.d/2584.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Added ``sphinx-inline-tabs`` extension to allow for comparison of ``setup.py`` and its equivalent ``setup.cfg`` -- by :user:`amy-lei` \ No newline at end of file diff --git a/changelog.d/2592.misc.rst b/changelog.d/2592.misc.rst deleted file mode 100644 index a38ae0c4c43..00000000000 --- a/changelog.d/2592.misc.rst +++ /dev/null @@ -1,3 +0,0 @@ -Made option keys in the ``[metadata]`` section of ``setup.cfg`` case-sensitive. Users having -uppercase option spellings will get a warning suggesting to make them to lowercase --- by :user:`melissa-kun-li` diff --git a/setup.cfg b/setup.cfg index bc31dc2e6b0..7b05eed32f1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 54.1.0 +version = 54.1.1 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 7bdab57872da46ef6a5a7f5ea9099a197bdc3131 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 7 Mar 2021 12:23:48 -0500 Subject: [PATCH 219/272] Add comments indicating why the exclusions are present --- setup.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.cfg b/setup.cfg index 81f70eeab73..dd215c65bb8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,8 +34,10 @@ testing = pytest >= 4.6 pytest-checkdocs >= 1.2.3 pytest-flake8 + # python_implementation: workaround for jaraco/skeleton#22 pytest-black >= 0.3.7; python_implementation != "PyPy" pytest-cov + # python_implementation: workaround for jaraco/skeleton#22 pytest-mypy; python_implementation != "PyPy" pytest-enabler From 14312a5bd75d3313ffd3e14fc7fbbc2a9b05cee5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 7 Mar 2021 12:24:21 -0500 Subject: [PATCH 220/272] Exclude mypy on Python 3.10 as workaround for python/typed_ast#156. --- setup.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index dd215c65bb8..55497f8efc9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -38,7 +38,8 @@ testing = pytest-black >= 0.3.7; python_implementation != "PyPy" pytest-cov # python_implementation: workaround for jaraco/skeleton#22 - pytest-mypy; python_implementation != "PyPy" + # python_version: workaround for python/typed_ast#156 + pytest-mypy; python_implementation != "PyPy" and python_version < "3.10" pytest-enabler # local From af5445115af0cb68e671a678538a0207389586be Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 7 Mar 2021 12:30:25 -0500 Subject: [PATCH 221/272] Bump minimums on pytest-checkdocs and pytest-enabler as found on Setuptools. --- setup.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 55497f8efc9..3f6610be8b6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,7 +32,7 @@ exclude = testing = # upstream pytest >= 4.6 - pytest-checkdocs >= 1.2.3 + pytest-checkdocs >= 2.4 pytest-flake8 # python_implementation: workaround for jaraco/skeleton#22 pytest-black >= 0.3.7; python_implementation != "PyPy" @@ -40,7 +40,7 @@ testing = # python_implementation: workaround for jaraco/skeleton#22 # python_version: workaround for python/typed_ast#156 pytest-mypy; python_implementation != "PyPy" and python_version < "3.10" - pytest-enabler + pytest-enabler >= 1.0.1 # local From 86efb884f805a9e1f64661ec758f3bd084fed515 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 7 Mar 2021 12:53:54 -0500 Subject: [PATCH 222/272] Also deny black on Python 3.10 as workaround for python/typed_ast#156. --- setup.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 3f6610be8b6..52876d55f67 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,8 @@ testing = pytest-checkdocs >= 2.4 pytest-flake8 # python_implementation: workaround for jaraco/skeleton#22 - pytest-black >= 0.3.7; python_implementation != "PyPy" + # python_version: workaround for python/typed_ast#156 + pytest-black >= 0.3.7; python_implementation != "PyPy" and python_version < "3.10" pytest-cov # python_implementation: workaround for jaraco/skeleton#22 # python_version: workaround for python/typed_ast#156 From b2f7b8f92725c63b164d5776f85e67cc560def4e Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 7 Mar 2021 13:37:29 -0500 Subject: [PATCH 223/272] Don't bother testing old versions of pip on Python 3.10 and later. Fixes #2599. --- setuptools/tests/test_virtualenv.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index f13f7997e3d..9cf6d30f7dd 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -74,10 +74,15 @@ def mark(param, *marks): def skip_network(param): return param if network else mark(param, pytest.mark.skip(reason="no network")) + issue2599 = pytest.mark.skipif( + sys.version_info > (3, 10), + reason="pypa/setuptools#2599", + ) + network_versions = [ - 'pip==9.0.3', - 'pip==10.0.1', - 'pip==18.1', + mark('pip==9.0.3', issue2599), + mark('pip==10.0.1', issue2599), + mark('pip==18.1', issue2599), mark('pip==19.3.1', pytest.mark.xfail(reason='pypa/pip#6599')), 'pip==20.0.2', 'https://github.com/pypa/pip/archive/master.zip', From 938a33922c8cba3bbff6dfd1c2f723e5f929d6ce Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Mon, 8 Mar 2021 02:59:16 -0500 Subject: [PATCH 224/272] Reduce scope of dash deprecation warning to Setuptools and distutils --- setuptools/dist.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/setuptools/dist.py b/setuptools/dist.py index 70c0e6becb8..d1587e3415e 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -11,6 +11,7 @@ import distutils.core import distutils.cmd import distutils.dist +import distutils.command from distutils.util import strtobool from distutils.debug import DEBUG from distutils.fancy_getopt import translate_longopt @@ -29,6 +30,7 @@ from . import SetuptoolsDeprecationWarning import setuptools +import setuptools.command from setuptools import windows_support from setuptools.monkey import get_unpatched from setuptools.config import parse_configuration @@ -629,7 +631,13 @@ def dash_to_underscore_warning(self, opt, section): 'options.extras_require', 'options.data_files', ): return opt + underscore_opt = opt.replace('-', '_') + commands = distutils.command.__all__ + setuptools.command.__all__ + if (not section.startswith('options') and section != 'metadata' + and section not in commands): + return underscore_opt + if '-' in opt: warnings.warn( "Usage of dash-separated '%s' will not be supported in future " From 7129ad1107f7015fe16f275eec17bf36a8badd84 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Mon, 8 Mar 2021 03:25:14 -0500 Subject: [PATCH 225/272] Fix formatting of tests and change dash deprecation method name --- setuptools/dist.py | 4 ++-- setuptools/tests/test_config.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index d1587e3415e..7cebcb37f48 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -600,7 +600,7 @@ def _parse_config_files(self, filenames=None): # noqa: C901 continue val = parser.get(section, opt) - opt = self.dash_to_underscore_warning(opt, section) + opt = self.warn_dash_deprecation(opt, section) opt = self.make_option_lowercase(opt, section) opt_dict[opt] = (filename, val) @@ -626,7 +626,7 @@ def _parse_config_files(self, filenames=None): # noqa: C901 except ValueError as e: raise DistutilsOptionError(e) from e - def dash_to_underscore_warning(self, opt, section): + def warn_dash_deprecation(self, opt, section): if section in ( 'options.extras_require', 'options.data_files', ): diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 1ff5ee41859..21f1becd499 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -507,10 +507,9 @@ def test_not_utf8(self, tmpdir): with get_dist(tmpdir): pass - def test_dash_to_underscore_warning(self, tmpdir): - # dash_to_underscore_warning() is a method in setuptools.dist - # remove this test and method when dash convert to underscore in setup.cfg - # is no longer supported + def test_warn_dash_deprecation(self, tmpdir): + # warn_dash_deprecation() is a method in setuptools.dist + # remove this test and the method when no longer needed fake_env( tmpdir, '[metadata]\n' @@ -523,11 +522,12 @@ def test_dash_to_underscore_warning(self, tmpdir): with pytest.warns(UserWarning, match=msg): with get_dist(tmpdir) as dist: metadata = dist.metadata - assert metadata.author_email == 'test@test.com' - assert metadata.maintainer_email == 'foo@foo.com' - def test_uppercase_warning(self, tmpdir): - # remove this test and the method uppercase_warning() in setuptools.dist + assert metadata.author_email == 'test@test.com' + assert metadata.maintainer_email == 'foo@foo.com' + + def test_make_option_lowercase(self, tmpdir): + # remove this test and the method make_option_lowercase() in setuptools.dist # when no longer needed fake_env( tmpdir, From 214ba3de5cf8bf6cdff824059732eebd26f3d40c Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Mon, 8 Mar 2021 03:41:04 -0500 Subject: [PATCH 226/272] Add changelog --- changelog.d/2595.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2595.misc.rst diff --git a/changelog.d/2595.misc.rst b/changelog.d/2595.misc.rst new file mode 100644 index 00000000000..976117dc9a8 --- /dev/null +++ b/changelog.d/2595.misc.rst @@ -0,0 +1 @@ +Reduced scope of dash deprecation warning to Setuptools/distutils only -- by :user:`melissa-kun-li` \ No newline at end of file From e6fdc967a538c7c08768a4898317572a76de2f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 12 Feb 2021 09:55:57 +0100 Subject: [PATCH 227/272] Remove bdist_wininst Fixes https://github.com/pypa/setuptools/issues/2558 --- changelog.d/2566.breaking.rst | 1 + setuptools/command/__init__.py | 2 +- setuptools/command/bdist_wininst.py | 30 --------------------- setuptools/command/install_scripts.py | 3 ++- setuptools/tests/test_bdist_deprecations.py | 23 ---------------- 5 files changed, 4 insertions(+), 55 deletions(-) create mode 100644 changelog.d/2566.breaking.rst delete mode 100644 setuptools/command/bdist_wininst.py delete mode 100644 setuptools/tests/test_bdist_deprecations.py diff --git a/changelog.d/2566.breaking.rst b/changelog.d/2566.breaking.rst new file mode 100644 index 00000000000..e56945750b5 --- /dev/null +++ b/changelog.d/2566.breaking.rst @@ -0,0 +1 @@ +Remove the deprecated ``bdist_wininst`` command. Binary packages should be built as wheels instead. -- by :user:`hroncok` diff --git a/setuptools/command/__init__.py b/setuptools/command/__init__.py index 743f5588faf..570e69576e9 100644 --- a/setuptools/command/__init__.py +++ b/setuptools/command/__init__.py @@ -2,7 +2,7 @@ 'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop', 'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts', 'sdist', 'setopt', 'test', 'install_egg_info', 'install_scripts', - 'bdist_wininst', 'upload_docs', 'build_clib', 'dist_info', + 'upload_docs', 'build_clib', 'dist_info', ] from distutils.command.bdist import bdist diff --git a/setuptools/command/bdist_wininst.py b/setuptools/command/bdist_wininst.py deleted file mode 100644 index ff4b6345921..00000000000 --- a/setuptools/command/bdist_wininst.py +++ /dev/null @@ -1,30 +0,0 @@ -import distutils.command.bdist_wininst as orig -import warnings - -from setuptools import SetuptoolsDeprecationWarning - - -class bdist_wininst(orig.bdist_wininst): - def reinitialize_command(self, command, reinit_subcommands=0): - """ - Supplement reinitialize_command to work around - http://bugs.python.org/issue20819 - """ - cmd = self.distribution.reinitialize_command( - command, reinit_subcommands) - if command in ('install', 'install_lib'): - cmd.install_lib = None - return cmd - - def run(self): - warnings.warn( - "bdist_wininst is deprecated and will be removed in a future " - "version. Use bdist_wheel (wheel packages) instead.", - SetuptoolsDeprecationWarning - ) - - self._is_running = True - try: - orig.bdist_wininst.run(self) - finally: - self._is_running = False diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index 8c9a15e2bbd..9cd8eb06277 100644 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -1,5 +1,6 @@ from distutils import log import distutils.command.install_scripts as orig +from distutils.errors import DistutilsModuleError import os import sys @@ -35,7 +36,7 @@ def run(self): try: bw_cmd = self.get_finalized_command("bdist_wininst") is_wininst = getattr(bw_cmd, '_is_running', False) - except ImportError: + except (ImportError, DistutilsModuleError): is_wininst = False writer = ei.ScriptWriter if is_wininst: diff --git a/setuptools/tests/test_bdist_deprecations.py b/setuptools/tests/test_bdist_deprecations.py deleted file mode 100644 index 704164aacb4..00000000000 --- a/setuptools/tests/test_bdist_deprecations.py +++ /dev/null @@ -1,23 +0,0 @@ -"""develop tests -""" -import mock - -import pytest - -from setuptools.dist import Distribution -from setuptools import SetuptoolsDeprecationWarning - - -@mock.patch("distutils.command.bdist_wininst.bdist_wininst") -def test_bdist_wininst_warning(distutils_cmd): - dist = Distribution(dict( - script_name='setup.py', - script_args=['bdist_wininst'], - name='foo', - py_modules=['hi'], - )) - dist.parse_command_line() - with pytest.warns(SetuptoolsDeprecationWarning): - dist.run_commands() - - distutils_cmd.run.assert_called_once() From 5d60ccefb48329b7cedfe6d78fc1cb95683104b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 12 Feb 2021 09:56:14 +0100 Subject: [PATCH 228/272] Filter out distutils deprecation warning until the situation is resolved The distutils platform problems are likely to be resolved before the removal. Once this happens, setuptools will no longer use distutils from the Python standard library. --- _distutils_hack/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index c31edfed172..47ce24944bc 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -8,6 +8,11 @@ is_pypy = '__pypy__' in sys.builtin_module_names +warnings.filterwarnings('ignore', + '.+ distutils .+ deprecated', + DeprecationWarning) + + def warn_distutils_present(): if 'distutils' not in sys.modules: return From 8230bbf82b07d25bcc65e612e0e936dce269e463 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 14 Mar 2021 11:08:14 -0400 Subject: [PATCH 229/272] =?UTF-8?q?Bump=20version:=2054.1.1=20=E2=86=92=20?= =?UTF-8?q?54.1.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 9 +++++++++ changelog.d/2595.misc.rst | 1 - setup.cfg | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/2595.misc.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 1d2c2278391..2c0c640ec07 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 54.1.1 +current_version = 54.1.2 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index bedd1faa017..c8db71ee59d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v54.1.2 +------- + + +Misc +^^^^ +* #2595: Reduced scope of dash deprecation warning to Setuptools/distutils only -- by :user:`melissa-kun-li` + + v54.1.1 ------- diff --git a/changelog.d/2595.misc.rst b/changelog.d/2595.misc.rst deleted file mode 100644 index 976117dc9a8..00000000000 --- a/changelog.d/2595.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Reduced scope of dash deprecation warning to Setuptools/distutils only -- by :user:`melissa-kun-li` \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 7da11a03ee4..2c4cb02fbb9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 54.1.1 +version = 54.1.2 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 7fe4ab8294a843622d20face7f9f6ccddb2d0a14 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 15 Mar 2021 18:31:04 -0400 Subject: [PATCH 230/272] Add leading */ to coverage.run.omit. Workaround for pytest-dev/pytest-cov#456. --- .coveragerc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.coveragerc b/.coveragerc index 45823064a3c..6a34e662d39 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,5 +1,7 @@ [run] -omit = .tox/* +omit = + # leading `*/` for pytest-dev/pytest-cov#456 + */.tox/* [report] show_missing = True From 024b1e13b644cc9829d2a15cd5867920e11c9a9e Mon Sep 17 00:00:00 2001 From: layday Date: Tue, 16 Mar 2021 18:58:11 +0200 Subject: [PATCH 231/272] build_meta: produce informative error when a dist is not found Previously, when `build_sdist` or `build_wheel` were unable to build a distribution (and were therefore unable to find the distribution file), they would throw a ValueError: not enough values to unpack (expected 1, got 0) which did not offer any clues as to where the issue might lie. --- changelog.d/2608.change.rst | 2 ++ setuptools/build_meta.py | 8 ++++++-- setuptools/tests/test_build_meta.py | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 changelog.d/2608.change.rst diff --git a/changelog.d/2608.change.rst b/changelog.d/2608.change.rst new file mode 100644 index 00000000000..d469f15e2ea --- /dev/null +++ b/changelog.d/2608.change.rst @@ -0,0 +1,2 @@ +Added informative error message to PEP 517 build failures owing to +an empty ``setup.py`` -- by :user:layday diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py index b9e8a2b3faa..3c45db72fbd 100644 --- a/setuptools/build_meta.py +++ b/setuptools/build_meta.py @@ -101,8 +101,12 @@ def _file_with_extension(directory, extension): f for f in os.listdir(directory) if f.endswith(extension) ) - file, = matching - return file + try: + return next(matching) + except StopIteration: + raise ValueError('No distribution was found. The distribution was ' + 'possibly not built. Ensure that your `setup.py` ' + 'is not empty and that it calls `setup()`.') def _open_setup_script(setup_script): diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index f33a69688d1..f776b09d71b 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -3,6 +3,7 @@ import tarfile import importlib from concurrent import futures +import re import pytest from jaraco import path @@ -442,6 +443,19 @@ def test_sys_argv_passthrough(self, tmpdir_cwd): with pytest.raises(AssertionError): build_backend.build_sdist("temp") + @pytest.mark.parametrize('build_hook', ('build_sdist', 'build_wheel')) + def test_build_with_empty_setuppy(self, build_backend, build_hook): + files = {'setup.py': ''} + path.build(files) + + with pytest.raises( + ValueError, + match=re.escape( + 'No distribution was found. The distribution was ' + 'possibly not built. Ensure that your `setup.py` ' + 'is not empty and that it calls `setup()`.')): + getattr(build_backend, build_hook)("temp") + class TestBuildMetaLegacyBackend(TestBuildMetaBackend): backend_name = 'setuptools.build_meta:__legacy__' From 8f2cc7a1f6cfbfdd8fd07b92dc086b24f2d00e41 Mon Sep 17 00:00:00 2001 From: layday Date: Tue, 16 Mar 2021 19:10:19 +0200 Subject: [PATCH 232/272] fixup! build_meta: produce informative error when a dist is not found --- changelog.d/2608.change.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/2608.change.rst b/changelog.d/2608.change.rst index d469f15e2ea..f966649ae79 100644 --- a/changelog.d/2608.change.rst +++ b/changelog.d/2608.change.rst @@ -1,2 +1,2 @@ Added informative error message to PEP 517 build failures owing to -an empty ``setup.py`` -- by :user:layday +an empty ``setup.py`` -- by :user:`layday` From b4d8e4755eafc786a9848333ca73bff381747745 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 20 Mar 2021 21:19:49 -0400 Subject: [PATCH 233/272] Add test capturing missed expectation. Ref #2612. --- setuptools/tests/fixtures.py | 14 ++++++++++++++ setuptools/tests/test_develop.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py index d74b5f031ac..a5a172e0f98 100644 --- a/setuptools/tests/fixtures.py +++ b/setuptools/tests/fixtures.py @@ -1,6 +1,7 @@ import contextlib import sys import shutil +import subprocess import pytest @@ -58,3 +59,16 @@ def workaround_xdist_376(request): with contextlib.suppress(ValueError): sys.path.remove('') + + +@pytest.fixture +def sample_project(tmp_path): + """ + Clone the 'sampleproject' and return a path to it. + """ + cmd = ['git', 'clone', 'https://github.com/pypa/sampleproject'] + try: + subprocess.check_call(cmd, cwd=str(tmp_path)) + except Exception: + pytest.skip("Unable to clone sampleproject") + return tmp_path / 'sampleproject' diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index 2766da2f79e..e793c36d9fa 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -7,6 +7,7 @@ import io import subprocess import platform +import pathlib from setuptools.command import test @@ -199,3 +200,32 @@ def test_namespace_package_importable(self, tmpdir): ] with test.test.paths_on_pythonpath([str(target)]): subprocess.check_call(pkg_resources_imp) + + @pytest.mark.xfail(reason="#2612") + def test_editable_prefix(self, tmp_path, sample_project): + """ + Editable install to a prefix should be discoverable. + """ + prefix = tmp_path / 'prefix' + prefix.mkdir() + + cmd = [ + sys.executable, + '-m', 'pip', + 'install', + '-e', str(sample_project), + '--prefix', str(prefix), + ] + subprocess.check_call(cmd) + + # now run 'sample' with the prefix on the PYTHONPATH + site_packages = prefix / next( + pathlib.Path(path).relative_to(sys.prefix) + for path in sys.path + if 'site-packages' in path + and path.startswith(sys.prefix) + ) + env = dict(PYTHONPATH=site_packages) + bin = 'Scripts' if platform.system() == 'Windows' else 'bin' + sample = prefix / bin / 'sample' + subprocess.check_call([sample], env=env) From cb962021c53b7130bf0a1792f75678efcc0724be Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 Mar 2021 03:38:43 -0400 Subject: [PATCH 234/272] Illustrate how one might leverage sitecustomize.py to make a project available on PYTHONPATH. Fixes #2612. --- setuptools/tests/test_develop.py | 42 +++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index e793c36d9fa..0dea40bd79f 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -8,6 +8,7 @@ import subprocess import platform import pathlib +import textwrap from setuptools.command import test @@ -201,7 +202,17 @@ def test_namespace_package_importable(self, tmpdir): with test.test.paths_on_pythonpath([str(target)]): subprocess.check_call(pkg_resources_imp) - @pytest.mark.xfail(reason="#2612") + @staticmethod + def install_workaround(site_packages): + site_packages.mkdir(parents=True) + sc = site_packages / 'sitecustomize.py' + sc.write_text(textwrap.dedent(""" + import site + import pathlib + here = pathlib.Path(__file__).parent + site.addsitedir(str(here)) + """).lstrip()) + def test_editable_prefix(self, tmp_path, sample_project): """ Editable install to a prefix should be discoverable. @@ -209,23 +220,30 @@ def test_editable_prefix(self, tmp_path, sample_project): prefix = tmp_path / 'prefix' prefix.mkdir() + # figure out where pip will likely install the package + site_packages = prefix / next( + pathlib.Path(path).relative_to(sys.prefix) + for path in sys.path + if 'site-packages' in path + and path.startswith(sys.prefix) + ) + + # install the workaround + self.install_workaround(site_packages) + + env = dict(PYTHONPATH=site_packages) cmd = [ sys.executable, '-m', 'pip', 'install', - '-e', str(sample_project), + '--editable', + str(sample_project), '--prefix', str(prefix), + '--no-build-isolation', ] - subprocess.check_call(cmd) + subprocess.check_call(cmd, env=env) # now run 'sample' with the prefix on the PYTHONPATH - site_packages = prefix / next( - pathlib.Path(path).relative_to(sys.prefix) - for path in sys.path - if 'site-packages' in path - and path.startswith(sys.prefix) - ) - env = dict(PYTHONPATH=site_packages) bin = 'Scripts' if platform.system() == 'Windows' else 'bin' - sample = prefix / bin / 'sample' - subprocess.check_call([sample], env=env) + exe = prefix / bin / 'sample' + subprocess.check_call([exe], env=env) From 0c485af05591ba869b8adb96802d1cf4b49fe28d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 Mar 2021 04:03:10 -0400 Subject: [PATCH 235/272] Cast values to str and retain other environ vars for Windows' sake --- setuptools/tests/test_develop.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index 0dea40bd79f..a0e84b9a28c 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -231,7 +231,7 @@ def test_editable_prefix(self, tmp_path, sample_project): # install the workaround self.install_workaround(site_packages) - env = dict(PYTHONPATH=site_packages) + env = dict(os.environ, PYTHONPATH=str(site_packages)) cmd = [ sys.executable, '-m', 'pip', @@ -246,4 +246,6 @@ def test_editable_prefix(self, tmp_path, sample_project): # now run 'sample' with the prefix on the PYTHONPATH bin = 'Scripts' if platform.system() == 'Windows' else 'bin' exe = prefix / bin / 'sample' + if sys.version_info < (3, 7) and platform.system() == 'Windows': + exe = str(exe) subprocess.check_call([exe], env=env) From 202c7a808e61a415d6a8c724a5d8fe664301863b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 21 Mar 2021 09:51:21 -0400 Subject: [PATCH 236/272] Expect failure on PyPy. --- setuptools/tests/test_develop.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index a0e84b9a28c..df8db4e2810 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -213,6 +213,10 @@ def install_workaround(site_packages): site.addsitedir(str(here)) """).lstrip()) + @pytest.mark.xfail( + platform.python_implementation() == 'PyPy', + reason="Workaround fails on PyPy (why?)", + ) def test_editable_prefix(self, tmp_path, sample_project): """ Editable install to a prefix should be discoverable. From f3ba2139eacd5d27d052f0659b5d7dc1413977b0 Mon Sep 17 00:00:00 2001 From: layday Date: Sun, 21 Mar 2021 19:36:14 +0200 Subject: [PATCH 237/272] fixup! fixup! build_meta: produce informative error when a dist is not found --- setuptools/build_meta.py | 6 +++--- setuptools/tests/test_build_meta.py | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py index 3c45db72fbd..36fbc9e8a1c 100644 --- a/setuptools/build_meta.py +++ b/setuptools/build_meta.py @@ -104,9 +104,9 @@ def _file_with_extension(directory, extension): try: return next(matching) except StopIteration: - raise ValueError('No distribution was found. The distribution was ' - 'possibly not built. Ensure that your `setup.py` ' - 'is not empty and that it calls `setup()`.') + raise ValueError( + 'No distribution was found. Ensure that `setup.py` ' + 'is not empty and that it calls `setup()`.') def _open_setup_script(setup_script): diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index f776b09d71b..ab75a1896c6 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -450,10 +450,7 @@ def test_build_with_empty_setuppy(self, build_backend, build_hook): with pytest.raises( ValueError, - match=re.escape( - 'No distribution was found. The distribution was ' - 'possibly not built. Ensure that your `setup.py` ' - 'is not empty and that it calls `setup()`.')): + match=re.escape('No distribution was found.')): getattr(build_backend, build_hook)("temp") From 2cec54e4f451d6318ad9fc18213d0f8f7d4aa669 Mon Sep 17 00:00:00 2001 From: layday Date: Sun, 21 Mar 2021 22:00:29 +0200 Subject: [PATCH 238/272] fixup! build_meta: produce informative error when a dist is not found --- setuptools/build_meta.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py index 36fbc9e8a1c..de856854457 100644 --- a/setuptools/build_meta.py +++ b/setuptools/build_meta.py @@ -102,11 +102,13 @@ def _file_with_extension(directory, extension): if f.endswith(extension) ) try: - return next(matching) - except StopIteration: + file, = matching + except ValueError: raise ValueError( 'No distribution was found. Ensure that `setup.py` ' 'is not empty and that it calls `setup()`.') + else: + return file def _open_setup_script(setup_script): From 99a9891ec20550421453ae60ebef5c8422f70e4c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 22 Mar 2021 08:43:19 -0400 Subject: [PATCH 239/272] =?UTF-8?q?Bump=20version:=2054.1.2=20=E2=86=92=20?= =?UTF-8?q?54.1.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 6 ++++++ setup.cfg | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 2c0c640ec07..89f47f621d8 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 54.1.2 +current_version = 54.1.3 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index c8db71ee59d..8612991a412 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +v54.1.3 +------- + +No significant changes. + + v54.1.2 ------- diff --git a/setup.cfg b/setup.cfg index 2c4cb02fbb9..b3e5bb8adf2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 54.1.2 +version = 54.1.3 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From e0655f6459c8ba7ee8a0befbaf55c0e89d25512a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 22 Mar 2021 08:44:55 -0400 Subject: [PATCH 240/272] Remove superfluous else. --- setuptools/build_meta.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py index de856854457..9dfb2f24b52 100644 --- a/setuptools/build_meta.py +++ b/setuptools/build_meta.py @@ -107,8 +107,7 @@ def _file_with_extension(directory, extension): raise ValueError( 'No distribution was found. Ensure that `setup.py` ' 'is not empty and that it calls `setup()`.') - else: - return file + return file def _open_setup_script(setup_script): From e0dc5bd639dcade02605aa901f5e43e4f027c484 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 22 Mar 2021 08:46:01 -0400 Subject: [PATCH 241/272] =?UTF-8?q?Bump=20version:=2054.1.3=20=E2=86=92=20?= =?UTF-8?q?54.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 10 ++++++++++ changelog.d/2608.change.rst | 2 -- setup.cfg | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) delete mode 100644 changelog.d/2608.change.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 89f47f621d8..fdde71809e0 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 54.1.3 +current_version = 54.2.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 8612991a412..dca490b75b0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,13 @@ +v54.2.0 +------- + + +Changes +^^^^^^^ +* #2608: Added informative error message to PEP 517 build failures owing to + an empty ``setup.py`` -- by :user:`layday` + + v54.1.3 ------- diff --git a/changelog.d/2608.change.rst b/changelog.d/2608.change.rst deleted file mode 100644 index f966649ae79..00000000000 --- a/changelog.d/2608.change.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added informative error message to PEP 517 build failures owing to -an empty ``setup.py`` -- by :user:`layday` diff --git a/setup.cfg b/setup.cfg index b3e5bb8adf2..1b0e6188072 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 54.1.3 +version = 54.2.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 4b1568c71b5299b39a5579bb778c8930991448b8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 22 Mar 2021 19:58:47 -0400 Subject: [PATCH 242/272] Tidelift no longer requires or expects publishing release notes. --- tox.ini | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 tox.ini diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 35053514ded..00000000000 --- a/tox.ini +++ /dev/null @@ -1,7 +0,0 @@ -[testenv:release] -deps = - jaraco.tidelift -passenv = - TIDELIFT_TOKEN -commands = - python -m jaraco.tidelift.publish-release-notes From 842eb1423ba76dadbf568f9b0abf04a233711529 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 23 Mar 2021 18:52:10 -0400 Subject: [PATCH 243/272] Remove Tidelift from main.yml, no longer needed --- .github/workflows/main.yml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 01999cabbf9..00000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -jobs: - release: - steps: - - name: Release - env: - TIDELIFT_TOKEN: ${{ secrets.TIDELIFT_TOKEN }} From adae68e251a4418f348ff501261487c06666ebc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Gmach?= Date: Wed, 24 Mar 2021 16:42:20 +0100 Subject: [PATCH 244/272] remove duplicate word --- setuptools/command/easy_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 0917804f412..45adb6a1eaf 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -2193,7 +2193,7 @@ def _get_script_args(cls, type_, name, header, script_text): @classmethod def _adjust_header(cls, type_, orig_header): """ - Make sure 'pythonw' is used for gui and and 'python' is used for + Make sure 'pythonw' is used for gui and 'python' is used for console (regardless of what sys.executable is). """ pattern = 'pythonw.exe' From 0ffe795dbf920da44db9744759e38b92dad7f9e4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Mar 2021 15:22:04 -0400 Subject: [PATCH 245/272] Pin to upstream main branch for sphinx-inline-tabs. Workaround for #2614. --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 0292759301c..bf408839e85 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -3,6 +3,6 @@ sphinx jaraco.packaging>=6.1 rst.linker>=1.9 pygments-github-lexers==0.0.5 -sphinx-inline-tabs +sphinx-inline-tabs@git+https://github.com/pradyunsg/sphinx-inline-tabs@main setuptools>=34 From 3d660e49a4d1a1b7fb8fca725b17958a9e16c5c4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Mar 2021 16:50:43 -0400 Subject: [PATCH 246/272] Reset RTD config to match skeleton and rely on package metadata for docs build requirements. --- .readthedocs.yml | 4 +++- docs/requirements.txt | 8 -------- setup.cfg | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) delete mode 100644 docs/requirements.txt diff --git a/.readthedocs.yml b/.readthedocs.yml index 850d79c4a18..cc698548db4 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,4 +1,6 @@ version: 2 python: install: - - requirements: docs/requirements.txt + - path: . + extra_requirements: + - docs diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index bf408839e85..00000000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -# keep these in sync with setup.cfg -sphinx -jaraco.packaging>=6.1 -rst.linker>=1.9 -pygments-github-lexers==0.0.5 -sphinx-inline-tabs@git+https://github.com/pradyunsg/sphinx-inline-tabs@main - -setuptools>=34 diff --git a/setup.cfg b/setup.cfg index 1b0e6188072..05ddf01dae7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -72,10 +72,10 @@ docs = sphinx jaraco.packaging >= 8.2 rst.linker >= 1.9 - sphinx-inline-tabs # local pygments-github-lexers==0.0.5 + sphinx-inline-tabs@git+https://github.com/pradyunsg/sphinx-inline-tabs@main ssl = wincertstore==0.2; sys_platform=='win32' From b5eadccc4d51363fac26d6fd7093db1fd83b8ccd Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Mar 2021 17:04:18 -0400 Subject: [PATCH 247/272] Remove latent comment. Meant for previous commit. --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 05ddf01dae7..b8805d93fb0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -67,7 +67,6 @@ testing = jaraco.path>=3.2.0 docs = - # Keep these in sync with docs/requirements.txt # upstream sphinx jaraco.packaging >= 8.2 From 63789e80d9d3c680f8b5ba63f21fae4644c4ea16 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 28 Mar 2021 15:40:24 +0200 Subject: [PATCH 248/272] Tests - Fix url for pip download --- setuptools/tests/test_virtualenv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index 9cf6d30f7dd..399dbaf0bbe 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -85,7 +85,7 @@ def skip_network(param): mark('pip==18.1', issue2599), mark('pip==19.3.1', pytest.mark.xfail(reason='pypa/pip#6599')), 'pip==20.0.2', - 'https://github.com/pypa/pip/archive/master.zip', + 'https://github.com/pypa/pip/archive/main.zip', ] versions = itertools.chain( From a80e8868d336f04648c82dde85714949b8cab17f Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 28 Mar 2021 16:09:06 +0200 Subject: [PATCH 249/272] Use sphinx-inline-tabs from PyPI Fixes #2614 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index b8805d93fb0..7673fceb570 100644 --- a/setup.cfg +++ b/setup.cfg @@ -74,7 +74,7 @@ docs = # local pygments-github-lexers==0.0.5 - sphinx-inline-tabs@git+https://github.com/pradyunsg/sphinx-inline-tabs@main + sphinx-inline-tabs ssl = wincertstore==0.2; sys_platform=='win32' From c0b90dba0326d637ec44d2b67cb0fadcead1c640 Mon Sep 17 00:00:00 2001 From: Zack Didcott <66186954+Zedeldi@users.noreply.github.com> Date: Mon, 29 Mar 2021 00:26:32 +0000 Subject: [PATCH 250/272] Update dependency_management.rst Fix spelling and grammar --- docs/userguide/dependency_management.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/userguide/dependency_management.rst b/docs/userguide/dependency_management.rst index 6108d9b2e99..188083e0fb8 100644 --- a/docs/userguide/dependency_management.rst +++ b/docs/userguide/dependency_management.rst @@ -3,7 +3,7 @@ Dependencies Management in Setuptools ===================================== There are three types of dependency styles offered by setuptools: -1) build system requirement, required dependency and 3) optional +1) build system requirement, 2) required dependency and 3) optional dependency. .. Note:: @@ -19,8 +19,8 @@ Build system requirement Package requirement ------------------- After organizing all the scripts and files and getting ready for packaging, -there needs to be a way to tell Python what programs it need to actually -do the packgaging (in our case, ``setuptools`` of course). Usually, +there needs to be a way to tell Python what programs it needs to actually +do the packaging (in our case, ``setuptools`` of course). Usually, you also need the ``wheel`` package as well since it is recommended that you upload a ``.whl`` file to PyPI alongside your ``.tar.gz`` file. Unlike the other two types of dependency keyword, this one is specified in your @@ -47,7 +47,7 @@ Declaring required dependency This is where a package declares its core dependencies, without which it won't be able to run. ``setuptools`` support automatically download and install these dependencies when the package is installed. Although there is more -finess to it, let's start with a simple example. +finesse to it, let's start with a simple example. .. tab:: setup.cfg From 07d5e663650f594288dda1c92f2cda010a2a899b Mon Sep 17 00:00:00 2001 From: "T. Wouters" Date: Mon, 29 Mar 2021 15:02:41 +0200 Subject: [PATCH 251/272] Fix typo in setup.py example in quickstart guide. --- docs/userguide/quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userguide/quickstart.rst b/docs/userguide/quickstart.rst index 7f111dd5751..4ee59098510 100644 --- a/docs/userguide/quickstart.rst +++ b/docs/userguide/quickstart.rst @@ -62,7 +62,7 @@ the minimum from setuptools import setup setup( - name='mypackage"' + name='mypackage' version='0.0.1', packages=['mypackage'], install_requires=[ From c91153a1bf73ceb65efd611603edf638a996f720 Mon Sep 17 00:00:00 2001 From: "T. Wouters" Date: Mon, 29 Mar 2021 15:10:26 +0200 Subject: [PATCH 252/272] Update quickstart.rst --- docs/userguide/quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userguide/quickstart.rst b/docs/userguide/quickstart.rst index 4ee59098510..2807f59bee9 100644 --- a/docs/userguide/quickstart.rst +++ b/docs/userguide/quickstart.rst @@ -62,7 +62,7 @@ the minimum from setuptools import setup setup( - name='mypackage' + name='mypackage', version='0.0.1', packages=['mypackage'], install_requires=[ From 6dffcbe97d556809788afb8bed66ac4860c0d939 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 30 Mar 2021 22:00:07 -0400 Subject: [PATCH 253/272] Section for 'find' and 'find_namespace' options is 'options.packages.find'. Fixes #2406. --- docs/userguide/package_discovery.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userguide/package_discovery.rst b/docs/userguide/package_discovery.rst index 842ade828d4..0a8070ae438 100644 --- a/docs/userguide/package_discovery.rst +++ b/docs/userguide/package_discovery.rst @@ -156,7 +156,7 @@ to use ``find_namespace:``: =src packages = find_namespace: - [options.packages.find_namespace] + [options.packages.find] where = src When you install the zipped distribution, ``timmins.foo`` would become From 30cf7823c7acd8ba5503ed3fdc7dc9cb28800880 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 30 Mar 2021 22:02:15 -0400 Subject: [PATCH 254/272] =?UTF-8?q?Bump=20version:=2054.2.0=20=E2=86=92=20?= =?UTF-8?q?55.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 9 +++++++++ changelog.d/2566.breaking.rst | 1 - setup.cfg | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/2566.breaking.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index fdde71809e0..7fe611a698d 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 54.2.0 +current_version = 55.0.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index dca490b75b0..d073fa8ef3f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v55.0.0 +------- + + +Breaking Changes +^^^^^^^^^^^^^^^^ +* #2566: Remove the deprecated ``bdist_wininst`` command. Binary packages should be built as wheels instead. -- by :user:`hroncok` + + v54.2.0 ------- diff --git a/changelog.d/2566.breaking.rst b/changelog.d/2566.breaking.rst deleted file mode 100644 index e56945750b5..00000000000 --- a/changelog.d/2566.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Remove the deprecated ``bdist_wininst`` command. Binary packages should be built as wheels instead. -- by :user:`hroncok` diff --git a/setup.cfg b/setup.cfg index 7673fceb570..6bb6508f8bf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 54.2.0 +version = 55.0.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 8fe85c22cee7fde5e6af571b30f864bad156a010 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 3 Apr 2021 13:13:28 -0400 Subject: [PATCH 255/272] Officially declare pkg_resources as deprecated. Closes #2531. --- docs/pkg_resources.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/pkg_resources.rst b/docs/pkg_resources.rst index 19d43244d1b..994bea6f2bb 100644 --- a/docs/pkg_resources.rst +++ b/docs/pkg_resources.rst @@ -10,6 +10,13 @@ eggs, support for merging packages that have separately-distributed modules or subpackages, and APIs for managing Python's current "working set" of active packages. +Use of ``pkg_resources`` is discouraged in favor of +`importlib.resources `_, +`importlib.metadata `_, +and their backports (`resources `_, +`metadata `_). +Please consider using those libraries instead of pkg_resources. + .. contents:: **Table of Contents** From 749b97499ea36d9a7660ed73db622837ae64c57d Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 28 Mar 2021 13:37:48 +0200 Subject: [PATCH 256/272] license_files - Add support for glob patterns + add default patterns --- setuptools/command/sdist.py | 53 +++++++++++++++++++------------ setuptools/tests/test_egg_info.py | 4 +-- setuptools/tests/test_manifest.py | 1 + 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 887b7efa052..cd308ab9ddc 100644 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -4,6 +4,8 @@ import sys import io import contextlib +import warnings +from glob import iglob from setuptools.extern import ordered_set @@ -194,29 +196,38 @@ def check_license(self): """Checks if license_file' or 'license_files' is configured and adds any valid paths to 'self.filelist'. """ - - files = ordered_set.OrderedSet() - opts = self.distribution.get_option_dict('metadata') - # ignore the source of the value - _, license_file = opts.get('license_file', (None, None)) - - if license_file is None: - log.debug("'license_file' option was not specified") - else: - files.add(license_file) - + files = ordered_set.OrderedSet() try: - files.update(self.distribution.metadata.license_files) + license_files = self.distribution.metadata.license_files except TypeError: log.warn("warning: 'license_files' option is malformed") - - for f in files: - if not os.path.exists(f): - log.warn( - "warning: Failed to find the configured license file '%s'", - f) - files.remove(f) - - self.filelist.extend(files) + license_files = ordered_set.OrderedSet() + patterns = license_files if isinstance(license_files, ordered_set.OrderedSet) \ + else ordered_set.OrderedSet(license_files) + + if 'license_file' in opts: + warnings.warn( + "The 'license_file' option is deprecated. Use 'license_files' instead.", + DeprecationWarning) + patterns.append(opts['license_file'][1]) + + if 'license_file' not in opts and 'license_files' not in opts: + patterns = ('LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*') + + for pattern in patterns: + for path in iglob(pattern): + if path.endswith('~'): + log.debug( + "ignoring license file '%s' as it looks like a backup", + path) + continue + + if path not in files and os.path.isfile(path): + log.info( + "adding license file '%s' (matched pattern '%s')", + path, pattern) + files.add(path) + + self.filelist.extend(sorted(files)) diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index bf95b03ce66..4915c0cb409 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -537,7 +537,7 @@ def test_doesnt_provides_extra(self, tmpdir_cwd, env): 'setup.cfg': DALS(""" """), 'LICENSE': "Test license" - }, False), # no license_file attribute + }, True), # no license_file attribute, LICENSE auto-included ({ 'setup.cfg': DALS(""" [metadata] @@ -625,7 +625,7 @@ def test_setup_cfg_license_file( 'setup.cfg': DALS(""" """), 'LICENSE': "Test license" - }, [], ['LICENSE']), # no license_files attribute + }, ['LICENSE'], []), # no license_files attribute, LICENSE auto-included ({ 'setup.cfg': DALS(""" [metadata] diff --git a/setuptools/tests/test_manifest.py b/setuptools/tests/test_manifest.py index 82bdb9c6432..589cefb2c01 100644 --- a/setuptools/tests/test_manifest.py +++ b/setuptools/tests/test_manifest.py @@ -55,6 +55,7 @@ def touch(filename): default_files = frozenset(map(make_local_path, [ 'README.rst', 'MANIFEST.in', + 'LICENSE', 'setup.py', 'app.egg-info/PKG-INFO', 'app.egg-info/SOURCES.txt', From 91e7956d961ef84080c30eb5253c220fa3b001dc Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 28 Mar 2021 13:39:35 +0200 Subject: [PATCH 257/272] Add documentation + changelog entries --- changelog.d/2620.breaking.rst | 5 +++++ changelog.d/2620.change.rst | 1 + changelog.d/2620.deprecation.rst | 2 ++ changelog.d/2620.doc.rst | 1 + docs/references/keywords.rst | 12 ++++++++++++ docs/userguide/declarative_config.rst | 2 +- 6 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 changelog.d/2620.breaking.rst create mode 100644 changelog.d/2620.change.rst create mode 100644 changelog.d/2620.deprecation.rst create mode 100644 changelog.d/2620.doc.rst diff --git a/changelog.d/2620.breaking.rst b/changelog.d/2620.breaking.rst new file mode 100644 index 00000000000..de91facc572 --- /dev/null +++ b/changelog.d/2620.breaking.rst @@ -0,0 +1,5 @@ +If neither ``license_file`` nor ``license_files`` is specified, the ``sdist`` +option will now auto-include files that match the following patterns: +``LICEN[CS]E*``, ``COPYING*``, ``NOTICE*``, ``AUTHORS*``. +This matches the behavior of ``bdist_wheel``. +Any ``exclude`` in ``MANIFEST.in`` will overwrite it. -- by :user:`cdce8p` diff --git a/changelog.d/2620.change.rst b/changelog.d/2620.change.rst new file mode 100644 index 00000000000..5470592d175 --- /dev/null +++ b/changelog.d/2620.change.rst @@ -0,0 +1 @@ +The ``license_file`` and ``license_files`` options now support glob patterns. -- by :user:`cdce8p` diff --git a/changelog.d/2620.deprecation.rst b/changelog.d/2620.deprecation.rst new file mode 100644 index 00000000000..1af5f2461a4 --- /dev/null +++ b/changelog.d/2620.deprecation.rst @@ -0,0 +1,2 @@ +The ``license_file`` option is now marked as deprecated. +Use ``license_files`` instead. -- by :user:`cdce8p` diff --git a/changelog.d/2620.doc.rst b/changelog.d/2620.doc.rst new file mode 100644 index 00000000000..7564adaca42 --- /dev/null +++ b/changelog.d/2620.doc.rst @@ -0,0 +1 @@ +Added documentation for the ``license_files`` option. -- by :user:`cdce8p` diff --git a/docs/references/keywords.rst b/docs/references/keywords.rst index 03ce9fa23a4..6485437b846 100644 --- a/docs/references/keywords.rst +++ b/docs/references/keywords.rst @@ -76,6 +76,18 @@ Keywords ``license`` A string specifying the license of the package. +``license_file`` + + .. warning:: + ``license_file`` is deprecated. Use ``license_files`` instead. + +``license_files`` + + A list of glob patterns for license related files that should be included. + If neither ``license_file`` nor ``license_files`` is specified, this option + defaults to ``LICEN[CS]E*``, ``COPYING*``, ``NOTICE*``, and ``AUTHORS*``. + Any ``exclude`` specified in ``MANIFEST.in`` will overwrite it. + ``keywords`` A list of strings or a comma-separated string providing descriptive meta-data. See: `PEP 0314`_. diff --git a/docs/userguide/declarative_config.rst b/docs/userguide/declarative_config.rst index f2e8b81f755..7c97ca1cfa0 100644 --- a/docs/userguide/declarative_config.rst +++ b/docs/userguide/declarative_config.rst @@ -184,7 +184,7 @@ maintainer_email maintainer-email str classifiers classifier file:, list-comma license str license_file str -license_files list-comma +license_files list-comma 42.0.0 description summary file:, str long_description long-description file:, str long_description_content_type str 38.6.0 From 1da769c049093b6492b63422272f56b6e95df39d Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 28 Mar 2021 14:32:52 +0200 Subject: [PATCH 258/272] Additional test cases --- setuptools/tests/test_egg_info.py | 65 +++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index 4915c0cb409..4751d1b5537 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -545,7 +545,15 @@ def test_doesnt_provides_extra(self, tmpdir_cwd, env): """), 'MANIFEST.in': "exclude LICENSE", 'LICENSE': "Test license" - }, False) # license file is manually excluded + }, False), # license file is manually excluded + pytest.param({ + 'setup.cfg': DALS(""" + [metadata] + license_file = LICEN[CS]E* + """), + 'LICENSE': "Test license", + }, True, + id="glob_pattern"), ]) def test_setup_cfg_license_file( self, tmpdir_cwd, env, files, license_in_sources): @@ -644,7 +652,37 @@ def test_setup_cfg_license_file( 'MANIFEST.in': "exclude LICENSE-XYZ", 'LICENSE-ABC': "ABC license", 'LICENSE-XYZ': "XYZ license" - }, ['LICENSE-ABC'], ['LICENSE-XYZ']) # subset is manually excluded + }, ['LICENSE-ABC'], ['LICENSE-XYZ']), # subset is manually excluded + pytest.param({ + 'setup.cfg': DALS(""" + """), + 'LICENSE-ABC': "ABC license", + 'COPYING-ABC': "ABC copying", + 'NOTICE-ABC': "ABC notice", + 'AUTHORS-ABC': "ABC authors", + 'LICENCE-XYZ': "XYZ license", + 'LICENSE': "License", + 'INVALID-LICENSE': "Invalid license", + }, [ + 'LICENSE-ABC', + 'COPYING-ABC', + 'NOTICE-ABC', + 'AUTHORS-ABC', + 'LICENCE-XYZ', + 'LICENSE', + ], ['INVALID-LICENSE'], + # ('LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*') + id="default_glob_patterns"), + pytest.param({ + 'setup.cfg': DALS(""" + [metadata] + license_files = + LICENSE* + """), + 'LICENSE-ABC': "ABC license", + 'NOTICE-XYZ': "XYZ notice", + }, ['LICENSE-ABC'], ['NOTICE-XYZ'], + id="no_default_glob_patterns"), ]) def test_setup_cfg_license_files( self, tmpdir_cwd, env, files, incl_licenses, excl_licenses): @@ -749,7 +787,28 @@ def test_setup_cfg_license_files( 'LICENSE-PQR': "PQR license", 'LICENSE-XYZ': "XYZ license" # manually excluded - }, ['LICENSE-XYZ'], ['LICENSE-ABC', 'LICENSE-PQR']) + }, ['LICENSE-XYZ'], ['LICENSE-ABC', 'LICENSE-PQR']), + pytest.param({ + 'setup.cfg': DALS(""" + [metadata] + license_file = LICENSE* + """), + 'LICENSE-ABC': "ABC license", + 'NOTICE-XYZ': "XYZ notice", + }, ['LICENSE-ABC'], ['NOTICE-XYZ'], + id="no_default_glob_patterns"), + pytest.param({ + 'setup.cfg': DALS(""" + [metadata] + license_file = LICENSE* + license_files = + NOTICE* + """), + 'LICENSE-ABC': "ABC license", + 'NOTICE-ABC': "ABC notice", + 'AUTHORS-ABC': "ABC authors", + }, ['LICENSE-ABC', 'NOTICE-ABC'], ['AUTHORS-ABC'], + id="combined_glob_patterrns"), ]) def test_setup_cfg_license_file_license_files( self, tmpdir_cwd, env, files, incl_licenses, excl_licenses): From 0f34639e5aa630b8cbe32af9cfe8dfec7be890e7 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 28 Mar 2021 17:34:01 +0200 Subject: [PATCH 259/272] Change deprecation warning --- setuptools/command/sdist.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index cd308ab9ddc..278b8ce0b60 100644 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -4,7 +4,6 @@ import sys import io import contextlib -import warnings from glob import iglob from setuptools.extern import ordered_set @@ -208,9 +207,9 @@ def check_license(self): else ordered_set.OrderedSet(license_files) if 'license_file' in opts: - warnings.warn( - "The 'license_file' option is deprecated. Use 'license_files' instead.", - DeprecationWarning) + log.warn( + "warning: the 'license_file' option is deprecated, " + "use 'license_files' instead") patterns.append(opts['license_file'][1]) if 'license_file' not in opts and 'license_files' not in opts: From 608c376e86326c879dd52b56660b2247a3ca854e Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 3 Apr 2021 21:34:00 +0200 Subject: [PATCH 260/272] Small changes --- changelog.d/2620.breaking.rst | 3 +-- docs/references/keywords.rst | 1 - setuptools/command/sdist.py | 3 +++ setuptools/tests/test_egg_info.py | 3 +-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/changelog.d/2620.breaking.rst b/changelog.d/2620.breaking.rst index de91facc572..431e7105d94 100644 --- a/changelog.d/2620.breaking.rst +++ b/changelog.d/2620.breaking.rst @@ -1,5 +1,4 @@ If neither ``license_file`` nor ``license_files`` is specified, the ``sdist`` option will now auto-include files that match the following patterns: ``LICEN[CS]E*``, ``COPYING*``, ``NOTICE*``, ``AUTHORS*``. -This matches the behavior of ``bdist_wheel``. -Any ``exclude`` in ``MANIFEST.in`` will overwrite it. -- by :user:`cdce8p` +This matches the behavior of ``bdist_wheel``. -- by :user:`cdce8p` diff --git a/docs/references/keywords.rst b/docs/references/keywords.rst index 6485437b846..619b2d14934 100644 --- a/docs/references/keywords.rst +++ b/docs/references/keywords.rst @@ -86,7 +86,6 @@ Keywords A list of glob patterns for license related files that should be included. If neither ``license_file`` nor ``license_files`` is specified, this option defaults to ``LICEN[CS]E*``, ``COPYING*``, ``NOTICE*``, and ``AUTHORS*``. - Any ``exclude`` specified in ``MANIFEST.in`` will overwrite it. ``keywords`` A list of strings or a comma-separated string providing descriptive diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 278b8ce0b60..a6ea814a30b 100644 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -213,6 +213,9 @@ def check_license(self): patterns.append(opts['license_file'][1]) if 'license_file' not in opts and 'license_files' not in opts: + # Default patterns match the ones wheel uses + # See https://wheel.readthedocs.io/en/stable/user_guide.html + # -> 'Including license files in the generated wheel file' patterns = ('LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*') for pattern in patterns: diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index 4751d1b5537..80d35774249 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -654,8 +654,7 @@ def test_setup_cfg_license_file( 'LICENSE-XYZ': "XYZ license" }, ['LICENSE-ABC'], ['LICENSE-XYZ']), # subset is manually excluded pytest.param({ - 'setup.cfg': DALS(""" - """), + 'setup.cfg': "", 'LICENSE-ABC': "ABC license", 'COPYING-ABC': "ABC copying", 'NOTICE-ABC': "ABC notice", From c5185cd00cc3a96bad4cf5bca3968af710916d3a Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 8 Apr 2021 20:34:05 +0200 Subject: [PATCH 261/272] Add a change note for PR #2633 --- changelog.d/2632.change.rst | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog.d/2632.change.rst diff --git a/changelog.d/2632.change.rst b/changelog.d/2632.change.rst new file mode 100644 index 00000000000..a13bfdfa70d --- /dev/null +++ b/changelog.d/2632.change.rst @@ -0,0 +1,3 @@ +Implemented ``VendorImporter.find_spec()`` method to get rid +of ``ImportWarning`` that Python 3.10 emits when only the old-style +importer hooks are present -- by :user:`webknjaz` From c826dffc2fd99de0431ee2a8b483868ab54e9cdc Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 8 Apr 2021 19:58:24 +0200 Subject: [PATCH 262/272] Implement `find_spec` in vendored module importers This change makes the import warning emitted by Python 3.10 disappear but implementing the hook that is supposed to replace the old import mechanism. Refs: * https://bugs.python.org/issue42134 * https://bugs.python.org/issue43540 * https://github.com/pypa/setuptools/issues/2632#issuecomment-815701078 Fixes #2632 Co-authored-by: Jason R. Coombs --- pkg_resources/extern/__init__.py | 21 +++++++++++++++------ setuptools/extern/__init__.py | 21 +++++++++++++++------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/pkg_resources/extern/__init__.py b/pkg_resources/extern/__init__.py index 1fbb4fcc896..c45f58e2acc 100644 --- a/pkg_resources/extern/__init__.py +++ b/pkg_resources/extern/__init__.py @@ -1,3 +1,4 @@ +import importlib.machinery import sys @@ -20,17 +21,18 @@ def search_path(self): yield self.vendor_pkg + '.' yield '' + def _module_matches_namespace(self, fullname): + """Figure out if the target module is vendored.""" + root, base, target = fullname.partition(self.root_name + '.') + return not root and any(map(target.startswith, self.vendored_names)) + def find_module(self, fullname, path=None): """ Return self when fullname starts with root_name and the target module is one vendored through this importer. """ - root, base, target = fullname.partition(self.root_name + '.') - if root: - return - if not any(map(target.startswith, self.vendored_names)): - return - return self + spec = self.find_spec(fullname, path) + return spec.loader if spec is not None else None def load_module(self, fullname): """ @@ -60,6 +62,13 @@ def create_module(self, spec): def exec_module(self, module): pass + def find_spec(self, fullname, path=None, target=None): + """Return a module spec for vendored names.""" + return ( + importlib.machinery.ModuleSpec(fullname, self) + if self._module_matches_namespace(fullname) else None + ) + def install(self): """ Install this importer into sys.meta_path if not already present. diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py index 399701a044e..bd8636c7b72 100644 --- a/setuptools/extern/__init__.py +++ b/setuptools/extern/__init__.py @@ -1,3 +1,4 @@ +import importlib.machinery import sys @@ -20,17 +21,18 @@ def search_path(self): yield self.vendor_pkg + '.' yield '' + def _module_matches_namespace(self, fullname): + """Figure out if the target module is vendored.""" + root, base, target = fullname.partition(self.root_name + '.') + return not root and any(map(target.startswith, self.vendored_names)) + def find_module(self, fullname, path=None): """ Return self when fullname starts with root_name and the target module is one vendored through this importer. """ - root, base, target = fullname.partition(self.root_name + '.') - if root: - return - if not any(map(target.startswith, self.vendored_names)): - return - return self + spec = self.find_spec(fullname, path) + return spec.loader if spec is not None else None def load_module(self, fullname): """ @@ -60,6 +62,13 @@ def create_module(self, spec): def exec_module(self, module): pass + def find_spec(self, fullname, path=None, target=None): + """Return a module spec for vendored names.""" + return ( + importlib.machinery.ModuleSpec(fullname, self) + if self._module_matches_namespace(fullname) else None + ) + def install(self): """ Install this importer into sys.meta_path if not already present. From dd1453b3c2ebcc4460b088979576876e89372302 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Thu, 8 Apr 2021 23:45:40 +0200 Subject: [PATCH 263/272] Drop deprecated `find_module` from vendor importer --- pkg_resources/extern/__init__.py | 8 -------- setuptools/extern/__init__.py | 8 -------- 2 files changed, 16 deletions(-) diff --git a/pkg_resources/extern/__init__.py b/pkg_resources/extern/__init__.py index c45f58e2acc..33e4e6f134e 100644 --- a/pkg_resources/extern/__init__.py +++ b/pkg_resources/extern/__init__.py @@ -26,14 +26,6 @@ def _module_matches_namespace(self, fullname): root, base, target = fullname.partition(self.root_name + '.') return not root and any(map(target.startswith, self.vendored_names)) - def find_module(self, fullname, path=None): - """ - Return self when fullname starts with root_name and the - target module is one vendored through this importer. - """ - spec = self.find_spec(fullname, path) - return spec.loader if spec is not None else None - def load_module(self, fullname): """ Iterate over the search path to locate and load fullname. diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py index bd8636c7b72..0d4acb3effa 100644 --- a/setuptools/extern/__init__.py +++ b/setuptools/extern/__init__.py @@ -26,14 +26,6 @@ def _module_matches_namespace(self, fullname): root, base, target = fullname.partition(self.root_name + '.') return not root and any(map(target.startswith, self.vendored_names)) - def find_module(self, fullname, path=None): - """ - Return self when fullname starts with root_name and the - target module is one vendored through this importer. - """ - spec = self.find_spec(fullname, path) - return spec.loader if spec is not None else None - def load_module(self, fullname): """ Iterate over the search path to locate and load fullname. From b5f3ae57debb9ef018aedc92dd0a3704a1d06fa7 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 9 Apr 2021 00:13:11 +0200 Subject: [PATCH 264/272] Use importlib.util.spec_from_loader in find_spec --- pkg_resources/extern/__init__.py | 4 ++-- setuptools/extern/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg_resources/extern/__init__.py b/pkg_resources/extern/__init__.py index 33e4e6f134e..fed59295403 100644 --- a/pkg_resources/extern/__init__.py +++ b/pkg_resources/extern/__init__.py @@ -1,4 +1,4 @@ -import importlib.machinery +import importlib.util import sys @@ -57,7 +57,7 @@ def exec_module(self, module): def find_spec(self, fullname, path=None, target=None): """Return a module spec for vendored names.""" return ( - importlib.machinery.ModuleSpec(fullname, self) + importlib.util.spec_from_loader(fullname, self) if self._module_matches_namespace(fullname) else None ) diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py index 0d4acb3effa..7df32fdea24 100644 --- a/setuptools/extern/__init__.py +++ b/setuptools/extern/__init__.py @@ -1,4 +1,4 @@ -import importlib.machinery +import importlib.util import sys @@ -57,7 +57,7 @@ def exec_module(self, module): def find_spec(self, fullname, path=None, target=None): """Return a module spec for vendored names.""" return ( - importlib.machinery.ModuleSpec(fullname, self) + importlib.util.spec_from_loader(fullname, self) if self._module_matches_namespace(fullname) else None ) From 1d330f9daded60f0d7721b51d8027494c5bf11d3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 8 Apr 2021 19:34:42 -0400 Subject: [PATCH 265/272] =?UTF-8?q?Bump=20version:=2055.0.0=20=E2=86=92=20?= =?UTF-8?q?56.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGES.rst | 28 ++++++++++++++++++++++++++++ changelog.d/2620.breaking.rst | 4 ---- changelog.d/2620.change.rst | 1 - changelog.d/2620.deprecation.rst | 2 -- changelog.d/2620.doc.rst | 1 - changelog.d/2632.change.rst | 3 --- setup.cfg | 2 +- 8 files changed, 30 insertions(+), 13 deletions(-) delete mode 100644 changelog.d/2620.breaking.rst delete mode 100644 changelog.d/2620.change.rst delete mode 100644 changelog.d/2620.deprecation.rst delete mode 100644 changelog.d/2620.doc.rst delete mode 100644 changelog.d/2632.change.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 7fe611a698d..dd76f43d913 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 55.0.0 +current_version = 56.0.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index d073fa8ef3f..ef1d926b154 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,31 @@ +v56.0.0 +------- + + +Deprecations +^^^^^^^^^^^^ +* #2620: The ``license_file`` option is now marked as deprecated. + Use ``license_files`` instead. -- by :user:`cdce8p` + +Breaking Changes +^^^^^^^^^^^^^^^^ +* #2620: If neither ``license_file`` nor ``license_files`` is specified, the ``sdist`` + option will now auto-include files that match the following patterns: + ``LICEN[CS]E*``, ``COPYING*``, ``NOTICE*``, ``AUTHORS*``. + This matches the behavior of ``bdist_wheel``. -- by :user:`cdce8p` + +Changes +^^^^^^^ +* #2620: The ``license_file`` and ``license_files`` options now support glob patterns. -- by :user:`cdce8p` +* #2632: Implemented ``VendorImporter.find_spec()`` method to get rid + of ``ImportWarning`` that Python 3.10 emits when only the old-style + importer hooks are present -- by :user:`webknjaz` + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ +* #2620: Added documentation for the ``license_files`` option. -- by :user:`cdce8p` + + v55.0.0 ------- diff --git a/changelog.d/2620.breaking.rst b/changelog.d/2620.breaking.rst deleted file mode 100644 index 431e7105d94..00000000000 --- a/changelog.d/2620.breaking.rst +++ /dev/null @@ -1,4 +0,0 @@ -If neither ``license_file`` nor ``license_files`` is specified, the ``sdist`` -option will now auto-include files that match the following patterns: -``LICEN[CS]E*``, ``COPYING*``, ``NOTICE*``, ``AUTHORS*``. -This matches the behavior of ``bdist_wheel``. -- by :user:`cdce8p` diff --git a/changelog.d/2620.change.rst b/changelog.d/2620.change.rst deleted file mode 100644 index 5470592d175..00000000000 --- a/changelog.d/2620.change.rst +++ /dev/null @@ -1 +0,0 @@ -The ``license_file`` and ``license_files`` options now support glob patterns. -- by :user:`cdce8p` diff --git a/changelog.d/2620.deprecation.rst b/changelog.d/2620.deprecation.rst deleted file mode 100644 index 1af5f2461a4..00000000000 --- a/changelog.d/2620.deprecation.rst +++ /dev/null @@ -1,2 +0,0 @@ -The ``license_file`` option is now marked as deprecated. -Use ``license_files`` instead. -- by :user:`cdce8p` diff --git a/changelog.d/2620.doc.rst b/changelog.d/2620.doc.rst deleted file mode 100644 index 7564adaca42..00000000000 --- a/changelog.d/2620.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Added documentation for the ``license_files`` option. -- by :user:`cdce8p` diff --git a/changelog.d/2632.change.rst b/changelog.d/2632.change.rst deleted file mode 100644 index a13bfdfa70d..00000000000 --- a/changelog.d/2632.change.rst +++ /dev/null @@ -1,3 +0,0 @@ -Implemented ``VendorImporter.find_spec()`` method to get rid -of ``ImportWarning`` that Python 3.10 emits when only the old-style -importer hooks are present -- by :user:`webknjaz` diff --git a/setup.cfg b/setup.cfg index 6bb6508f8bf..ebdc2c638c8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 55.0.0 +version = 56.0.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages From 78434a30184949c95bac3fab8b4c910e9f7266bb Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 10 Apr 2021 11:29:16 +0200 Subject: [PATCH 266/272] Refactor dist.read_pkg_file --- setuptools/dist.py | 64 ++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index 7cebcb37f48..8b687af7677 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -16,6 +16,7 @@ from distutils.debug import DEBUG from distutils.fancy_getopt import translate_longopt import itertools +from typing import List, Optional, TYPE_CHECKING from collections import defaultdict from email import message_from_file @@ -36,6 +37,9 @@ from setuptools.config import parse_configuration import pkg_resources +if TYPE_CHECKING: + from email.message import Message + __import__('setuptools.extern.packaging.specifiers') __import__('setuptools.extern.packaging.version') @@ -67,53 +71,57 @@ def get_metadata_version(self): return mv +def _read_field_from_msg(msg: "Message", field: str) -> Optional[str]: + """Read Message header field.""" + value = msg[field] + if value == 'UNKNOWN': + return None + return value + + +def _read_list_from_msg(msg: "Message", field: str) -> Optional[List[str]]: + """Read Message header field and return all results as list.""" + values = msg.get_all(field, None) + if values == []: + return None + return values + + def read_pkg_file(self, file): """Reads the metadata values from a file object.""" msg = message_from_file(file) - def _read_field(name): - value = msg[name] - if value == 'UNKNOWN': - return None - return value - - def _read_list(name): - values = msg.get_all(name, None) - if values == []: - return None - return values - self.metadata_version = StrictVersion(msg['metadata-version']) - self.name = _read_field('name') - self.version = _read_field('version') - self.description = _read_field('summary') + self.name = _read_field_from_msg(msg, 'name') + self.version = _read_field_from_msg(msg, 'version') + self.description = _read_field_from_msg(msg, 'summary') # we are filling author only. - self.author = _read_field('author') + self.author = _read_field_from_msg(msg, 'author') self.maintainer = None - self.author_email = _read_field('author-email') + self.author_email = _read_field_from_msg(msg, 'author-email') self.maintainer_email = None - self.url = _read_field('home-page') - self.license = _read_field('license') + self.url = _read_field_from_msg(msg, 'home-page') + self.license = _read_field_from_msg(msg, 'license') if 'download-url' in msg: - self.download_url = _read_field('download-url') + self.download_url = _read_field_from_msg(msg, 'download-url') else: self.download_url = None - self.long_description = _read_field('description') - self.description = _read_field('summary') + self.long_description = _read_field_from_msg(msg, 'description') + self.description = _read_field_from_msg(msg, 'summary') if 'keywords' in msg: - self.keywords = _read_field('keywords').split(',') + self.keywords = _read_field_from_msg(msg, 'keywords').split(',') - self.platforms = _read_list('platform') - self.classifiers = _read_list('classifier') + self.platforms = _read_list_from_msg(msg, 'platform') + self.classifiers = _read_list_from_msg(msg, 'classifier') # PEP 314 - these fields only exist in 1.1 if self.metadata_version == StrictVersion('1.1'): - self.requires = _read_list('requires') - self.provides = _read_list('provides') - self.obsoletes = _read_list('obsoletes') + self.requires = _read_list_from_msg(msg, 'requires') + self.provides = _read_list_from_msg(msg, 'provides') + self.obsoletes = _read_list_from_msg(msg, 'obsoletes') else: self.requires = None self.provides = None From c18ed8706d759e11d7bb7e9070a1897ee2f1e979 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 10 Apr 2021 11:30:10 +0200 Subject: [PATCH 267/272] Add rfc822_unescape --- setuptools/dist.py | 21 +++++++++++++++++- setuptools/tests/test_dist.py | 40 +++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index 8b687af7677..c7af35dc99f 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -16,6 +16,7 @@ from distutils.debug import DEBUG from distutils.fancy_getopt import translate_longopt import itertools +import textwrap from typing import List, Optional, TYPE_CHECKING from collections import defaultdict @@ -71,6 +72,16 @@ def get_metadata_version(self): return mv +def rfc822_unescape(content: str) -> str: + """Reverse RFC-822 escaping by removing leading whitespaces from content.""" + lines = content.splitlines() + if len(lines) == 1: + return lines[0].lstrip() + return '\n'.join( + (lines[0].lstrip(), + textwrap.dedent('\n'.join(lines[1:])))) + + def _read_field_from_msg(msg: "Message", field: str) -> Optional[str]: """Read Message header field.""" value = msg[field] @@ -79,6 +90,14 @@ def _read_field_from_msg(msg: "Message", field: str) -> Optional[str]: return value +def _read_field_unescaped_from_msg(msg: "Message", field: str) -> Optional[str]: + """Read Message header field and apply rfc822_unescape.""" + value = _read_field_from_msg(msg, field) + if value is None: + return value + return rfc822_unescape(value) + + def _read_list_from_msg(msg: "Message", field: str) -> Optional[List[str]]: """Read Message header field and return all results as list.""" values = msg.get_all(field, None) @@ -108,7 +127,7 @@ def read_pkg_file(self, file): else: self.download_url = None - self.long_description = _read_field_from_msg(msg, 'description') + self.long_description = _read_field_unescaped_from_msg(msg, 'description') self.description = _read_field_from_msg(msg, 'summary') if 'keywords' in msg: diff --git a/setuptools/tests/test_dist.py b/setuptools/tests/test_dist.py index e4bba47bce8..dcec1734a97 100644 --- a/setuptools/tests/test_dist.py +++ b/setuptools/tests/test_dist.py @@ -10,6 +10,8 @@ check_package_data, DistDeprecationWarning, check_specifier, + rfc822_escape, + rfc822_unescape, ) from setuptools import sic from setuptools import Distribution @@ -85,6 +87,9 @@ def __read_test_cases(): ('Metadata version 1.1: Provides', params( provides=['package'], )), + ('Metadata Version 1.0: Short long description', params( + long_description='Short long description', + )), ('Metadata version 1.1: Obsoletes', params( obsoletes=['foo'], )), @@ -162,6 +167,7 @@ def test_read_metadata(name, attrs): ('metadata_version', dist_class.get_metadata_version), ('provides', dist_class.get_provides), ('description', dist_class.get_description), + ('long_description', dist_class.get_long_description), ('download_url', dist_class.get_download_url), ('keywords', dist_class.get_keywords), ('platforms', dist_class.get_platforms), @@ -336,3 +342,37 @@ def test_check_specifier(): attrs = {'name': 'foo', 'python_requires': ['>=3.0', '!=3.1']} with pytest.raises(DistutilsSetupError): dist = Distribution(attrs) + + +@pytest.mark.parametrize( + 'content, result', + ( + pytest.param( + "Just a single line", + None, + id="single_line", + ), + pytest.param( + "Multiline\nText\nwithout\nextra indents\n", + None, + id="multiline", + ), + pytest.param( + "Multiline\n With\n\nadditional\n indentation", + None, + id="multiline_with_indentation", + ), + pytest.param( + " Leading whitespace", + "Leading whitespace", + id="remove_leading_whitespace", + ), + pytest.param( + " Leading whitespace\nIn\n Multiline comment", + "Leading whitespace\nIn\n Multiline comment", + id="remove_leading_whitespace_multiline", + ), + ) +) +def test_rfc822_unescape(content, result): + assert (result or content) == rfc822_unescape(rfc822_escape(content)) From 87efb79effe2ed8a914a6e9f3855c4b925c52513 Mon Sep 17 00:00:00 2001 From: Karthikeyan Singaravelan Date: Sat, 17 Apr 2021 06:21:33 +0000 Subject: [PATCH 268/272] Set daemon attribute instead of using setDaemon method that was deprecated in Python 3.10 --- changelog.d/2644.misc.rst | 1 + setuptools/tests/server.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/2644.misc.rst diff --git a/changelog.d/2644.misc.rst b/changelog.d/2644.misc.rst new file mode 100644 index 00000000000..1aa9fbbe4e7 --- /dev/null +++ b/changelog.d/2644.misc.rst @@ -0,0 +1 @@ +Fixed ``DeprecationWarning`` due to ``threading.Thread.setDaemon`` in tests -- by :user:`tirkarthi` diff --git a/setuptools/tests/server.py b/setuptools/tests/server.py index 7e2132301b2..6717c053588 100644 --- a/setuptools/tests/server.py +++ b/setuptools/tests/server.py @@ -65,7 +65,7 @@ def __init__( http.server.HTTPServer.__init__( self, server_address, RequestHandlerClass) threading.Thread.__init__(self) - self.setDaemon(True) + self.daemon = True self.requests = [] def run(self): From 2c8ce42135c78af0cf0157b0602891b0cfb6e92b Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Wed, 21 Apr 2021 11:05:27 +0200 Subject: [PATCH 269/272] Drop deprecated `issue_body` from the forms --- .github/ISSUE_TEMPLATE/bug-report.yml | 1 - .../ISSUE_TEMPLATE/documentation-report.yml | 34 +++++++++---------- .github/ISSUE_TEMPLATE/feature-request.yml | 1 - 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 5f551a4be74..73911ec8a5b 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -7,7 +7,6 @@ title: '[BUG] ' labels: - bug - Needs Triage -issue_body: false # default: true, adds a classic WSYWIG textarea, if on body: - type: markdown diff --git a/.github/ISSUE_TEMPLATE/documentation-report.yml b/.github/ISSUE_TEMPLATE/documentation-report.yml index a947dad83ed..238ce896505 100644 --- a/.github/ISSUE_TEMPLATE/documentation-report.yml +++ b/.github/ISSUE_TEMPLATE/documentation-report.yml @@ -5,8 +5,6 @@ description: Ask us about docs labels: - documentation - Needs Triage -# NOTE: issue body is enabled to allow screenshots -issue_body: true # default: true, adds a classic WSYWIG textarea, if on body: - type: markdown @@ -64,6 +62,22 @@ body: placeholder: Fedora 33, Firefox etc. +- type: textarea + attributes: + label: Additional Information + description: > + Describe how this improves the documentation, e.g. before/after + situation or screenshots. + + + **HINT:** You can paste https://gist.github.com links for larger files. + placeholder: >- + When the improvement is applied, it makes it more straightforward + to understand X. + validations: + required: true + + - type: checkboxes attributes: label: Code of Conduct @@ -74,20 +88,4 @@ body: options: - label: I agree to follow the PSF Code of Conduct required: true - - -- type: markdown - attributes: - value: > - - - ### Additional Information - - - Describe how this improves the documentation, e.g. before/after - situation or screenshots. - - - **HINT:** You can paste https://gist.github.com links for - larger files. ... diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml index 7dec35a8dca..88ae6741ffd 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yml +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -5,7 +5,6 @@ title: '[FR] ' labels: - enhancement - Needs Triage -issue_body: false # default: true, adds a classic WSYWIG textarea, if on body: - type: markdown From 3603b28cba984bcf37e2299475a27c8f2a9d1bd9 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Wed, 21 Apr 2021 16:49:34 +0200 Subject: [PATCH 270/272] Make changelog tmpl compatible w/ new towncrier Ref: https://github.com/pypa/pip/issues/9815 --- towncrier_template.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/towncrier_template.rst b/towncrier_template.rst index 31098b7cf67..7f507342d7d 100644 --- a/towncrier_template.rst +++ b/towncrier_template.rst @@ -1,3 +1,7 @@ +{% if top_line %} +{{ top_line }} +{{ top_underline * ((top_line)|length)}} +{% endif %} {% for section, _ in sections.items() %} {% set underline = underlines[0] %}{% if section %}{{section}} {{ underline * section|length }} From f070bcfc81f9e690acc35a3ead69e1f6b35eadce Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 25 Apr 2021 15:13:03 +0200 Subject: [PATCH 271/272] Add a change note for PR #2654 --- changelog.d/2654.misc.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog.d/2654.misc.rst diff --git a/changelog.d/2654.misc.rst b/changelog.d/2654.misc.rst new file mode 100644 index 00000000000..268c4a2e469 --- /dev/null +++ b/changelog.d/2654.misc.rst @@ -0,0 +1,2 @@ +Made the changelog generator compatible +with Towncrier >= 19.9 -- :user:`webknjaz` From c8493546a65add95c77d0eca258a9e006794ac59 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Wed, 21 Apr 2021 18:48:18 +0200 Subject: [PATCH 272/272] =?UTF-8?q?=F0=9F=94=A5=20Drop=20the=20Netlify=20c?= =?UTF-8?q?onfigs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is no longer needed since the project relies on RTD PR builds for some time already. --- netlify.toml | 7 ------- runtime.txt | 1 - 2 files changed, 8 deletions(-) delete mode 100644 netlify.toml delete mode 100644 runtime.txt diff --git a/netlify.toml b/netlify.toml deleted file mode 100644 index 5828132eddd..00000000000 --- a/netlify.toml +++ /dev/null @@ -1,7 +0,0 @@ -# Configuration for pull request documentation previews via Netlify - -# Netlify relies on there being a ./runtime.txt to indicate Python 3. - -[build] - publish = "build/html" - command = "pip install tox && tox -e docs" diff --git a/runtime.txt b/runtime.txt deleted file mode 100644 index 475ba515c04..00000000000 --- a/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -3.7