diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 557ae0ce341..70a34a3ed9e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 69.5.1 +current_version = 70.0.0 commit = True tag = True diff --git a/NEWS.rst b/NEWS.rst index 73a8148d9ca..06da16714be 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -1,3 +1,59 @@ +v70.0.0 +======= + +Features +-------- + +- Emit a warning when ``[tools.setuptools]`` is present in ``pyproject.toml`` and will be ignored. -- by :user:`SnoopJ` (#4150) +- Improved `AttributeError` error message if ``pkg_resources.EntryPoint.require`` is called without extras or distribution + Gracefully "do nothing" when trying to activate a ``pkg_resources.Distribution`` with a `None` location, rather than raising a `TypeError` + -- by :user:`Avasam` (#4262) +- Typed the dynamically defined variables from `pkg_resources` -- by :user:`Avasam` (#4267) +- Modernized and refactored VCS handling in package_index. (#4332) + + +Bugfixes +-------- + +- In install command, use super to call the superclass methods. Avoids race conditions when monkeypatching from _distutils_system_mod occurs late. (#4136) +- Fix finder template for lenient editable installs of implicit nested namespaces + constructed by using ``package_dir`` to reorganise directory structure. (#4278) +- Fix an error with `UnicodeDecodeError` handling in ``pkg_resources`` when trying to read files in UTF-8 with a fallback -- by :user:`Avasam` (#4348) + + +Improved Documentation +---------------------- + +- Uses RST substitution to put badges in 1 line. (#4312) + + +Deprecations and Removals +------------------------- + +- Further adoption of UTF-8 in ``setuptools``. + This change regards mostly files produced and consumed during the build process + (e.g. metadata files, script wrappers, automatically updated config files, etc..) + Although precautions were taken to minimize disruptions, some edge cases might + be subject to backwards incompatibility. + + Support for ``"locale"`` encoding is now **deprecated**. (#4309) +- Remove ``setuptools.convert_path`` after long deprecation period. + This function was never defined by ``setuptools`` itself, but rather a + side-effect of an import for internal usage. (#4322) +- Remove fallback for customisations of ``distutils``' ``build.sub_command`` after long + deprecated period. + Users are advised to import ``build`` directly from ``setuptools.command.build``. (#4322) +- Removed ``typing_extensions`` from vendored dependencies -- by :user:`Avasam` (#4324) +- Remove deprecated ``setuptools.dep_util``. + The provided alternative is ``setuptools.modified``. (#4360) + + +Misc +---- + +- #4255, #4280, #4282, #4308, #4348 + + v69.5.1 ======= diff --git a/newsfragments/4136.bugfix.rst b/newsfragments/4136.bugfix.rst deleted file mode 100644 index f56346f0c79..00000000000 --- a/newsfragments/4136.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -In install command, use super to call the superclass methods. Avoids race conditions when monkeypatching from _distutils_system_mod occurs late. \ No newline at end of file diff --git a/newsfragments/4150.feature.rst b/newsfragments/4150.feature.rst deleted file mode 100644 index 5e536fd755d..00000000000 --- a/newsfragments/4150.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Emit a warning when ``[tools.setuptools]`` is present in ``pyproject.toml`` and will be ignored. -- by :user:`SnoopJ` diff --git a/newsfragments/4255.misc.rst b/newsfragments/4255.misc.rst deleted file mode 100644 index 50a0a3d195c..00000000000 --- a/newsfragments/4255.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Treat ``EncodingWarning``s as errors in tests. -- by :user:`Avasam` diff --git a/newsfragments/4262.feature.rst b/newsfragments/4262.feature.rst deleted file mode 100644 index 7bbdba87d28..00000000000 --- a/newsfragments/4262.feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -Improved `AttributeError` error message if ``pkg_resources.EntryPoint.require`` is called without extras or distribution -Gracefully "do nothing" when trying to activate a ``pkg_resources.Distribution`` with a `None` location, rather than raising a `TypeError` --- by :user:`Avasam` diff --git a/newsfragments/4267.feature.rst b/newsfragments/4267.feature.rst deleted file mode 100644 index 5a69c23914a..00000000000 --- a/newsfragments/4267.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Typed the dynamically defined variables from `pkg_resources` -- by :user:`Avasam` diff --git a/newsfragments/4278.bugfix.rst b/newsfragments/4278.bugfix.rst deleted file mode 100644 index 5e606cced8d..00000000000 --- a/newsfragments/4278.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix finder template for lenient editable installs of implicit nested namespaces -constructed by using ``package_dir`` to reorganise directory structure. diff --git a/newsfragments/4280.misc.rst b/newsfragments/4280.misc.rst deleted file mode 100644 index aff6a7ca1c6..00000000000 --- a/newsfragments/4280.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Avoid leaking loop variable ``name`` in ``AbstractSandbox`` -- by :user:`Avasam` diff --git a/newsfragments/4282.misc.rst b/newsfragments/4282.misc.rst deleted file mode 100644 index 841d1b292c0..00000000000 --- a/newsfragments/4282.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Removed the ``setuptools[testing-integration]`` in favor of ``setuptools[testing]`` -- by :user:`Avasam` diff --git a/newsfragments/4308.misc.rst b/newsfragments/4308.misc.rst deleted file mode 100644 index 6c43f6338ee..00000000000 --- a/newsfragments/4308.misc.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix ``setuptools_wheel`` fixture and avoid the recursive creation of -``build/lib/build/lib/build/...`` directories in the project root during tests. diff --git a/newsfragments/4309.removal.rst b/newsfragments/4309.removal.rst deleted file mode 100644 index b69b17d45f7..00000000000 --- a/newsfragments/4309.removal.rst +++ /dev/null @@ -1,7 +0,0 @@ -Further adoption of UTF-8 in ``setuptools``. -This change regards mostly files produced and consumed during the build process -(e.g. metadata files, script wrappers, automatically updated config files, etc..) -Although precautions were taken to minimize disruptions, some edge cases might -be subject to backwards incompatibility. - -Support for ``"locale"`` encoding is now **deprecated**. diff --git a/newsfragments/4312.doc.rst b/newsfragments/4312.doc.rst deleted file mode 100644 index 7ada9548767..00000000000 --- a/newsfragments/4312.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Uses RST substitution to put badges in 1 line. diff --git a/newsfragments/4322.removal.1.rst b/newsfragments/4322.removal.1.rst deleted file mode 100644 index 33360172d59..00000000000 --- a/newsfragments/4322.removal.1.rst +++ /dev/null @@ -1,3 +0,0 @@ -Remove ``setuptools.convert_path`` after long deprecation period. -This function was never defined by ``setuptools`` itself, but rather a -side-effect of an import for internal usage. diff --git a/newsfragments/4322.removal.2.rst b/newsfragments/4322.removal.2.rst deleted file mode 100644 index 88380f4c8d6..00000000000 --- a/newsfragments/4322.removal.2.rst +++ /dev/null @@ -1,3 +0,0 @@ -Remove fallback for customisations of ``distutils``' ``build.sub_command`` after long -deprecated period. -Users are advised to import ``build`` directly from ``setuptools.command.build``. diff --git a/newsfragments/4324.removal.rst b/newsfragments/4324.removal.rst deleted file mode 100644 index 3782a0b81bd..00000000000 --- a/newsfragments/4324.removal.rst +++ /dev/null @@ -1 +0,0 @@ -Removed ``typing_extensions`` from vendored dependencies -- by :user:`Avasam` diff --git a/newsfragments/4332.feature.rst b/newsfragments/4332.feature.rst deleted file mode 100644 index 9f46298adc4..00000000000 --- a/newsfragments/4332.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Modernized and refactored VCS handling in package_index. \ No newline at end of file diff --git a/newsfragments/4348.bugfix.rst b/newsfragments/4348.bugfix.rst deleted file mode 100644 index a8bb79a123e..00000000000 --- a/newsfragments/4348.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix an error with `UnicodeDecodeError` handling in ``pkg_resources`` when trying to read files in UTF-8 with a fallback -- by :user:`Avasam` diff --git a/newsfragments/4348.misc.rst b/newsfragments/4348.misc.rst deleted file mode 100644 index 989226c4b33..00000000000 --- a/newsfragments/4348.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Update dynamic module imports in ``pkg_resources`` to private alias static imports. Enabled ``attr-defined`` checks in mypy for ``pkg_resources`` -- by :user:`Avasam` diff --git a/setup.cfg b/setup.cfg index 38350cd0c98..e0e74377635 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = setuptools -version = 69.5.1 +version = 70.0.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages diff --git a/setuptools/dep_util.py b/setuptools/dep_util.py deleted file mode 100644 index 998ffa206e4..00000000000 --- a/setuptools/dep_util.py +++ /dev/null @@ -1,16 +0,0 @@ -from ._distutils import _modified -from .warnings import SetuptoolsDeprecationWarning - - -def __getattr__(name): - if name not in ['newer_group', 'newer_pairwise_group']: - raise AttributeError(name) - SetuptoolsDeprecationWarning.emit( - "dep_util is Deprecated. Use functions from setuptools.modified instead.", - "Please use `setuptools.modified` instead of `setuptools.dep_util`.", - see_url="https://github.com/pypa/setuptools/pull/4069", - due_date=(2024, 5, 21), - # Warning added in v69.0.0 on 2023/11/20, - # See https://github.com/pypa/setuptools/discussions/4128 - ) - return getattr(_modified, name) diff --git a/setuptools/tests/test_editable_install.py b/setuptools/tests/test_editable_install.py index 300a02cfb9e..24c10a50547 100644 --- a/setuptools/tests/test_editable_install.py +++ b/setuptools/tests/test_editable_install.py @@ -396,11 +396,6 @@ def test_namespace_accidental_config_in_lenient_mode(self, venv, tmp_path): assert "mypkg.other not defined" in out -# Moved here from test_develop: -@pytest.mark.xfail( - platform.python_implementation() == 'PyPy', - reason="Workaround fails on PyPy (why?)", -) def test_editable_with_prefix(tmp_path, sample_project, editable_opts): """ Editable install to a prefix should be discoverable. @@ -408,17 +403,19 @@ def test_editable_with_prefix(tmp_path, sample_project, editable_opts): prefix = tmp_path / 'prefix' # figure out where pip will likely install the package - site_packages = prefix / next( - Path(path).relative_to(sys.prefix) + site_packages_all = [ + prefix / Path(path).relative_to(sys.prefix) for path in sys.path if 'site-packages' in path and path.startswith(sys.prefix) - ) - site_packages.mkdir(parents=True) + ] + + for sp in site_packages_all: + sp.mkdir(parents=True) # install workaround - _addsitedir(site_packages) + _addsitedirs(site_packages_all) - env = dict(os.environ, PYTHONPATH=str(site_packages)) + env = dict(os.environ, PYTHONPATH=os.pathsep.join(map(str, site_packages_all))) cmd = [ sys.executable, '-m', @@ -1250,14 +1247,17 @@ def install_project(name, venv, tmp_path, files, *opts): return project, out -def _addsitedir(new_dir: Path): +def _addsitedirs(new_dirs): """To use this function, it is necessary to insert new_dir in front of sys.path. The Python process will try to import a ``sitecustomize`` module on startup. If we manipulate sys.path/PYTHONPATH, we can force it to run our code, which invokes ``addsitedir`` and ensure ``.pth`` files are loaded. """ - file = f"import site; site.addsitedir({os.fspath(new_dir)!r})\n" - (new_dir / "sitecustomize.py").write_text(file, encoding="utf-8") + content = '\n'.join( + ("import site",) + + tuple(f"site.addsitedir({os.fspath(new_dir)!r})" for new_dir in new_dirs) + ) + (new_dirs[0] / "sitecustomize.py").write_text(content, encoding="utf-8") # ---- Assertion Helpers ---- diff --git a/tools/vendored.py b/tools/vendored.py index 69a538f20c1..41079e1330b 100644 --- a/tools/vendored.py +++ b/tools/vendored.py @@ -171,9 +171,11 @@ def yield_top_level(name): >>> examples = roots & {"jaraco", "backports", "zipp"} >>> list(sorted(examples)) ['backports', 'jaraco', 'zipp'] + >>> 'bin' in examples + False """ vendor = Path(f"{name}/_vendor") - ignore = {"__pycache__", "__init__.py", ".ruff_cache"} + ignore = {"__pycache__", "__init__.py", ".ruff_cache", "bin"} for item in sorted(vendor.iterdir()): if item.name in ignore: diff --git a/tox.ini b/tox.ini index e6fc063af13..c6d70689070 100644 --- a/tox.ini +++ b/tox.ini @@ -91,6 +91,7 @@ description = publish the package to PyPI and GitHub skip_install = True deps = build + pyproject-hooks!=1.1 # workaround for pypa/setuptools#4333 twine>=3 jaraco.develop>=7.1 pass_env =