GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove deprecated parameter alias for `importlib.resources.files` · Issue #138044 · python/cpython

Remove deprecated parameter alias for importlib.resources.files #138044

New issue
Copy link
New issue
Copy link
Closed
Closed
Remove deprecated parameter alias for importlib.resources.files#138044
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-importlibtype-featureA feature request or enhancementA feature request or enhancement

Description

@donbarbos
donbarbos
opened on Aug 22, 2025
Issue body actions

Argument name was replaced from package to anchor for Python 3.12.0a4 in PR #100598, and comment to remove this compatibility was added separately in PR #117054, both by @jaraco.
Looks like it was missed so I suggest to remove this compatibility.

Docs: https://docs.python.org/dev/library/importlib.resources.html#importlib.resources.files
Source:

cpython/Lib/importlib/resources/_common.py

Lines 19 to 56 in 5a7f5ea

def package_to_anchor(func):
"""
Replace 'package' parameter as 'anchor' and warn about the change.
Other errors should fall through.
>>> files('a', 'b')
Traceback (most recent call last):
TypeError: files() takes from 0 to 1 positional arguments but 2 were given
Remove this compatibility in Python 3.14.
"""
undefined = object()
@functools.wraps(func)
def wrapper(anchor=undefined, package=undefined):
if package is not undefined:
if anchor is not undefined:
return func(anchor, package)
warnings.warn(
"First parameter to files is renamed to 'anchor'",
DeprecationWarning,
stacklevel=2,
)
return func(package)
elif anchor is undefined:
return func()
return func(anchor)
return wrapper
@package_to_anchor
def files(anchor: Optional[Anchor] = None) -> Traversable:
"""
Get a Traversable resource for an anchor.
"""
return from_package(resolve(anchor))

Linked PRs

  • gh-138044: Remove deprecated parameter alias for importlib.resources.files #138059
  • gh-138044: Fix importlib.resources.files deprecation docs #139632

Activity

  1. StanFromIreland
    added
    type-featureA feature request or enhancementA feature request or enhancement
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    topic-importlib
    on Aug 22, 2025
  2. StanFromIreland commented on Aug 22, 2025

    @StanFromIreland
    StanFromIreland
    on Aug 22, 2025
    Member
    More actions

    Do you want to open a PR?

  3. donbarbos commented on Aug 22, 2025

    @donbarbos
    donbarbos
    on Aug 22, 2025
    ContributorAuthor
    More actions

    Yes, I would like to

    Reacted by Stan Ulbrych
  4. donbarbos
    added a commit that references this issue on Aug 22, 2025

    pythongh-138044: Remove deprecated parameter alias for `importlib.res…

    8dad453
  5. brianschubert commented on Aug 22, 2025

    @brianschubert
    brianschubert
    on Aug 22, 2025
    Contributor
    More actions
    1. I noticed that both the referenced PR are syncs with importlib_resources. Should changes like this generally be made upstream in importlib_resources first?
    2. These days we tend to prefer 5 year deprecation periods (PEP-387). Since the warning was added in 3.12, would it make sense to instead slate it for removal in 3.17?
  6. FFY00
    added a commit that references this issue on Oct 4, 2025

    gh-138044: Remove deprecated parameter alias for `importlib.resources…

    8d17d79
  7. donbarbos
    closed this as completedon Oct 4, 2025
  8. sobolevn
    added 2 commits that reference this issue on Oct 5, 2025

    pythongh-138044: Fix `importlib.resources.files` deprecation docs

    dd90003

    pythongh-138044: Fix `importlib.resources.files` deprecation docs

    d9775bd
  9. danigm
    added a commit that references this issue on Oct 7, 2025

    pythongh-138044: Remove deprecated parameter alias for `importlib.res…

    a2f4956
  10. sobolevn
    added a commit that references this issue on Oct 11, 2025

    gh-138044: Fix `importlib.resources.files` deprecation docs (#139632)

    d6dd64a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-importlibtype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.