Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setuptools/_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def safer_name(value: str) -> str:

def safer_best_effort_version(value: str) -> str:
"""Like ``best_effort_version`` but can be used as filename component for wheel"""
# See bdist_wheel.safer_verion
# See bdist_wheel.safer_version
# TODO: Replace with only safe_version in the future (no need for best effort)
return filename_component(best_effort_version(value))

Expand Down
4 changes: 2 additions & 2 deletions setuptools/config/_apply_pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from setuptools._importlib import metadata
from setuptools.dist import Distribution

from distutils.dist import _OptionsList # Comes from typeshed

Check warning on line 35 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.13, ubuntu-latest)

"_OptionsList" is unknown import symbol (reportAttributeAccessIssue)

Check warning on line 35 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.13, ubuntu-latest)

Import "distutils.dist" could not be resolved from source (reportMissingModuleSource)


EMPTY: Mapping = MappingProxyType({}) # Immutable dict-like
Expand Down Expand Up @@ -405,7 +405,7 @@
>>> _attrgetter("d")(obj) is None
True
"""
return partial(reduce, lambda acc, x: getattr(acc, x, None), attr.split("."))

Check warning on line 408 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.13, ubuntu-latest)

Argument of type "_S@reduce" cannot be assigned to parameter "name" of type "str" in function "getattr"   "object*" is not assignable to "str" (reportArgumentType)

Check warning on line 408 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.13, ubuntu-latest)

No overloads for "getattr" match the provided arguments (reportCallIssue)

Check warning on line 408 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.9, ubuntu-latest)

Argument of type "_S@reduce" cannot be assigned to parameter "name" of type "str" in function "getattr"   "object*" is not assignable to "str" (reportArgumentType)

Check warning on line 408 in setuptools/config/_apply_pyprojecttoml.py

View workflow job for this annotation

GitHub Actions / pyright (3.9, ubuntu-latest)

No overloads for "getattr" match the provided arguments (reportCallIssue)


def _some_attrgetter(*items):
Expand All @@ -421,11 +421,11 @@
True
"""

def _acessor(obj):
def _accessor(obj):
values = (_attrgetter(i)(obj) for i in items)
return next((i for i in values if i is not None), None)

return _acessor
return _accessor


PYPROJECT_CORRESPONDENCE: dict[str, _Correspondence] = {
Expand Down
12 changes: 6 additions & 6 deletions setuptools/config/_validate_pyproject/error_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def __call__(
if isinstance(schema, list):
return self._handle_list(schema, prefix, _path)

filtered = self._filter_unecessary(schema, _path)
filtered = self._filter_unnecessary(schema, _path)
simple = self._handle_simple_dict(filtered, _path)
if simple:
return f"{prefix}{simple}"
Expand All @@ -239,7 +239,7 @@ def __call__(
buffer.write(f"{line_prefix}{self._label(child_path)}:")
# ^ just the first item should receive the complete prefix
if isinstance(value, dict):
filtered = self._filter_unecessary(value, child_path)
filtered = self._filter_unnecessary(value, child_path)
simple = self._handle_simple_dict(filtered, child_path)
buffer.write(
f" {simple}"
Expand All @@ -256,19 +256,19 @@ def __call__(
buffer.write(f" {self._value(value, child_path)}\n")
return buffer.getvalue()

def _is_unecessary(self, path: Sequence[str]) -> bool:
def _is_unnecessary(self, path: Sequence[str]) -> bool:
if self._is_property(path) or not path: # empty path => instruction @ root
return False
key = path[-1]
return any(key.startswith(k) for k in "$_") or key in self._IGNORE

def _filter_unecessary(
def _filter_unnecessary(
self, schema: dict[str, Any], path: Sequence[str]
) -> dict[str, Any]:
return {
key: value
for key, value in schema.items()
if not self._is_unecessary([*path, key])
if not self._is_unnecessary([*path, key])
}

def _handle_simple_dict(self, value: dict, path: Sequence[str]) -> str | None:
Expand All @@ -281,7 +281,7 @@ def _handle_simple_dict(self, value: dict, path: Sequence[str]) -> str | None:
def _handle_list(
self, schemas: list, prefix: str = "", path: Sequence[str] = ()
) -> str:
if self._is_unecessary(path):
if self._is_unnecessary(path):
return ""

repr_ = repr(schemas)
Expand Down
4 changes: 2 additions & 2 deletions setuptools/config/_validate_pyproject/extra_validations.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def validate_project_dynamic(pyproject: T) -> T:
return pyproject


def validate_include_depenency(pyproject: T) -> T:
def validate_include_dependency(pyproject: T) -> T:
dependency_groups = pyproject.get("dependency-groups", {})
for key, value in dependency_groups.items():
for each in value:
Expand Down Expand Up @@ -146,6 +146,6 @@ def validate_import_name_issues(pyproject: T) -> T:

EXTRA_VALIDATIONS = (
validate_project_dynamic,
validate_include_depenency,
validate_include_dependency,
validate_import_name_issues,
)
10 changes: 5 additions & 5 deletions setuptools/config/_validate_pyproject/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ def url(value: str) -> bool:
# https://packaging.python.org/specifications/entry-points/
ENTRYPOINT_PATTERN = r"[^\[\s=]([^=]*[^\s=])?"
ENTRYPOINT_REGEX = re.compile(f"^{ENTRYPOINT_PATTERN}$", re.IGNORECASE)
RECOMMEDED_ENTRYPOINT_PATTERN = r"[\w.-]+"
RECOMMEDED_ENTRYPOINT_REGEX = re.compile(
f"^{RECOMMEDED_ENTRYPOINT_PATTERN}$", re.IGNORECASE
RECOMMENDED_ENTRYPOINT_PATTERN = r"[\w.-]+"
RECOMMENDED_ENTRYPOINT_REGEX = re.compile(
f"^{RECOMMENDED_ENTRYPOINT_PATTERN}$", re.IGNORECASE
)
ENTRYPOINT_GROUP_PATTERN = r"\w+(\.\w+)*"
ENTRYPOINT_GROUP_REGEX = re.compile(f"^{ENTRYPOINT_GROUP_PATTERN}$", re.IGNORECASE)
Expand Down Expand Up @@ -334,9 +334,9 @@ def python_entrypoint_name(value: str) -> bool:
"""
if not ENTRYPOINT_REGEX.match(value):
return False
if not RECOMMEDED_ENTRYPOINT_REGEX.match(value):
if not RECOMMENDED_ENTRYPOINT_REGEX.match(value):
msg = f"Entry point `{value}` does not follow recommended pattern: "
msg += RECOMMEDED_ENTRYPOINT_PATTERN
msg += RECOMMENDED_ENTRYPOINT_PATTERN
_logger.warning(msg)
return True

Expand Down
2 changes: 1 addition & 1 deletion setuptools/tests/config/test_setupcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def test_unknown_meta_item(self, tmpdir):
with get_dist(tmpdir, parse=False) as dist:
dist.parse_config_files() # Skip unknown.

def test_usupported_section(self, tmpdir):
def test_unsupported_section(self, tmpdir):
fake_env(tmpdir, '[metadata.some]\nkey = val\n')
with get_dist(tmpdir, parse=False) as dist:
with pytest.raises(DistutilsOptionError):
Expand Down
2 changes: 1 addition & 1 deletion setuptools/tests/test_build_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def method(*args, **kw):
pytest.xfail(f"Backend did not respond before timeout ({TIMEOUT} s)")
except (futures.process.BrokenProcessPool, MemoryError, OSError):
if IS_PYPY:
pytest.xfail("PyPy frequently fails tests with ProcessPoolExector")
pytest.xfail("PyPy frequently fails tests with ProcessPoolExecutor")
raise

return method
Expand Down
4 changes: 2 additions & 2 deletions setuptools/tests/test_config_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_sdist_filelist(self, tmp_path, circumstance):
files, options = self._get_info(circumstance)
_populate_project_dir(tmp_path, files, options)

_, cmd = _run_sdist_programatically(tmp_path, options)
_, cmd = _run_sdist_programmatically(tmp_path, options)

manifest = [f.replace(os.sep, "/") for f in cmd.filelist.files]
for file in files:
Expand Down Expand Up @@ -635,7 +635,7 @@ def _get_dist(dist_path, attrs):
return dist


def _run_sdist_programatically(dist_path, attrs):
def _run_sdist_programmatically(dist_path, attrs):
dist = _get_dist(dist_path, attrs)
cmd = sdist(dist)
cmd.ensure_finalized()
Expand Down
Loading