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.
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from pyls_jsonrpc.manager import JSONRPC2Protocol
Basic JSON RPC 2.0 server that reads from stdin and writes to stdout, handling a 'hello' method.
import asyncio
from jsonrpc.server import JSONRPC2Server
from jsonrpc.manager import JSONRPC2Protocol
async def handle_request(protocol, data):
request = protocol.parse_request(data)
if request.method == "hello":
response = protocol.create_response(request, "world")
return response.serialize()
else:
error = protocol.create_error_response(request, -32601, "Method not found")
return error.serialize()
server = JSONRPC2Server(handle_request)
asyncio.run(server.run())
print("Server running on stdin/stdout")
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.
Agent activity
0 hits · last 30 days
No traffic data recorded yet.