Skip to content

Jupyter support#7

Open
DevTGHa wants to merge 4 commits intodevfrom
jupyter-support
Open

Jupyter support#7
DevTGHa wants to merge 4 commits intodevfrom
jupyter-support

Conversation

@DevTGHa
Copy link
Collaborator

@DevTGHa DevTGHa commented Mar 18, 2026

Jupyter support

Summary

update the function definition when same function is registered.

when user use jupyter notbook, it is exected to register same function
with different definition multiple times.

update the function to reflect the change and give an warning.

Summary by CodeRabbit

  • New Features

    • Automatic module registration on first execution call, eliminating manual upfront declaration requirements.
    • Added Test PyPI publishing workflow for automated test releases.
  • Documentation

    • Updated usage examples with revised import patterns and module registration behavior.
  • Chores

    • Version bumped to 1.3.0.
    • Added Python 3.12 and 3.13 support.
    • Enhanced CI/CD workflows with expanded branch triggers and upgraded action versions.

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 09543473-7038-460b-8031-0252e796fb00

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The PR introduces lazy module registration for D3Session and D3AsyncSession, renames d3_api_plugin/d3_api_aplugin functions to d3_api_execute/d3_api_aexecute, changes context_modules type from list[str] to set[str], expands Python test coverage to 3.12 and 3.13, and adds a Test PyPI publish workflow.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
.github/workflows/ci.yml, .github/workflows/test-publish.yml
Expanded CI matrix to Python 3.11, 3.12, 3.13; added dev branch triggers and fail-fast: false; upgraded checkout and setup-uv actions. Added new workflow to publish to Test PyPI with automatic version suffix injection.
Version & Release
pyproject.toml, CHANGELOG.md
Bumped version 1.2.1 → 1.3.0. Added changelog entry documenting lazy module registration, API renames, and context_modules type change from list[str] to set[str].
Core API Refactoring
src/designer_plugin/api.py
Renamed d3_api_plugin → d3_api_execute and d3_api_aplugin → d3_api_aexecute; no signature or behavior changes.
Session & Client Integration
src/designer_plugin/d3sdk/session.py, src/designer_plugin/d3sdk/client.py
Updated to use renamed API functions; implemented lazy module registration with registered_modules tracking; changed context_modules parameter type from list[str] to set[str]; added automatic module registration in execute() methods when payload references a module.
Function Registration
src/designer_plugin/d3sdk/function.py
Added logging and runtime replacement handling in D3Function.init to detect and update duplicate function registrations by identity.
Documentation
README.md
Replaced TYPE_CHECKING stub imports with direct pystub imports; updated module registration examples to reflect lazy registration semantics (registration on first execute call); clarified pystub provides only type hints with no implementations.
Test Coverage
tests/test_client.py, tests/test_session.py
Updated client tests to patch d3_api_execute instead of d3_api_plugin. Added comprehensive test suite validating lazy registration behavior for both sync and async sessions, including context-manager pre-registration and duplicate-prevention logic.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant D3Session
    participant RegisteredModules as registered_modules<br/>(Session State)
    participant API as d3_api_execute
    participant Remote as Remote Designer

    Client->>D3Session: execute(payload with moduleName="mymodule")
    
    D3Session->>RegisteredModules: Check if "mymodule" in registered_modules
    alt Module not registered
        RegisteredModules-->>D3Session: false
        D3Session->>D3Session: register_module("mymodule")
        D3Session->>API: register_module("mymodule")
        API->>Remote: Send registration request
        Remote-->>API: Ack
        D3Session->>RegisteredModules: Add "mymodule"
    else Module already registered
        RegisteredModules-->>D3Session: true
        Note over D3Session: Skip registration
    end
    
    D3Session->>API: execute(payload)
    API->>Remote: Send execution payload
    Remote-->>API: Response
    API-->>Client: Return result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Add d3sdk #4: Directly related as this PR updates the same d3sdk API/session/client functions, implementing lazy module registration and refactoring d3_api_plugin/d3_api_aplugin function names.
  • Add new pystub proxy support #5: Performs identical API renames (d3_api_plugin→d3_api_execute and d3_api_aplugin→d3_api_aexecute) with overlapping client/session/test updates.

Suggested labels

enhancement

Suggested reviewers

  • nathan-disguise
  • RobinSpooner
  • AndreaLoriedoDisguise
  • twhittock-disguise

Poem

🐰 Modules now register on first call,
No upfront declarations at all,
Renamed functions shine so bright,
From plugin to execute—feels right!
Type safety grows with sets so tall,
While lazy loading conquers all.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 61.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Jupyter support' is vague and generic; while the PR description confirms Jupyter notebook support is the objective, the title alone does not convey the specific technical changes (function re-registration, lazy module loading, API renames). Revise the title to be more descriptive, such as 'Support function re-registration for Jupyter notebooks' or 'Lazy module registration with function re-registration support', to better reflect the main technical accomplishment.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jupyter-support
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@DevTGHa DevTGHa changed the base branch from main to dev March 18, 2026 12:12
DevTGHa added 2 commits March 18, 2026 12:13
when user use jupyter notbook, it is exected to register same function
with different definition multiple times.

update the function to reflect the change and give an warning.
@DevTGHa DevTGHa self-assigned this Mar 18, 2026
@DevTGHa DevTGHa added the enhancement New feature or request label Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

1 participant