question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSONSchema/JSONRPCServer/APISChema issues

See original GitHub issue

Okay, 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
  • 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:closed
  • Created a year ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Sep 2, 2022

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.

0reactions
Pirulaxcommented, Sep 26, 2022

Well done, huge kudos! Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON-RPC schema specification? - Stack Overflow
I'm certain I could write some sort of code generator using this specification. It is too big to paste here. My question is,...
Read more >
jsonrpc - Go Packages
Package jsonrpc implements use case transport for JSON-RPC 2.0 on top of HTTP. ... Title = "JSON-RPC Example" apiSchema.Reflector().
Read more >
JSON schema - apischema
JSON schema can be generated from data model. However, because of all possible customizations, the schema can differ between deserilialization and serialization ...
Read more >
JavaScript packages index - Page 1574 | Snyk Advisor - Snyk
JavaScript Packages Index, security: no known security issues ... json-rules-engine · json-rules-engine-schema-operator · json-rules-engine-simplified ...
Read more >
apischema - PyPI
apischema. JSON (de)serialization, GraphQL and JSON schema generation using Python typing. apischema makes your life easier when dealing with API data.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found