Skip to content

Commit 51b3be4

Browse files
committed
Merge branch 'main' into feature/origin
2 parents f480907 + e886c99 commit 51b3be4

File tree

10 files changed

+117
-124
lines changed

10 files changed

+117
-124
lines changed

.github/workflows/main.yml

Lines changed: 25 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,17 @@ permissions:
66
contents: read
77

88
env:
9-
# Environment variables to support color support (jaraco/skeleton#66):
10-
# Request colored output from CLI tools supporting it. Different tools
11-
# interpret the value differently. For some, just being set is sufficient.
12-
# For others, it must be a non-zero integer. For yet others, being set
13-
# to a non-empty value is sufficient. For tox, it must be one of
14-
# <blank>, 0, 1, false, no, off, on, true, yes. The only enabling value
15-
# in common is "1".
9+
# Environment variable to support color support (jaraco/skeleton#66)
1610
FORCE_COLOR: 1
17-
# MyPy's color enforcement (must be a non-zero number)
18-
MYPY_FORCE_COLOR: -42
19-
# Recognized by the `py` package, dependency of `pytest` (must be "1")
20-
PY_COLORS: 1
21-
# Make tox-wrapped tools see color requests
22-
TOX_TESTENV_PASSENV: >-
23-
FORCE_COLOR
24-
MYPY_FORCE_COLOR
25-
NO_COLOR
26-
PY_COLORS
27-
PYTEST_THEME
28-
PYTEST_THEME_MODE
2911

3012
# Suppress noisy pip warnings
3113
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
3214
PIP_NO_PYTHON_VERSION_WARNING: 'true'
3315
PIP_NO_WARN_SCRIPT_LOCATION: 'true'
3416

35-
# Disable the spinner, noise in GHA; TODO(webknjaz): Fix this upstream
36-
# Must be "1".
37-
TOX_PARALLEL_NO_SPINNER: 1
17+
# Ensure tests can sense settings about the environment
18+
TOX_OVERRIDE: >-
19+
testenv.pass_env+=GITHUB_*,FORCE_COLOR
3820
3921
4022
jobs:
@@ -54,48 +36,47 @@ jobs:
5436
platform: ubuntu-latest
5537
- python: "3.10"
5638
platform: ubuntu-latest
57-
# disabled for #463
58-
# - python: pypy3.9
59-
# platform: ubuntu-latest
39+
- python: pypy3.10
40+
platform: ubuntu-latest
6041
runs-on: ${{ matrix.platform }}
61-
continue-on-error: ${{ matrix.python == '3.12' }}
42+
continue-on-error: ${{ matrix.python == '3.13' }}
6243
steps:
63-
- uses: actions/checkout@v3
64-
with:
65-
# fetch all branches and tags (to get tags for versioning)
66-
# ref actions/checkout#448
67-
fetch-depth: 0
44+
- uses: actions/checkout@v4
6845
- name: Setup Python
6946
uses: actions/setup-python@v4
7047
with:
7148
python-version: ${{ matrix.python }}
7249
allow-prereleases: true
7350
- name: Install tox
74-
run: |
75-
python -m pip install tox
51+
run: python -m pip install tox
7652
- name: Run
7753
run: tox
7854

79-
docs:
55+
collateral:
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
job: [diffcov, docs]
8060
runs-on: ubuntu-latest
81-
env:
82-
TOXENV: docs
8361
steps:
84-
- uses: actions/checkout@v3
62+
- uses: actions/checkout@v4
63+
with:
64+
fetch-depth: 0
8565
- name: Setup Python
8666
uses: actions/setup-python@v4
67+
with:
68+
python-version: 3.x
8769
- name: Install tox
88-
run: |
89-
python -m pip install tox
90-
- name: Run
91-
run: tox
70+
run: python -m pip install tox
71+
- name: Eval ${{ matrix.job }}
72+
run: tox -e ${{ matrix.job }}
9273

9374
check: # This job does nothing and is only used for the branch protection
9475
if: always()
9576

9677
needs:
9778
- test
98-
- docs
79+
- collateral
9980

10081
runs-on: ubuntu-latest
10182

@@ -104,24 +85,6 @@ jobs:
10485
uses: re-actors/alls-green@release/v1
10586
with:
10687
jobs: ${{ toJSON(needs) }}
107-
108-
diffcov:
109-
runs-on: ubuntu-latest
110-
steps:
111-
- uses: actions/checkout@v2
112-
with:
113-
fetch-depth: 0
114-
- name: Setup Python
115-
uses: actions/setup-python@v2
116-
with:
117-
python-version: 3.9
118-
- name: Install tox
119-
run: |
120-
python -m pip install tox
121-
- name: Evaluate coverage
122-
run: tox
123-
env:
124-
TOXENV: diffcov
12588

12689
release:
12790
permissions:
@@ -132,14 +95,13 @@ jobs:
13295
runs-on: ubuntu-latest
13396

13497
steps:
135-
- uses: actions/checkout@v3
98+
- uses: actions/checkout@v4
13699
- name: Setup Python
137100
uses: actions/setup-python@v4
138101
with:
139102
python-version: 3.x
140103
- name: Install tox
141-
run: |
142-
python -m pip install tox
104+
run: python -m pip install tox
143105
- name: Run
144106
run: tox -e release
145107
env:

NEWS.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
v6.10.0
2+
=======
3+
4+
Features
5+
--------
6+
7+
- Added diagnose script. (#461)
8+
9+
10+
v6.9.0
11+
======
12+
13+
Features
14+
--------
15+
16+
- Added EntryPoints.__repr__ (#473)
17+
18+
119
v6.8.0
220
======
321

@@ -131,6 +149,10 @@ v4.11.4
131149
duplicate entry points by packages varying only by non-normalized
132150
name are hidden.
133151

152+
Note (#459): This change had a backward-incompatible effect for
153+
any installers that created metadata in the filesystem with dashes
154+
in the package names (not replaced by underscores).
155+
134156
v4.11.3
135157
=======
136158

importlib_metadata/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,13 @@ def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override]
295295
except StopIteration:
296296
raise KeyError(name)
297297

298+
def __repr__(self):
299+
"""
300+
Repr with classname and tuple constructor to
301+
signal that we deviate from regular tuple behavior.
302+
"""
303+
return '%s(%r)' % (self.__class__.__name__, tuple(self))
304+
298305
def select(self, **params):
299306
"""
300307
Select entry points from self that match the

importlib_metadata/_adapters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __iter__(self):
5454
def __getitem__(self, item):
5555
"""
5656
Warn users that a ``KeyError`` can be expected when a
57-
mising key is supplied. Ref python/importlib_metadata#371.
57+
missing key is supplied. Ref python/importlib_metadata#371.
5858
"""
5959
res = super().__getitem__(item)
6060
if res is None:

importlib_metadata/diagnose.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import sys
2+
3+
from . import Distribution
4+
5+
6+
def inspect(path):
7+
print("Inspecting", path)
8+
dists = list(Distribution.discover(path=[path]))
9+
if not dists:
10+
return
11+
print("Found", len(dists), "packages:", end=' ')
12+
print(', '.join(dist.name for dist in dists))
13+
14+
15+
def run():
16+
for path in sys.path:
17+
inspect(path)
18+
19+
20+
if __name__ == '__main__':
21+
run()

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ filterwarnings=
2424
# pypa/build#615
2525
ignore:'encoding' argument not specified::build.env
2626

27+
# dateutil/dateutil#1284
28+
ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning:dateutil.tz.tz
29+
2730
## end upstream

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ testing =
5353
docs =
5454
# upstream
5555
sphinx >= 3.5
56+
# workaround for sphinx/sphinx-doc#11662
57+
sphinx < 7.2.5
5658
jaraco.packaging >= 9.3
5759
rst.linker >= 1.9
5860
furo

tests/fixtures.py

Lines changed: 18 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,15 @@ def setUp(self):
8686
self.fixtures.enter_context(self.add_sys_path(self.site_dir))
8787

8888

89-
class DistInfoPkg(OnSysPath, SiteDir):
89+
class SiteBuilder(SiteDir):
90+
def setUp(self):
91+
super().setUp()
92+
for cls in self.__class__.mro():
93+
with contextlib.suppress(AttributeError):
94+
build_files(cls.files, prefix=self.site_dir)
95+
96+
97+
class DistInfoPkg(OnSysPath, SiteBuilder):
9098
files: FilesSpec = {
9199
"distinfo_pkg-1.0.0.dist-info": {
92100
"METADATA": """
@@ -113,10 +121,6 @@ def main():
113121
""",
114122
}
115123

116-
def setUp(self):
117-
super().setUp()
118-
build_files(DistInfoPkg.files, self.site_dir)
119-
120124
def make_uppercase(self):
121125
"""
122126
Rewrite metadata with everything uppercase.
@@ -148,12 +152,8 @@ class DistInfoPkgEditable(DistInfoPkg):
148152
},
149153
}
150154

151-
def setUp(self):
152-
super().setUp()
153-
build_files(DistInfoPkgEditable.files, self.site_dir)
154155

155-
156-
class DistInfoPkgWithDot(OnSysPath, SiteDir):
156+
class DistInfoPkgWithDot(OnSysPath, SiteBuilder):
157157
files: FilesSpec = {
158158
"pkg_dot-1.0.0.dist-info": {
159159
"METADATA": """
@@ -163,12 +163,8 @@ class DistInfoPkgWithDot(OnSysPath, SiteDir):
163163
},
164164
}
165165

166-
def setUp(self):
167-
super().setUp()
168-
build_files(DistInfoPkgWithDot.files, self.site_dir)
169-
170166

171-
class DistInfoPkgWithDotLegacy(OnSysPath, SiteDir):
167+
class DistInfoPkgWithDotLegacy(OnSysPath, SiteBuilder):
172168
files: FilesSpec = {
173169
"pkg.dot-1.0.0.dist-info": {
174170
"METADATA": """
@@ -184,18 +180,12 @@ class DistInfoPkgWithDotLegacy(OnSysPath, SiteDir):
184180
},
185181
}
186182

187-
def setUp(self):
188-
super().setUp()
189-
build_files(DistInfoPkgWithDotLegacy.files, self.site_dir)
190183

184+
class DistInfoPkgOffPath(SiteBuilder):
185+
files = DistInfoPkg.files
191186

192-
class DistInfoPkgOffPath(SiteDir):
193-
def setUp(self):
194-
super().setUp()
195-
build_files(DistInfoPkg.files, self.site_dir)
196187

197-
198-
class EggInfoPkg(OnSysPath, SiteDir):
188+
class EggInfoPkg(OnSysPath, SiteBuilder):
199189
files: FilesSpec = {
200190
"egginfo_pkg.egg-info": {
201191
"PKG-INFO": """
@@ -230,12 +220,8 @@ def main():
230220
""",
231221
}
232222

233-
def setUp(self):
234-
super().setUp()
235-
build_files(EggInfoPkg.files, prefix=self.site_dir)
236-
237223

238-
class EggInfoPkgPipInstalledNoToplevel(OnSysPath, SiteDir):
224+
class EggInfoPkgPipInstalledNoToplevel(OnSysPath, SiteBuilder):
239225
files: FilesSpec = {
240226
"egg_with_module_pkg.egg-info": {
241227
"PKG-INFO": "Name: egg_with_module-pkg",
@@ -265,12 +251,8 @@ def main():
265251
""",
266252
}
267253

268-
def setUp(self):
269-
super().setUp()
270-
build_files(EggInfoPkgPipInstalledNoToplevel.files, prefix=self.site_dir)
271254

272-
273-
class EggInfoPkgPipInstalledNoModules(OnSysPath, SiteDir):
255+
class EggInfoPkgPipInstalledNoModules(OnSysPath, SiteBuilder):
274256
files: FilesSpec = {
275257
"egg_with_no_modules_pkg.egg-info": {
276258
"PKG-INFO": "Name: egg_with_no_modules-pkg",
@@ -295,12 +277,8 @@ class EggInfoPkgPipInstalledNoModules(OnSysPath, SiteDir):
295277
},
296278
}
297279

298-
def setUp(self):
299-
super().setUp()
300-
build_files(EggInfoPkgPipInstalledNoModules.files, prefix=self.site_dir)
301-
302280

303-
class EggInfoPkgSourcesFallback(OnSysPath, SiteDir):
281+
class EggInfoPkgSourcesFallback(OnSysPath, SiteBuilder):
304282
files: FilesSpec = {
305283
"sources_fallback_pkg.egg-info": {
306284
"PKG-INFO": "Name: sources_fallback-pkg",
@@ -321,12 +299,8 @@ def main():
321299
""",
322300
}
323301

324-
def setUp(self):
325-
super().setUp()
326-
build_files(EggInfoPkgSourcesFallback.files, prefix=self.site_dir)
327-
328302

329-
class EggInfoFile(OnSysPath, SiteDir):
303+
class EggInfoFile(OnSysPath, SiteBuilder):
330304
files: FilesSpec = {
331305
"egginfo_file.egg-info": """
332306
Metadata-Version: 1.0
@@ -342,10 +316,6 @@ class EggInfoFile(OnSysPath, SiteDir):
342316
""",
343317
}
344318

345-
def setUp(self):
346-
super().setUp()
347-
build_files(EggInfoFile.files, prefix=self.site_dir)
348-
349319

350320
# dedent all text strings before writing
351321
orig = _path.create.registry[str]

tests/test_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def test_packages_distributions_all_module_types(self):
400400

401401
assert not any(name.endswith('.dist-info') for name in distributions)
402402

403-
def test_packages_distributions_symlinked_top_level(self):
403+
def test_packages_distributions_symlinked_top_level(self) -> None:
404404
"""
405405
Distribution is resolvable from a simple top-level symlink in RECORD.
406406
See #452.

0 commit comments

Comments
 (0)