Skip to content
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

The probeinterface.testing module loads probe.json.schema, which doesn’t ship with the wheel #321

Closed
musicinmybrain opened this issue Feb 6, 2025 · 2 comments · Fixed by #326

Comments

@musicinmybrain
Copy link
Contributor

The new module probeinterface.testing, which ships as part of the probeinterface wheel, loads probe.json.schema at import time, but this only works using relative paths in a git checkout; probe.json.schema doesn’t ship in the wheel at all.

Separately, probeinterface.testing imports jsonschema, which isn’t a regular dependency, only a test extra dependency. I guess that’s “more OK:”

$ python3 -m venv _e
$ . _e/bin/activate
(_e) $ pip install probeinterface
$ python3 -c 'import probeinterface.testing'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import probeinterface.testing
  File "/home/ben/tmp/_e/lib64/python3.13/site-packages/probeinterface/testing.py", line 5, in <module>
    import jsonschema
ModuleNotFoundError: No module named 'jsonschema'
(_e) $ pip install probeinterface[test]
(_e) $ $ python3 -c 'import probeinterface.testing'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import probeinterface.testing
  File "/home/ben/tmp/_e/lib64/python3.13/site-packages/probeinterface/testing.py", line 8, in <module>
    schema = json.load(open(json_schema_file, "r"))
                       ~~~~^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/ben/tmp/_e/lib64/python3.13/resources/probe.json.schema'

I’m not quite sure what would make this “nicer” in the most straighforward way. If it’s feasible to move probeinterface.testing back out of probeinterface and into tests/, that would probably be best. Where it is, it looks like a public API, and that really doesn’t seem to be the intent.

@alejoe91
Copy link
Member

alejoe91 commented Feb 7, 2025

Hi @musicinmybrain

I think we can ship the json.schema with the package and extend the test installation to add jsonschema without moving anything. How does that sound?

@musicinmybrain
Copy link
Contributor Author

Hi @musicinmybrain

I think we can ship the json.schema with the package and extend the test installation to add jsonschema without moving anything. How does that sound?

Sure, that seems like a reasonable idea too. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants