Skip to content

Commit

Permalink
Merge branch 'Use-set-instead-of-True-only-dict' of https://github.co…
Browse files Browse the repository at this point in the history
…m/Avasam/setuptools into Use-set-instead-of-True-only-dict
  • Loading branch information
Avasam committed May 21, 2024
2 parents a9e8847 + 4c92134 commit ab8b5b3
Show file tree
Hide file tree
Showing 24 changed files with 76 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 69.5.1
current_version = 70.0.0
commit = True
tag = True

Expand Down
56 changes: 56 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
@@ -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
=======

Expand Down
1 change: 0 additions & 1 deletion newsfragments/4136.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4150.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4255.misc.rst

This file was deleted.

3 changes: 0 additions & 3 deletions newsfragments/4262.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4267.feature.rst

This file was deleted.

2 changes: 0 additions & 2 deletions newsfragments/4278.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4280.misc.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4282.misc.rst

This file was deleted.

2 changes: 0 additions & 2 deletions newsfragments/4308.misc.rst

This file was deleted.

7 changes: 0 additions & 7 deletions newsfragments/4309.removal.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4312.doc.rst

This file was deleted.

3 changes: 0 additions & 3 deletions newsfragments/4322.removal.1.rst

This file was deleted.

3 changes: 0 additions & 3 deletions newsfragments/4322.removal.2.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4324.removal.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4332.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4348.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/4348.misc.rst

This file was deleted.

2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 0 additions & 16 deletions setuptools/dep_util.py

This file was deleted.

28 changes: 14 additions & 14 deletions setuptools/tests/test_editable_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,29 +396,26 @@ 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.
"""
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',
Expand Down Expand Up @@ -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 ----
Expand Down
4 changes: 3 additions & 1 deletion tools/vendored.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit ab8b5b3

Please sign in to comment.