Skip to content

Proposed migration to django-modern-rpc v2.1.0#4451

Draft
atodorov wants to merge 1 commit into
dependabot/pip/django-modern-rpc-2.1.0from
migrate-django-modern-rpc-v2
Draft

Proposed migration to django-modern-rpc v2.1.0#4451
atodorov wants to merge 1 commit into
dependabot/pip/django-modern-rpc-2.1.0from
migrate-django-modern-rpc-v2

Conversation

@atodorov

Copy link
Copy Markdown
Member

Proposed changes for django-modern-rpc v1.x → v2.1.0

This PR shows the changes needed to make Kiwi TCMS compatible with
django-modern-rpc v2.1.0 (from PR #4378).

This is a DRAFT proposal. The library has NOT been upgraded yet
in requirements/base.txt — that is done in the dependabot branch.

What changed in the library

django-modern-rpc v2.0+ is a complete architecture redesign:

v1.x (current) v2.x (proposed)
RPCEntryPoint.as_view() RpcServer.view
@rpc_method(name="X.Y") @server.register_procedure(name="X.Y")
kwargs.get(REQUEST_KEY) context_target="_ctx" + _ctx.request
@http_basic_auth_login_required auth=http_basic_auth_login_predicate
set_authentication_predicate() auth=permissions_required(...)
Handler dumps_result() Handler build_success_result()
MODERNRPC_METHODS_MODULES removed (procedures registered directly)

Files changed

  • New: tcms/rpc/servers.py — Two RpcServer instances (XML-RPC + JSON-RPC)
  • Modified:
    • tcms/handlers.py — Rewritten for new RpcHandler base class
    • tcms/urls.py — RPCEntryPoint → server.view
    • tcms/rpc/decorators.py — New v2 auth predicate factories
    • tcms/settings/common.py — Removed MODERNRPC_METHODS_MODULES
    • All 26 RPC API files — Procedure registration, auth, and context access patterns
    • tcms/bugs/api.py — Same patterns
    • tcms/telemetry/api.py — Same patterns

What's NOT done yet

  • Test file updates (tcms/tests/test_handlers.py) — kept unchanged per request
  • kiwi_lint/ AST check updates — the old decorator names won't match anymore
  • Actual requirements upgrade — that's in the base branch

Migration guide

https://django-modern-rpc.readthedocs.io/latest/misc/migration_guide.html

Notes for review

  1. Two-server approach: using separate RpcServer instances preserves the distinct /xml-rpc/ and /json-rpc/ URL endpoints
  2. The permissions_required() factory returns a predicate that both authenticates AND checks Django permissions — same behavior as before
  3. HTML escaping and timedelta conversion still happens via build_success_result()
  4. Functions without request context don't need context_target or the _ctx parameter

deepsource-autofix Bot added a commit that referenced this pull request Jul 15, 2026
This commit fixes the style issues introduced in ff2d769 according to the output
from Black.

Details: #4451
@atodorov
atodorov force-pushed the migrate-django-modern-rpc-v2 branch from 0663b08 to 4ed0291 Compare July 15, 2026 11:12
deepsource-autofix Bot added a commit that referenced this pull request Jul 15, 2026
This commit fixes the style issues introduced in 3a5097b according to the output
from Black.

Details: #4451
@atodorov
atodorov force-pushed the migrate-django-modern-rpc-v2 branch from a5444d9 to c7681b4 Compare July 15, 2026 11:13
deepsource-autofix Bot added a commit that referenced this pull request Jul 15, 2026
This commit fixes the style issues introduced in 032b847 according to the output
from Black.

Details: #4451
@atodorov
atodorov force-pushed the migrate-django-modern-rpc-v2 branch 8 times, most recently from a830c06 to 2f12a1b Compare July 15, 2026 11:51
deepsource-autofix Bot added a commit that referenced this pull request Jul 15, 2026
This commit fixes the style issues introduced in 2f12a1b according to the output
from Black.

Details: #4451
@atodorov
atodorov force-pushed the migrate-django-modern-rpc-v2 branch 6 times, most recently from 01c778e to ab6f4e8 Compare July 15, 2026 12:05
@dependabot
dependabot Bot force-pushed the dependabot/pip/django-modern-rpc-2.1.0 branch from ebefdce to 61183ad Compare July 15, 2026 14:57
@atodorov
atodorov force-pushed the migrate-django-modern-rpc-v2 branch 4 times, most recently from fda8bf8 to 14458be Compare July 15, 2026 15:50
deepsource-autofix Bot added a commit that referenced this pull request Jul 15, 2026
This commit fixes the style issues introduced in 14458be according to the output
from Black.

Details: #4451
@atodorov
atodorov force-pushed the migrate-django-modern-rpc-v2 branch from b2d288c to bb9c8f2 Compare July 15, 2026 16:01
deepsource-autofix Bot added a commit that referenced this pull request Jul 15, 2026
This commit fixes the style issues introduced in bb9c8f2 according to the output
from Black.

Details: #4451
@atodorov
atodorov force-pushed the migrate-django-modern-rpc-v2 branch from e80b481 to 821e82a Compare July 15, 2026 16:01
deepsource-autofix Bot added a commit that referenced this pull request Jul 15, 2026
This commit fixes the style issues introduced in 821e82a according to the output
from Black.

Details: #4451
@atodorov
atodorov force-pushed the migrate-django-modern-rpc-v2 branch 19 times, most recently from ece9447 to 6832163 Compare July 15, 2026 17:59
deepsource-autofix Bot added a commit that referenced this pull request Jul 15, 2026
This commit fixes the style issues introduced in 6832163 according to the output
from Black.

Details: #4451
atodorov pushed a commit that referenced this pull request Jul 15, 2026
This commit fixes the style issues introduced in 6832163 according to the output
from Black.

Details: #4451
@atodorov
atodorov force-pushed the migrate-django-modern-rpc-v2 branch 4 times, most recently from cb786af to c636371 Compare July 16, 2026 09:05
deepsource-autofix Bot added a commit that referenced this pull request Jul 16, 2026
This commit fixes the style issues introduced in 0da7bed according to the output
from Black.

Details: #4451
- refactor the @rpc_method decorator and how API methods are
  registered
- adjust how authentication and permissions are checked to account
  for the new version of the library
- update custom linters in kiwi_lint/ to account for new decorators structure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant