Skip to content

Load schemas via importlib.resources instead of pkgutil #871

@sevein

Description

@sevein

Producing binaries that embed Python applications that import jsonschema is challenging because pkgutil.get_data relies on __file__ which may not be always defined, e.g. see these issues in PyOxidizer.

https://github.com/Julian/jsonschema/blob/272b4f24437d9cba1127058dc3479f9bc6d8c4b9/jsonschema/_utils.py#L49-L55

I was wondering if this project would be interested in having a fallback implemented that is capable to load the schema files using importlib.resources instead, which was added in Python 3.7. See https://stackoverflow.com/a/20885799 for more details. The creator of PyOxidizer, Gregory Szorc, shares some good details on loading resource files using PyOxidizer here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementSome new desired functionalityHelp WantedAn enhancement or bug for which a pull request is welcomed and which should have a clear definition.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions