Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Provide a simple syntax to load resources from __here__ #259

Copy link
Copy link
@jaraco

Description

@jaraco
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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestNew feature or request
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.