Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 6.0.0 #255

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
0f1fd29
Replace Oslash with Returns
bcb May 14, 2022
c1426f6
Fix github action
bcb May 14, 2022
d806553
Fix github action
bcb May 14, 2022
0ede79e
Add comment to docs
bcb May 17, 2022
9451357
Merge branch 'use-returns' into prepare-v6
bcb May 18, 2022
a854670
Prepare version 6.0.0
bcb May 18, 2022
e9c2da2
Merge branch 'main' into prepare-v6
bcb May 19, 2022
8808a43
Adjust docstring
bcb May 20, 2022
03f80d0
Remove errant comma
bcb May 24, 2022
173bbca
Merge branch 'main' into release/6.0.0
bcb Sep 21, 2022
609b990
Adjust github workflow
bcb Sep 21, 2022
bae441c
Upgrade mypy in github workflow
bcb Sep 21, 2022
866a4e2
Enable all Pylint errors
bcb Oct 10, 2022
e74da97
Merge branch 'main' into release/6.0.0
bcb Oct 10, 2022
f6294ee
Fix not re-exported error
bcb Oct 10, 2022
ab30150
Upgrade pylint
bcb Nov 9, 2022
4f510b1
Pylint fixes
bcb Nov 9, 2022
73ba6a3
Update changelog
bcb Nov 9, 2022
0e67522
Fix some tests
bcb Nov 16, 2022
f4e8761
Fix parameters
bcb Feb 26, 2023
558215b
Fixes to satisfy ruff
bcb Feb 26, 2023
0a88d8f
Replace pylint with ruff
bcb Mar 3, 2023
65f798c
Adjustments to satisfy ruff and mypy
bcb Mar 3, 2023
843fdcd
Fix a repr
bcb May 10, 2023
ae90cdf
Use ruff in github actions
bcb May 10, 2023
6db0f90
Fix type error
bcb May 10, 2023
e7287b5
Upgrade ruff
bcb May 10, 2023
75cee0e
Replace setup.py with pyproject.toml
bcb May 24, 2023
9a1fe9f
Always stop the server when exiting serve()
bcb May 31, 2023
ffe8374
Replace black and isort with ruff (#278)
bcb Jul 29, 2024
be34675
Move documentation to Github wiki (#280)
bcb Jul 31, 2024
389959d
Update readme (#281)
bcb Jul 31, 2024
8c23c46
Replace readthedocs with mkdocs (#282)
bcb Aug 16, 2024
1d9153e
Remove pylint pragmas (#283)
bcb Aug 17, 2024
6efc172
Move request-schema.json to a .py file (#284)
bcb Aug 28, 2024
5c745ce
Add jsonschema dependency
bcb Nov 14, 2024
c2b807e
Add license badge
bcb Mar 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
with:
python-version: 3.8
- run: pip install --upgrade pip
- run: pip install types-setuptools "black<23" "pylint<3" "mypy<1" "jsonschema<5" pytest "oslash<1" "aiohttp<4" "aiozmq<1" "django<5" "fastapi<1" "flask<3" "flask-socketio<5.3.1" "pyzmq" "sanic" "tornado<7" "uvicorn<1" "websockets<11"
- run: black --diff --check $(git ls-files -- '*.py' ':!:docs/*')
- run: pylint $(git ls-files -- '*.py' ':!:docs/*')
- run: pip install types-setuptools "black<23" ruff "mypy<2" "jsonschema<5" pytest "returns<1" "aiohttp<4" "aiozmq<1" "django<5" "fastapi<1" "flask<3" "flask-socketio<5.3.1" "pyzmq" "sanic" "tornado<7" "uvicorn<1" "websockets<11"
- run: ruff check --select I $(git ls-files -- '*.py' ':!:docs/*')
- run: ruff format --check $(git ls-files -- '*.py' ':!:docs/*')
- run: mypy --strict $(git ls-files -- '*.py' ':!:docs/*')
36 changes: 11 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,24 @@ default_language_version:
exclude: (^docs)
fail_fast: true
repos:
- repo: https://github.com/ambv/black
rev: 22.8.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.1
hooks:
- id: black
args: [--diff, --check]

- repo: https://github.com/PyCQA/pylint
rev: v2.15.3
hooks:
- id: pylint
additional_dependencies:
- oslash<1
- aiohttp<4
- aiozmq<1
- django<5
- fastapi<1
- flask<3
- flask-socketio<5.3.1
- jsonschema<5
- pytest
- pyzmq
- sanic
- tornado<7
- uvicorn<1
- websockets<11
- id: ruff
name: lint with ruff
- id: ruff
name: sort imports with ruff
args: [--select, I, --fix]
- id: ruff-format
name: format with ruff

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971
rev: v1.2.0
hooks:
- id: mypy
args: [--strict]
additional_dependencies:
- returns<1
- aiohttp<4
- aiozmq<1
- django<5
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# jsonrpcserver Change Log

## 6.0.0 (May 18, 2022)

A small release but incrementing the major release number due to a breaking
change for async use.

Breaking changes:

- Async methods should be decorated with `@async_method` instead of `@method`. The
reason is due to the _type_ of the decorated function - async functions have a
different type to other functions (`Awaitable`).

Other changes:

- Replaced the Oslash dependency with [Returns](https://github.com/dry-python/returns).
Oslash is not meant for production use, and doesn't work in Python 3.12.
- Use `Ok` instead of `Success` when returning a response. This is to avoid confusion
with the Returns library's `Success` class. It also matches Jsonrpcclient's `Ok` type.
This is not a breaking change, `Success` will still work for now.
- Docs moved to https://github.com/explodinglabs/jsonrpcserver/wiki

## 5.0.9 (Sep 15, 2022)

- Remove unncessary `package_data` from setup.py (#243)
Expand Down
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<img
alt="jsonrpcserver"
style="margin: 0 auto;"
src="https://github.com/explodinglabs/jsonrpcserver/blob/main/docs/logo.png?raw=true"
src="https://github.com/explodinglabs/jsonrpcserver/blob/main/logo.png?raw=true"
/>

![PyPI](https://img.shields.io/pypi/v/jsonrpcserver.svg)
![Code Quality](https://github.com/explodinglabs/jsonrpcserver/actions/workflows/code-quality.yml/badge.svg)
![Coverage Status](https://coveralls.io/repos/github/explodinglabs/jsonrpcserver/badge.svg?branch=main)
![Downloads](https://img.shields.io/pypi/dw/jsonrpcserver)
![License](https://img.shields.io/pypi/l/jsonrpcserver.svg)

Process incoming JSON-RPC requests in Python.

Expand All @@ -16,24 +17,18 @@ pip install jsonrpcserver
```

```python
from jsonrpcserver import method, serve, Success
from jsonrpcserver import method, Result, Ok

@method
def ping():
return Success("pong")
def ping() -> Result:
return Ok("pong")

if __name__ == "__main__":
serve()
```

Or use `dispatch` instead of `serve`:
```python
response = dispatch('{"jsonrpc": "2.0", "method": "ping", "id": 1}')
# => '{"jsonrpc": "2.0", "result": "pong", "id": 1}'
```

[Watch a video on how to use it.](https://www.youtube.com/watch?v=3_BMmgJaFHQ)

Full documentation is at [jsonrpcserver.com](https://www.jsonrpcserver.com/).
Full documentation is in the [wiki](https://github.com/explodinglabs/jsonrpcserver/wiki).

See also: [jsonrpcclient](https://github.com/explodinglabs/jsonrpcclient)
177 changes: 0 additions & 177 deletions docs/Makefile

This file was deleted.

8 changes: 3 additions & 5 deletions docs/async.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Async

Async dispatch is supported.

```python
from jsonrpcserver import method, Success, async_dispatch
from jsonrpcserver import async_dispatch, async_method, Ok, Result

@method
@async_method
async def ping() -> Result:
return Success("pong")
return Ok("pong")

await async_dispatch('{"jsonrpc": "2.0", "method": "ping", "id": 1}')
```
Expand Down
61 changes: 0 additions & 61 deletions docs/conf.py

This file was deleted.

Loading
Loading