Skip to content

Commit

Permalink
Moved the dependencies to a 'core' extra to avoid dangers with cyclic…
Browse files Browse the repository at this point in the history
… dependencies at build time.
  • Loading branch information
jaraco committed Jul 3, 2024
1 parent f2be5d6 commit bccb86b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion newsfragments/2825.removal.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Now setuptools declares its own dependencies. Dependencies are still vendored for bootstrapping purposes, but installed dependencies are preferred. Downstream packagers can de-vendor by simply removing the ``setuptools/_vendor`` directory.
Now setuptools declares its own dependencies in the ``core`` extra. Dependencies are still vendored for bootstrapping purposes, but installed dependencies are preferred. Downstream packagers can de-vendor by simply removing the ``setuptools/_vendor`` directory.
24 changes: 13 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ classifiers = [
keywords = ["CPAN PyPI distutils eggs package management"]
requires-python = ">=3.8"
dependencies = [
"packaging>=24",
"ordered-set>=3.1.1",
"more_itertools>=8.8",
"jaraco.text>=3.7",
"importlib_resources>=5.10.2",
"importlib_metadata>=6",
"tomli>=2.0.1",
"wheel>=0.43.0",

# pkg_resources
"platformdirs >= 2.6.2",
]

[project.urls]
Expand Down Expand Up @@ -107,6 +96,19 @@ doc = [
]
ssl = []
certs = []
core = [
"packaging>=24",
"ordered-set>=3.1.1",
"more_itertools>=8.8",
"jaraco.text>=3.7",
"importlib_resources>=5.10.2",
"importlib_metadata>=6",
"tomli>=2.0.1",
"wheel>=0.43.0",

# pkg_resources
"platformdirs >= 2.6.2",
]

[project.entry-points."distutils.commands"]
alias = "setuptools.command.alias:alias"
Expand Down
12 changes: 10 additions & 2 deletions tools/vendored.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import functools
import re
import sys
import subprocess

Expand Down Expand Up @@ -29,11 +30,18 @@ def metadata():
return jaraco.packaging.metadata.load('.')


def upgrade_core(dep):
"""
Remove 'extra == "core"' from any dependency.
"""
return re.sub('''(;| and) extra == ['"]core['"]''', '', dep)


def load_deps():
"""
Read the dependencies from `.`.
Read the dependencies from `.[core]`.
"""
return metadata().get_all('Requires-Dist')
return list(map(upgrade_core, metadata().get_all('Requires-Dist')))


def min_python():
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ commands =
usedevelop = True
extras =
test
core
pass_env =
SETUPTOOLS_USE_DISTUTILS
SETUPTOOLS_ENFORCE_DEPRECATION
Expand Down

0 comments on commit bccb86b

Please sign in to comment.