MCPcopy Index your code
hub / github.com/alorence/django-modern-rpc

github.com/alorence/django-modern-rpc @2.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.1.0 ↗ · + Follow
679 symbols 2,386 edges 59 files 172 documented · 25%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

django-modern-rpc

Tests Documentation Status Downloads Link to demo

Embed an XML-RPC / JSON-RPC server in your Django project!

Main features

  • XML-RPC and JSON-RPC 2.0 support (JSON-RPC 1.0 is NOT supported)
  • Custom authentication process
  • Custom error handling
  • Sync and async procedures
  • Multiple servers
  • Customizable XML / JSON backends with builtin support for orjson, ujson, rapidjson, lxml, etree, etc.

Requirements

The following Django / Python versions are supported, according to Django Installation FAQ

Python ➞ 3.10 3.11 3.12 3.13 3.14
Django 4.2 🟢 🟢 🟢 🔴 🔴
Django 5.0 🟢 🟢 🟢 🔴 🔴
Django 5.1 🟢 🟢 🟢 🟢 🔴
Django 5.2 🟢 🟢 🟢 🟢 🟢
Django 6.0 🔴 🔴 🟢 🟢 🟢

To enforce security, defusedxml will be installed as a dependency.

Quickstart

Install django-modern-rpc in your environment

pip install django-modern-rpc

Create an RpcServer instance and register your first procedure, in myapp/rpc.py

from modernrpc.server import RpcServer

server = RpcServer()

@server.register_procedure
def add(a: int, b: int) -> int:
    """Add two numbers and return the result.

    :param a: First number
    :param b: Second number
    :return: Sum of a and b
    """
    return a + b

Configure a path to allow RPC clients calling your procedures, in urls.py

from django.urls import path
from myapp.rpc import server

urlpatterns = [
    # ... other url patterns
    path('rpc/', server.view),  # Synchronous view
    # Alternatively, you can use the asynchronous view:
    # path('rpc/', server.async_view),
]

The server's view is already configured with CSRF exemption and POST-only restrictions.

Code quality

The project uses nox as a task runner to launch tests suite against all supported Python / Django combinations and generate a coverage report file. Ruff is used to lint and format the codebase, and mypy is used to perform type checking.

All these tools are automatically run in various GitHub Actions workflows, and external tools are used to perform static code analysis and collect coverage results.

SonarQube

Sonar Coverage Sonar Quality Gate Sonar Tech Debt Sonar Violations

Codacy

Codacy Coverage Codacy Grade

Coveralls

Coveralls

Core symbols most depended-on inside this repo

loads
called by 38
modernrpc/xmlrpc/backends/lxml.py
view
called by 33
modernrpc/server.py
async_view
called by 33
modernrpc/server.py
dumps
called by 26
modernrpc/xmlrpc/backends/lxml.py
extract_xmlrpc_fault_data
called by 16
tests/helpers.py
on_error
called by 16
modernrpc/server.py
check_permissions
called by 15
modernrpc/core.py
extract_jsonrpc_fault_data
called by 14
tests/helpers.py

Shape

Method 476
Class 109
Function 90
Route 4

Languages

Python100%

Modules by API surface

tests/test_proc_wrapper.py100 symbols
modernrpc/xmlrpc/backends/xmltodict.py36 symbols
modernrpc/xmlrpc/backends/marshalling.py34 symbols
tests/backends/test_xmlrpc.py31 symbols
tests/test_server_namespace.py27 symbols
tests/test_docstring_parser.py24 symbols
noxfile.py22 symbols
modernrpc/core.py22 symbols
tests/test_auth_helpers.py19 symbols
tests/backends/test_jsonrpc.py19 symbols
modernrpc/exceptions.py18 symbols
tests/views/test_jsonrpc_sync.py17 symbols

For agents

$ claude mcp add django-modern-rpc \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact