{"id":27314,"library":"python-jsonrpc-server","title":"python-jsonrpc-server","description":"A JSON RPC 2.0 server library for Python, used primarily by language servers like the Python Language Server. Current version 0.4.0, with infrequent updates. Supports concurrent request handling via futures.","status":"active","version":"0.4.0","language":"python","source_language":"en","source_url":"https://github.com/palantir/python-jsonrpc-server","tags":["json-rpc","rpc","server","jsonrpc","palantir"],"install":[{"cmd":"pip install python-jsonrpc-server","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Used for faster JSON serialization (optional on Windows)","package":"ujson","optional":true},{"reason":"Required for Python 2 compatibility","package":"future","optional":true}],"imports":[{"note":"Correct import path","wrong":null,"symbol":"JSONRPC2Protocol","correct":"from jsonrpc.manager import JSONRPC2Protocol"},{"note":"Correct import path","wrong":null,"symbol":"JSONRPC2Response","correct":"from jsonrpc.manager import JSONRPC2Response"},{"note":"Correct import path","wrong":null,"symbol":"JSONRPC2Request","correct":"from jsonrpc.manager import JSONRPC2Request"},{"note":"Correct import path","wrong":null,"symbol":"JSONRPC2Error","correct":"from jsonrpc.manager import JSONRPC2Error"},{"note":"Correct import path","wrong":null,"symbol":"JSONRPC2Server","correct":"from jsonrpc.server import JSONRPC2Server"}],"quickstart":{"code":"import asyncio\nfrom jsonrpc.server import JSONRPC2Server\nfrom jsonrpc.manager import JSONRPC2Protocol\n\nasync def handle_request(protocol, data):\n    request = protocol.parse_request(data)\n    if request.method == \"hello\":\n        response = protocol.create_response(request, \"world\")\n        return response.serialize()\n    else:\n        error = protocol.create_error_response(request, -32601, \"Method not found\")\n        return error.serialize()\n\nserver = JSONRPC2Server(handle_request)\nasyncio.run(server.run())\nprint(\"Server running on stdin/stdout\")","lang":"python","description":"Basic JSON RPC 2.0 server that reads from stdin and writes to stdout, handling a 'hello' method."},"warnings":[{"fix":"If you need the standard json module, pin to version 0.2.0 or manually monkey-patch. On Windows, install ujson with pip install ujson.","message":"In version 0.3.0, the built-in `json` module was replaced with `ujson`. This may cause compatibility issues if your code depends on custom JSON encoders/decoders or uses different JSON library features. `ujson` is not available by default on Windows; install it separately or use a workaround.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Ensure your JSON RPC messages strictly follow the spec: include 'jsonrpc':'2.0', 'method', 'id' (or null for notifications), and proper 'params'.","message":"The library's protocol expects a specific JSON RPC 2.0 format. If you send malformed requests (e.g., missing 'jsonrpc' field or invalid id), the server may hang or raise cryptic errors.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install ujson: pip install ujson. If you cannot install it, pin to version 0.2.0 or patch the code to fall back to json.","cause":"On Windows or Python installations without ujson, the library fails to import ujson.","error":"ModuleNotFoundError: No module named 'ujson'"},{"fix":"Use correct import: from jsonrpc.manager import JSONRPC2Protocol","cause":"Incorrect import path. Many users try from jsonrpc import manager or from jsonrpc.manager import ..., but the module is likely not installed or the import is misspelled.","error":"AttributeError: module 'jsonrpc' has no attribute 'manager'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}