Skip to content

Document what are resources in importlib.resources #88330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
FFY00 opened this issue May 18, 2021 · 2 comments · Fixed by #99801
Closed

Document what are resources in importlib.resources #88330

FFY00 opened this issue May 18, 2021 · 2 comments · Fixed by #99801
Labels
3.11 only security fixes docs Documentation in the Doc dir topic-importlib

Comments

@FFY00
Copy link
Member

FFY00 commented May 18, 2021

BPO 44164
Nosy @jaraco, @FFY00
PRs
  • bpo-44164: document the semantic value of module resources #26280
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-05-18.00:05:54.175>
    labels = ['3.11', 'docs']
    title = 'Document what are resources in importlib.resources'
    updated_at = <Date 2021-05-23.18:56:35.435>
    user = 'https://github.com/FFY00'

    bugs.python.org fields:

    activity = <Date 2021-05-23.18:56:35.435>
    actor = 'jaraco'
    assignee = 'docs@python'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation']
    creation = <Date 2021-05-18.00:05:54.175>
    creator = 'FFY00'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44164
    keywords = ['patch']
    message_count = 2.0
    messages = ['393849', '394218']
    nosy_count = 3.0
    nosy_names = ['jaraco', 'docs@python', 'FFY00']
    pr_nums = ['26280']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue44164'
    versions = ['Python 3.11']

    Linked PRs

    @FFY00
    Copy link
    Member Author

    FFY00 commented May 18, 2021

    It would be good to explain what constitutes a resource in the importlib.resources documentation.

    As per the current implementation, they should be defined as arbitrary files contained in the package. Is this correct?

    @FFY00 FFY00 added the 3.11 only security fixes label May 18, 2021
    @FFY00 FFY00 added docs Documentation in the Doc dir 3.11 only security fixes labels May 18, 2021
    @FFY00 FFY00 added the docs Documentation in the Doc dir label May 18, 2021
    @jaraco
    Copy link
    Member

    jaraco commented May 23, 2021

    I've not previously seen a definition of resources. The original implementation of importlib_resources excluded 'directories' as resources and excluded support for resources being in subdirectories (only files in packages were allowed). Now resources can be found in subdirectories that are not packages and in namesepace packages. I'd describe resources thus:

    "Resources" are file-like resources associated with a module[1] or package in Python. The resources may be contained directly in a package or within a subdirectory contained in that package. Resources may be text or binary. As a result, Python module sources (.py) of a package and compilation artifacts (pycache) are technically de-facto resources of that package. In practice, however, resources are primarily those non-Python artifacts exposed specifically by the package author.

    [1] Resources associated with top-level modules are not yet supported by importlib[._]resources (python/importlib_resources#203) but were supported by pkg_resources.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes docs Documentation in the Doc dir topic-importlib
    Projects
    None yet
    Development

    Successfully merging a pull request may close this issue.

    3 participants