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 — Provide a simple syntax to load resources from __here__ · Issue #259 · python/importlib_resources

Provide a simple syntax to load resources from __here__ #259

New issue
Copy link
New issue
Copy link
Closed
#260
Closed
Provide a simple syntax to load resources from __here__#259
#260
Copy link
Labels
enhancementNew feature or requestNew feature or request

Description

@jaraco
jaraco
opened on Jul 23, 2022
Issue body actions

Currently, files() requires a parameter indicating from which package to load the resources. A common practice is to pass __package__, meaning load resources from the same package that this module is in.

When #203 is solved, it also becomes possible to use files(__name__) to mean the same thing (load resources from the same package that this module is in or for non-package modules other resources found alongside this module).

Perhaps it would be cleaner and simpler to support files() with no parameter, meaning the same thing (load resources alongside this module). No doubt, this form is the most common usage of files(). Alternately, files could accept the special value "." with the same meaning.

Either implementation would require importlib resources to infer the module from the caller's context. This feature would be an anti-feature if that couldn't be inferred reliably on all Python implementations.

Activity

  1. jaraco
    added
    enhancementNew feature or requestNew feature or request
    on Jul 23, 2022
  2. jaraco
    added a commit that references this issue on Jul 23, 2022

    Allow a package to resolve its own resources without having to pass a…

    This issue will close once commit a34ce52 is merged into the 'main' branch.
    a34ce52
  3. jaraco commented on Jul 23, 2022

    @jaraco
    jaraco
    on Jul 23, 2022
    MemberAuthor
    More actions

    I've drafted a proof of concept in https://github.com/python/importlib_resources/tree/feature/implicit-here.

  4. jaraco
    added a commit that references this issue on Jul 23, 2022

    Allow a package to resolve its own resources without having to pass a…

    This issue will close once commit 91360ae is merged into the 'main' branch.
    91360ae
  5. jaraco
    added 2 commits that reference this issue on Oct 5, 2022

    Allow a package to resolve its own resources without having to pass a…

    This issue will close once commit dda15e1 is merged into the 'main' branch.
    dda15e1

    Allow a package to resolve its own resources without having to pass a…

    This issue will close once commit 4198b31 is merged into the 'main' branch.
    4198b31
  6. jaraco
    closed this as completedin #260on Oct 8, 2022
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

    enhancementNew feature or requestNew feature or request

    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.