indygreg / indygreg/PyOxidizer

Pyoxidizer doesn't work for `jsonschema_specifications`

Open
#749 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

The issue here is that the jsonschema_specifications._core._schemas() function does:

from importlib.resources import files

for version in files(__package__).joinpath("schemas").iterdir():

and then it will not really find anything to register.

Printing the return of the files(...) it gives:

<importlib._adapters.DegenerateFiles.Path object at 0x0000015E5D83A9B0>

I added

if "jsonschema_specifications" in resource.name:
    resource.add_location = "filesystem-relative:lib"
    resource.add_source = True

So, those resources even have a __file__, but still, importlib.resources.files(...) doesn't work as intended.

This was also reported at: https://github.com/python-jsonschema/jsonschema-specifications/issues/61, but unfortunately the library can't be changed to accommodate a different API.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure when packaging jsonschema_specifications with PyOxidizer, starting from jsonschema_specifications._core._schemas() and its importlib.resources.files(...).joinpath("schemas").iterdir() call. Inspect how resource.add_location and resource.add_source affect these resources; done when the packaged application discovers and registers the schemas correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.