Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: python/importlib_metadata
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.1.0
Choose a base ref
...
head repository: python/importlib_metadata
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v7.2.0
Choose a head ref
  • 19 commits
  • 12 files changed
  • 5 contributors

Commits on Mar 21, 2024

  1. GH-109653: Defer import of importlib.metadata._adapters (python/c…

    …python#109829)
    
    ---------
    
    Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
    AA-Turner and jaraco committed Mar 21, 2024
    Copy the full SHA
    6673723 View commit details
  2. Allow mypy on PyPy (jaraco/skeleton#111)

    pypa/setuptools#4257 shows that mypy now works with PyPy
    Avasam authored Mar 21, 2024
    Copy the full SHA
    a0d0c4b View commit details

Commits on Mar 22, 2024

  1. Copy the full SHA
    c9a7f97 View commit details

Commits on Mar 23, 2024

  1. Copy the full SHA
    d72c6a0 View commit details

Commits on Mar 30, 2024

  1. Move Python 3.11 out of the test matrix.

    Probably should have done this when moving continue-on-error to Python 3.13.
    jaraco committed Mar 30, 2024
    Copy the full SHA
    3fc7a93 View commit details

Commits on Mar 31, 2024

  1. Copy the full SHA
    6ff02e0 View commit details

Commits on Apr 10, 2024

  1. Add link to blog entry from jaraco/skeleton#115 above CI build matrix.

    Bartosz Sławecki authored and jaraco committed Apr 10, 2024
    Copy the full SHA
    34ba6b2 View commit details

Commits on Apr 16, 2024

  1. Copy the full SHA
    7ad4f2f View commit details
  2. Move project metadata to pyproject.toml (jaraco/skeleton#122)

    Intentionally omitted specifying `tool.setuptools.include-package-data`: it's true by default in `pyproject.toml` according to https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data.
    
    Closes jaraco/skeleton#121
    Bartosz Sławecki authored Apr 16, 2024
    Copy the full SHA
    f4529af View commit details

Commits on Apr 18, 2024

  1. Migrated config to pyproject.toml using jaraco.develop.migrate-config…

    … and ini2toml.
    jaraco committed Apr 18, 2024
    Copy the full SHA
    d34801b View commit details

Commits on Apr 24, 2024

  1. Copy the full SHA
    744cf2a View commit details
  2. Move project.urls to appear in the order that ini2toml generates it. …

    …Remove project.scripts.
    jaraco committed Apr 24, 2024
    Copy the full SHA
    bcf8f07 View commit details
  3. Merge https://github.com/jaraco/skeleton

    # Conflicts:
    #	pyproject.toml
    jaraco committed Apr 24, 2024
    Copy the full SHA
    42b4610 View commit details

Commits on May 2, 2024

  1. Revert "Allow macos on Python 3.8 to fail as GitHub CI has dropped su…

    …pport."
    
    This reverts commit 744cf2a.
    jaraco committed May 2, 2024
    Copy the full SHA
    67aab15 View commit details

Commits on May 10, 2024

  1. Merge https://github.com/jaraco/skeleton

    jaraco committed May 10, 2024
    Copy the full SHA
    e8f6869 View commit details

Commits on May 31, 2024

  1. Copy the full SHA
    a595a0f View commit details

Commits on Jun 20, 2024

  1. Copy the full SHA
    5eee2ff View commit details
  2. gh-120801: Update fixtures.

    Removed unused fixtures relating to cwd. Rely on os_helper.temp_dir where relevant. Renamed to tmp_path to reflect pathlib behavior.
    jaraco committed Jun 20, 2024
    Copy the full SHA
    963f643 View commit details
  3. Finalize

    jaraco committed Jun 20, 2024
    Copy the full SHA
    311cef4 View commit details
Showing with 102 additions and 97 deletions.
  1. +8 −3 .github/workflows/main.yml
  2. +5 −1 .readthedocs.yaml
  3. +10 −0 NEWS.rst
  4. +4 −1 importlib_metadata/__init__.py
  5. +58 −1 pyproject.toml
  6. +4 −1 pytest.ini
  7. +0 −58 setup.cfg
  8. +1 −1 tests/compat/py39.py
  9. +7 −26 tests/fixtures.py
  10. +1 −1 tests/test_api.py
  11. +1 −1 tests/test_main.py
  12. +3 −3 tox.ini
11 changes: 8 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -4,8 +4,11 @@ on:
merge_group:
push:
branches-ignore:
# disabled for jaraco/skeleton#103
# - gh-readonly-queue/** # Temporary merge queue-related GH-made branches
# temporary GH branches relating to merge queues (jaraco/skeleton#93)
- gh-readonly-queue/**
tags:
# required if branches-ignore is supplied (jaraco/skeleton#103)
- '**'
pull_request:

permissions:
@@ -28,10 +31,10 @@ env:
jobs:
test:
strategy:
# https://blog.jaraco.com/efficient-use-of-ci-resources/
matrix:
python:
- "3.8"
- "3.11"
- "3.12"
platform:
- ubuntu-latest
@@ -42,6 +45,8 @@ jobs:
platform: ubuntu-latest
- python: "3.10"
platform: ubuntu-latest
- python: "3.11"
platform: ubuntu-latest
- python: pypy3.10
platform: ubuntu-latest
runs-on: ${{ matrix.platform }}
6 changes: 5 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -3,10 +3,14 @@ python:
install:
- path: .
extra_requirements:
- docs
- doc

# required boilerplate readthedocs/readthedocs.org#10401
build:
os: ubuntu-lts-latest
tools:
python: latest
# post-checkout job to ensure the clone isn't shallow jaraco/skeleton#114
jobs:
post_checkout:
- git fetch --unshallow || true
10 changes: 10 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
v7.2.0
======

Features
--------

- Deferred select imports in for speedup (python/cpython#109829).
- Updated fixtures for python/cpython#120801.


v7.1.0
======

5 changes: 4 additions & 1 deletion importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
import posixpath
import collections

from . import _adapters, _meta
from . import _meta
from .compat import py39
from ._collections import FreezableDefaultDict, Pair
from ._compat import (
@@ -461,6 +461,9 @@ def metadata(self) -> _meta.PackageMetadata:
Custom providers may provide the METADATA file or override this
property.
"""
# deferred for performance (python/cpython#109829)
from . import _adapters

opt_text = (
self.read_text('METADATA')
or self.read_text('PKG-INFO')
59 changes: 58 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,62 @@
[build-system]
requires = ["setuptools>=56", "setuptools_scm[toml]>=3.4.1"]
requires = ["setuptools>=61.2", "setuptools_scm[toml]>=3.4.1"]
build-backend = "setuptools.build_meta"

[project]
name = "importlib_metadata"
authors = [
{ name = "Jason R. Coombs", email = "jaraco@jaraco.com" },
]
description = "Read metadata from Python packages"
readme = "README.rst"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
]
requires-python = ">=3.8"
dependencies = [
"zipp>=0.5",
'typing-extensions>=3.6.4; python_version < "3.8"',
]
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/python/importlib_metadata"

[project.optional-dependencies]
test = [
# upstream
"pytest >= 6, != 8.1.*",
"pytest-checkdocs >= 2.4",
"pytest-cov",
"pytest-mypy",
"pytest-enabler >= 2.2",
"pytest-ruff >= 0.2.1",

# local
'importlib_resources>=1.3; python_version < "3.9"',
"packaging",
"pyfakefs",
"flufl.flake8",
"pytest-perf >= 0.9.2",
"jaraco.test >= 5.4",
]
doc = [
# upstream
"sphinx >= 3.5",
"jaraco.packaging >= 9.3",
"rst.linker >= 1.9",
"furo",
"sphinx-lint",

# tidelift
"jaraco.tidelift >= 1.4",

# local
]
perf = ["ipython"]

[tool.setuptools_scm]
5 changes: 4 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[pytest]
norecursedirs=dist build .tox .eggs
addopts=--doctest-modules
addopts=
--doctest-modules
--import-mode importlib
consider_namespace_packages=true
filterwarnings=
## upstream

58 changes: 0 additions & 58 deletions setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion tests/compat/py39.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@


os_helper = try_import('os_helper') or from_test_support(
'FS_NONASCII', 'skip_unless_symlink'
'FS_NONASCII', 'skip_unless_symlink', 'temp_dir'
)
import_helper = try_import('import_helper') or from_test_support(
'modules_setup', 'modules_cleanup'
33 changes: 7 additions & 26 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import os
import sys
import copy
import json
import shutil
import pathlib
import tempfile
import textwrap
import functools
import contextlib
@@ -26,29 +24,12 @@


@contextlib.contextmanager
def tempdir():
tmpdir = tempfile.mkdtemp()
try:
yield pathlib.Path(tmpdir)
finally:
shutil.rmtree(tmpdir)


@contextlib.contextmanager
def save_cwd():
orig = os.getcwd()
try:
yield
finally:
os.chdir(orig)


@contextlib.contextmanager
def tempdir_as_cwd():
with tempdir() as tmp:
with save_cwd():
os.chdir(str(tmp))
yield tmp
def tmp_path():
"""
Like os_helper.temp_dir, but yields a pathlib.Path.
"""
with os_helper.temp_dir() as path:
yield pathlib.Path(path)


@contextlib.contextmanager
@@ -69,7 +50,7 @@ def setUp(self):
class SiteDir(Fixtures):
def setUp(self):
super().setUp()
self.site_dir = self.fixtures.enter_context(tempdir())
self.site_dir = self.fixtures.enter_context(tmp_path())


class OnSysPath(Fixtures):
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@ def test_entry_points_unique_packages_normalized(self):
Entry points should only be exposed for the first package
on sys.path with a given name (even when normalized).
"""
alt_site_dir = self.fixtures.enter_context(fixtures.tempdir())
alt_site_dir = self.fixtures.enter_context(fixtures.tmp_path())
self.fixtures.enter_context(self.add_sys_path(alt_site_dir))
alt_pkg = {
"DistInfo_pkg-1.1.0.dist-info": {
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
@@ -135,7 +135,7 @@ def test_unique_distributions(self):
fixtures.build_files(self.make_pkg('abc'), self.site_dir)
before = list(_unique(distributions()))

alt_site_dir = self.fixtures.enter_context(fixtures.tempdir())
alt_site_dir = self.fixtures.enter_context(fixtures.tmp_path())
self.fixtures.enter_context(self.add_sys_path(alt_site_dir))
fixtures.build_files(self.make_pkg('ABC'), alt_site_dir)
after = list(_unique(distributions()))
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ passenv =
HOME
usedevelop = True
extras =
testing
test

[testenv:diffcov]
description = run tests and check that diff from main is covered
@@ -24,8 +24,8 @@ commands =
[testenv:docs]
description = build the documentation
extras =
docs
testing
doc
test
changedir = docs
commands =
python -m sphinx -W --keep-going . {toxinidir}/build/html