Skip to content

6.0.0rc1

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 06 Nov 02:57
· 10 commits to main since this release
4e7da80

The first release candidate of 6.0. pip install --pre jsonrpcserver installs
it. pip install jsonrpcserver keeps installing 5.x until 6.0.0.
Migration
lists what changes, and #320
tracks the release. 5.x gets fixes on the release/5.x branch.

Added

  • max_concurrency on async_dispatch and the other async dispatch functions:
    the most requests of a batch that run at once. The default, None, runs them
    all at once, as before.

Changed

  • jsonrpcserver no longer uses oslash. Success returns a SuccessResult,
    and Error and InvalidParams return an ErrorResult. Both are frozen
    dataclasses, and Result is SuccessResult | ErrorResult. Code that only
    returns Success(...) or Error(...) from methods and calls dispatch
    keeps working.

  • dispatch_to_response gives SuccessResponse and ErrorResponse objects,
    frozen dataclasses with the response's fields. 5.x wrapped them in oslash's
    Right and Left, read through _value and _error. Check
    isinstance(response, ErrorResponse) instead.

  • Removed InvalidResultError, validate_result and log_invalid_result from
    jsonrpcserver.dispatcher. Without the oslash wrappers there's no invalid
    Result: a method's return value is its result.

  • The default validator checks the JSON-RPC 2.0 rules itself instead of using
    jsonschema. It accepts and rejects the same requests, which a test checks on
    500 generated requests and a list of edge cases. Dispatching a small method
    takes about 9.6 microseconds instead of 43 (Python 3.13). Its error is
    jsonrpcserver.validator.InvalidRequestError, with a message that says what's
    wrong. The client still gets the same -32600 response.

  • Batches are limited to 100 requests by default (max_batch_size). A bigger
    batch gets one -32600 error, and none of it runs. Pass max_batch_size=None
    for no limit, as in 5.x.

  • The default deserializer rejects NaN, Infinity, -Infinity and numbers
    too big for a float, with a -32700 Parse error. They aren't valid JSON.
    deserializer=json.loads accepts them, as in 5.x. dispatch_to_response
    now uses the same default as the other dispatch functions.

  • Error and JsonRpcError raise TypeError for a code that isn't an int or
    a message that isn't a str. @method raises ValueError for a name starting
    with rpc.. 5.0.10 warned about both.

  • serve() listens on localhost unless you pass a host. 5.x listened on every
    network interface by default. serve("", port) does that now.

  • The sync and async dispatch functions take the same options with the same
    defaults. A test keeps them that way.

Removed

  • serialize_error, serialize_success and to_serializable_one in
    jsonrpcserver.response (and to_serializable_one in jsonrpcserver.main),
    deprecated in 5.0.10. Use to_error_dict, to_success_dict and to_dict.
  • ResponseType. Use Response.
  • The jsonschema dependency, and jsonrpcserver/request-schema.json. 6.0 has no
    runtime dependencies.
  • The oslash dependency, and with it the mypy setting typing.md asked for.
  • Python 3.8, 3.9 and 3.10, which have reached end of life. 6.0 needs Python
    3.11 or later. Older Pythons keep installing 5.x.