Skip to content

feat(python-sdk): Complete TypeScript Parity, Enterprise Security, Background Tasks & Dev Tooling#4

Open
Gautam-7-7 wants to merge 7 commits into
nitrocloudofficial:mainfrom
Gautam-7-7:release/v0.3.2-full-parity
Open

feat(python-sdk): Complete TypeScript Parity, Enterprise Security, Background Tasks & Dev Tooling#4
Gautam-7-7 wants to merge 7 commits into
nitrocloudofficial:mainfrom
Gautam-7-7:release/v0.3.2-full-parity

Conversation

@Gautam-7-7

Copy link
Copy Markdown
Collaborator

This Pull Request achieves complete behavioral, architectural, and API parity between the NitroStack Python SDK and the reference TypeScript SDK

Core Capabilities & Subsystems Included

  1. Dependency Injection & Modules :

    • Auto-resolves constructor dependencies via runtime type annotations (inspect.signature + get_type_hints).
    • Thread-safe singleton instantiation using threading.RLock.
    • Circular dependency detection raising CircularDependencyError.
  2. MCP Primitives & Programmatic Builders :

    • Automatic function docstring parsing for @tool and @prompt description fallback.
    • Native Pydantic v2 validation error translation to structured MCP JSON-RPC protocol error blocks.
    • Programmatic builders (build_tool, build_tools, build_resources, build_prompts, build_controller).
  3. Execution Pipeline & Security :

    • Guard, Middleware, Interceptor, Pipe, and Exception Filter execution chain with full context propagation.
    • Standard cryptographic token handling via PyJWT and asynchronous OAuth 2.1 token introspection using httpx.AsyncClient.
    • Built-in SecretValue wrapper, PKCE verification, MemoryTokenStore/FileTokenStore, and setup_jwt_auth helper utilities.
  4. Background Tasks & Concurrency (nitrostack.core.task):

    • TaskRegistry backed by native asyncio.Task references supporting .cancel() and asyncio.CancelledError.
    • TaskContext exposing abort_signal / abortController and status lifecycle transitions.
    • Automatic execution of synchronous tool functions in worker thread pools via asyncio.to_thread.
  5. UI Widgets & Next.js Asset Inlining (nitrostack.ui_next):

    • Static HTML compilation and CSS/JS asset inlining (compile_next_widget) for serving Next.js widgets without Node.js production runtime dependencies.
  6. CLI Scaffolding & Pytest Plugin (nitrostack.cli & nitrostack.testing):

    • CLI support for --file hot reloading, Claude Desktop registration, and Cursor config integration (nitrostack-py cursor).
    • Packaged pytest plugin fixture (nitro_client) registered via pytest11 entrypoint.

Verification & Automated Tests

  • 35/35 pytest unit and integration tests passing (35 passed in 4.72s):
    • tests/test_decorators.py
    • tests/test_di.py
    • tests/test_gaps_resolved.py
    • tests/test_jwt_security.py
    • tests/test_next_widget_compilation.py
    • tests/test_oauth.py
    • tests/test_pipeline_gaps.py
    • tests/test_production.py
    • tests/test_pytest_fixture.py
    • tests/test_sync_tools.py
    • tests/test_task_cancellation_real.py
    • tests/test_tasks.py
    • tests/test_testing_module.py

Backward Compatibility

  • Zero breaking changes to existing public decorators (@tool, @resource, @prompt).
  • Exported backward-compatible import aliases: JwtModule, OauthModule, APIKeyModule.

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