Skip to content

Commit f523cce

Browse files
committed
Merge branch 'main' into fix-relative-to
2 parents d3a1333 + 0ae1d24 commit f523cce

File tree

17 files changed

+78
-83
lines changed

17 files changed

+78
-83
lines changed

.coveragerc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ disable_warnings =
1313

1414
[report]
1515
show_missing = True
16+
exclude_also =
17+
# jaraco/skeleton#97
18+
@overload
19+
if TYPE_CHECKING:

.readthedocs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ python:
77

88
# required boilerplate readthedocs/readthedocs.org#10401
99
build:
10-
os: ubuntu-22.04
10+
os: ubuntu-lts-latest
1111
tools:
12-
python: "3"
12+
python: latest

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
.. image:: https://readthedocs.org/projects/importlib-metadata/badge/?version=latest
1515
:target: https://importlib-metadata.readthedocs.io/en/latest/?badge=latest
1616

17-
.. image:: https://img.shields.io/badge/skeleton-2023-informational
17+
.. image:: https://img.shields.io/badge/skeleton-2024-informational
1818
:target: https://blog.jaraco.com/skeleton
1919

2020
.. image:: https://tidelift.com/badges/package/pypi/importlib-metadata

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
collect_ignore = [
55
# this module fails mypy tests because 'setup.py' matches './setup.py'
6-
'prepare/example/setup.py',
6+
'tests/data/sources/example/setup.py',
77
]
88

99

importlib_metadata/__init__.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,9 @@ def read_text(self, filename) -> Optional[str]:
377377
- METADATA: The distribution metadata including fields
378378
like Name and Version and Description.
379379
- entry_points.txt: A series of entry points as defined in
380-
`this spec <https://packaging.python.org/en/latest/specifications/entry-points/#file-format>`_.
380+
`the entry points spec <https://packaging.python.org/en/latest/specifications/entry-points/#file-format>`_.
381381
- RECORD: A record of files according to
382-
`this spec <https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-record-file>`_.
382+
`this recording spec <https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-record-file>`_.
383383
384384
A package may provide any set of files, including those
385385
not listed here or none at all.
@@ -683,6 +683,17 @@ class Context:
683683
Each DistributionFinder may expect any parameters
684684
and should attempt to honor the canonical
685685
parameters defined below when appropriate.
686+
687+
This mechanism gives a custom provider a means to
688+
solicit additional details from the caller beyond
689+
"name" and "path" when searching distributions.
690+
For example, imagine a provider that exposes suites
691+
of packages in either a "public" or "private" ``realm``.
692+
A caller may wish to query only for distributions in
693+
a particular realm and could call
694+
``distributions(realm="private")`` to signal to the
695+
custom provider to only include distributions from that
696+
realm.
686697
"""
687698

688699
name = None
@@ -774,6 +785,7 @@ class Lookup:
774785
"""
775786
A micro-optimized class for searching a (fast) path for metadata.
776787
"""
788+
777789
def __init__(self, path: FastPath):
778790
"""
779791
Calculate all of the children representing metadata.

importlib_metadata/_meta.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,27 @@
99

1010

1111
class PackageMetadata(Protocol):
12-
def __len__(self) -> int:
13-
... # pragma: no cover
12+
def __len__(self) -> int: ... # pragma: no cover
1413

15-
def __contains__(self, item: str) -> bool:
16-
... # pragma: no cover
14+
def __contains__(self, item: str) -> bool: ... # pragma: no cover
1715

18-
def __getitem__(self, key: str) -> str:
19-
... # pragma: no cover
16+
def __getitem__(self, key: str) -> str: ... # pragma: no cover
2017

21-
def __iter__(self) -> Iterator[str]:
22-
... # pragma: no cover
18+
def __iter__(self) -> Iterator[str]: ... # pragma: no cover
2319

2420
@overload
25-
def get(self, name: str, failobj: None = None) -> Optional[str]:
26-
... # pragma: no cover
21+
def get(
22+
self, name: str, failobj: None = None
23+
) -> Optional[str]: ... # pragma: no cover
2724

2825
@overload
29-
def get(self, name: str, failobj: _T) -> Union[str, _T]:
30-
... # pragma: no cover
26+
def get(self, name: str, failobj: _T) -> Union[str, _T]: ... # pragma: no cover
3127

3228
# overload per python/importlib_metadata#435
3329
@overload
34-
def get_all(self, name: str, failobj: None = None) -> Optional[List[Any]]:
35-
... # pragma: no cover
30+
def get_all(
31+
self, name: str, failobj: None = None
32+
) -> Optional[List[Any]]: ... # pragma: no cover
3633

3734
@overload
3835
def get_all(self, name: str, failobj: _T) -> Union[List[Any], _T]:
@@ -52,24 +49,21 @@ class SimplePath(Protocol):
5249
A minimal subset of pathlib.Path required by Distribution.
5350
"""
5451

55-
def joinpath(self, other: Union[str, os.PathLike[str]]) -> SimplePath:
56-
... # pragma: no cover
52+
def joinpath(
53+
self, other: Union[str, os.PathLike[str]]
54+
) -> SimplePath: ... # pragma: no cover
5755

58-
def __truediv__(self, other: Union[str, os.PathLike[str]]) -> SimplePath:
59-
... # pragma: no cover
56+
def __truediv__(
57+
self, other: Union[str, os.PathLike[str]]
58+
) -> SimplePath: ... # pragma: no cover
6059

6160
@property
62-
def parent(self) -> SimplePath:
63-
... # pragma: no cover
61+
def parent(self) -> SimplePath: ... # pragma: no cover
6462

65-
def read_text(self, encoding=None) -> str:
66-
... # pragma: no cover
63+
def read_text(self, encoding=None) -> str: ... # pragma: no cover
6764

68-
def read_bytes(self) -> bytes:
69-
... # pragma: no cover
65+
def read_bytes(self) -> bytes: ... # pragma: no cover
7066

71-
def exists(self) -> bool:
72-
... # pragma: no cover
67+
def exists(self) -> bool: ... # pragma: no cover
7368

74-
def resolve(self) -> bool:
75-
... # pragma: no cover
69+
def resolve(self) -> bool: ... # pragma: no cover

importlib_metadata/_py39compat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Compatibility layer with Python 3.8/3.9
33
"""
4+
45
from typing import TYPE_CHECKING, Any, Optional
56

67
if TYPE_CHECKING: # pragma: no cover

ruff.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
[lint]
2+
extend-select = [
3+
"C901",
4+
"W",
5+
]
26
ignore = [
37
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
48
"W191",
@@ -18,5 +22,7 @@ ignore = [
1822
]
1923

2024
[format]
25+
# Enable preview, required for quote-style = "preserve"
26+
preview = true
2127
# https://docs.astral.sh/ruff/settings/#format-quote-style
2228
quote-style = "preserve"

setup.cfg

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,12 @@ classifiers =
1313
Programming Language :: Python :: 3 :: Only
1414

1515
[options]
16-
packages = find_namespace:
1716
include_package_data = true
1817
python_requires = >=3.8
1918
install_requires =
2019
zipp>=0.5
2120
typing-extensions>=3.6.4; python_version < "3.8"
2221

23-
[options.packages.find]
24-
exclude =
25-
build*
26-
dist*
27-
docs*
28-
tests*
29-
prepare*
30-
3122
[options.extras_require]
3223
testing =
3324
# upstream
@@ -50,8 +41,6 @@ testing =
5041
docs =
5142
# upstream
5243
sphinx >= 3.5
53-
# workaround for sphinx/sphinx-doc#11662
54-
sphinx < 7.2.5
5544
jaraco.packaging >= 9.3
5645
rst.linker >= 1.9
5746
furo

tests/_path.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,15 @@ class Symlink(str):
1717

1818
@runtime_checkable
1919
class TreeMaker(Protocol):
20-
def __truediv__(self, *args, **kwargs):
21-
... # pragma: no cover
20+
def __truediv__(self, *args, **kwargs): ... # pragma: no cover
2221

23-
def mkdir(self, **kwargs):
24-
... # pragma: no cover
22+
def mkdir(self, **kwargs): ... # pragma: no cover
2523

26-
def write_text(self, content, **kwargs):
27-
... # pragma: no cover
24+
def write_text(self, content, **kwargs): ... # pragma: no cover
2825

29-
def write_bytes(self, content):
30-
... # pragma: no cover
26+
def write_bytes(self, content): ... # pragma: no cover
3127

32-
def symlink_to(self, target):
33-
... # pragma: no cover
28+
def symlink_to(self, target): ... # pragma: no cover
3429

3530

3631
def _ensure_tree_maker(obj: Union[str, TreeMaker]) -> TreeMaker:

0 commit comments

Comments
 (0)