JSONSchema/JSONRPCServer/APISChema issues
See original GitHub issueOkay, so I’m using the Solana pip package, and when websockets are used I have issues launching it after it has been compiled with Nuitka. The code works without any issues uncompiled, it hasn’t worked in Nuitka 0.9.2 either. I’ve managed to workaround the issues by patching the site-packages manually, and also adding the additional data include to the Nuitka CL options.
Steps to fix
First of all, in apischema.serialization
in both methods.py
and .pyx
get rid of the apischema.validation.errors
imports, as in, copy the content of the file directly (Don’t forget to include Sequence from typing!)
Then, jsonschema
will complain, to fix that the code that reads the schema has to be edited:
try:
with open(f"jsonschema/schemas/{name}.json") as f:
return json.load(f)
except FileNotFoundError:
# The original method here
The above should be used instead of whatever is in _utils.load_schema
Also, I get these errors without applying the above fixes
Traceback (most recent call last):
File "<redacted>/nuitka-solana-test/main.dist/main.py", line 3, in <module>
File "<redacted>/nuitka-solana-test/main.dist/solana/rpc/websocket_api.py", line 5, in <module solana.rpc.websocket_api>
File "<redacted>/nuitka-solana-test/main.dist/apischema/__init__.py", line 30, in <module apischema>
File "<redacted>/nuitka-solana-test/main.dist/apischema/json_schema/__init__.py", line 8, in <module apischema.json_schema>
File "<redacted>/nuitka-solana-test/main.dist/apischema/json_schema/schema.py", line 59, in <module apischema.json_schema.schema>
File "<redacted>/nuitka-solana-test/main.dist/apischema/serialization/__init__.py", line 34, in <module apischema.serialization>
File "apischema/serialization/methods.pyx", line 7, in init apischema.serialization.methods
ModuleNotFoundError: No module named 'apischema.serialization.errors'
-
Nuitka version, etc
1.0.2 Commercial: None Python: 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0] Flavor: Debian Python Executable: /home/pirulax/Desktop/pywp/nuitka-solana-test/.venv/bin/python OS: Linux Arch: x86_64 Distribution: Pop (based on Ubuntu) 22.04
- Directly installed into venv using pip (Although I do use poetry for managing packages otherwise)
-
The specific PyPI names and versions
- jsonschema 4.9.1
- solana 0.25.1
- jsonrpcserver 5.0.7
- apischema 0.17.5
- Repo with repro code
- Nuitka options used
source .venv/bin/activate
date
pip install nuitka # Make sure nuitka is installed
pip install ordered-set # Make sure it's installed as otherwise compilatin is slow
time python3.10 -m nuitka \
--lto=yes \
--standalone \
--include-data-file=".venv/lib/python3.10/site-packages/jsonrpcserver/request-schema.json=jsonrpcserver/request-schema.json" \
nuitka_solana_test/main.py \
Issue Analytics
- State:
- Created a year ago
- Comments:12 (8 by maintainers)
The new method, I think I have started adding support for, but got interrupted. This could push me to finish that, must some more packages switching to it over time.
Well done, huge kudos! Thanks!