Skip to content

Merge dev into main#10

Merged
DevTGHa merged 27 commits intomainfrom
dev
Mar 31, 2026
Merged

Merge dev into main#10
DevTGHa merged 27 commits intomainfrom
dev

Conversation

@DevTGHa
Copy link
Copy Markdown
Collaborator

@DevTGHa DevTGHa commented Mar 31, 2026

Merge dev into main for release

Summary

Merging dev branch for 1.3.0 release.

Summary by CodeRabbit

  • New Features

    • Lazy module registration on first execute() or rpc() call instead of requiring upfront registration.
    • Automatic import detection for decorated functions; file-level imports in Jupyter must be placed inside function bodies.
    • Function replacement support in Jupyter environments with duplicate-name warning.
  • Updates

    • API function renaming: d3_api_execute and d3_api_aexecute (replacing prior names).
    • context_modules parameter now accepts sets instead of lists.
    • Expanded Python version support to 3.12 and 3.13.
  • Documentation

    • Updated import guidance and test running instructions.

DevTGHa and others added 27 commits January 6, 2026 10:20
Co-authored-by: Chris Nash <chris.nash@disguise.one>
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.
Detect the used python package and add it when register the python automatically
add tag on release

restrict action to main
@DevTGHa DevTGHa self-assigned this Mar 31, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

This PR implements lazy module registration for D3 sessions with automatic import detection. It renames Designer API execution functions (d3_api_plugind3_api_execute, d3_api_aplugind3_api_aexecute), introduces import metadata models, adds module support classification, and updates session initialization to use sets for tracking registered modules.

Changes

Cohort / File(s) Summary
CI/CD Workflows
.github/workflows/ci.yml, .github/workflows/release.yml, .github/workflows/test-publish.yml
Updated CI matrix to test Python 3.11, 3.12, 3.13; upgraded action versions. Added new release.yml workflow for manual PyPI publishing with version/tag verification. Added test-publish.yml workflow for Test PyPI releases with dynamic versioning.
Documentation
README.md, CHANGELOG.md, CONTRIBUTING.md
Updated README to remove TYPE_CHECKING import pattern, clarify pystub usage, document lazy auto-registration on first execute() call, and note Jupyter import limitations. Added v1.3.0 changelog entry detailing new features. Updated test command examples in contributing guide.
API Function Renames
src/designer_plugin/api.py, src/designer_plugin/d3sdk/client.py, src/designer_plugin/d3sdk/session.py
Renamed sync/async execution functions: d3_api_plugind3_api_execute, d3_api_aplugind3_api_aexecute. Updated all call sites and imports across client and session modules.
Import Detection System
src/designer_plugin/d3sdk/ast_utils.py, src/designer_plugin/d3sdk/builtin_modules.py, src/designer_plugin/d3sdk/function.py
Replaced find_packages_in_current_file() with find_imports_for_function() using AST analysis. Introduced ImportAlias and PackageInfo Pydantic models with import statement generation. Added SUPPORTED_MODULES and NOT_SUPPORTED_MODULES frozensets for filtering. Integrated import detection into FunctionInfo and D3Function initialization with replacement handling.
Session & Module Tracking
src/designer_plugin/d3sdk/session.py
Added registered_modules: set[str] tracking to session base. Changed context_modules parameter type from list[str] to set[str]. Implemented lazy module registration in execute() methods—modules auto-register on first call referencing them.
Package Exports
src/designer_plugin/d3sdk/__init__.py
Removed add_packages_in_current_file export; added PackageInfo export.
Configuration
pyproject.toml
Bumped version to 1.3.0. Added pytest integration marker and modified test selection defaults.
Test Coverage
tests/test_ast_utils.py, tests/test_core.py, tests/test_client.py, tests/test_session.py, tests/test_supported_modules.py
Rewrote test_ast_utils.py to test new PackageInfo/ImportAlias models and find_imports_for_function(). Updated test_client.py mock targets for renamed API functions. Added test_core.py tests for D3Function replacement and auto-package registration. Added test_session.py for lazy registration behavior (sync/async). Added integration test test_supported_modules.py validating module support lists.

Sequence Diagram

sequenceDiagram
    actor User
    participant Session as D3Session/<br/>D3AsyncSession
    participant Executor as execute()
    participant Registry as Module Registry
    participant D3Function as D3Function
    participant API as Designer API

    User->>Session: Create session with payload
    User->>Executor: Call execute(payload)
    
    Executor->>Executor: Check if payload.moduleName exists?
    
    alt Module name present
        Executor->>Registry: Is module in registered_modules?
        
        alt Not yet registered
            Executor->>D3Function: Get registration payload for module
            D3Function->>D3Function: Extract imports for all functions
            D3Function-->>Executor: Return payload with module code & imports
            
            Executor->>API: Call register_module API
            API-->>Executor: Success
            
            Executor->>Registry: Add module to registered_modules
        else Already registered
            Executor->>Executor: Skip registration
        end
    end
    
    Executor->>API: Execute payload
    API-->>Executor: Return result
    Executor-->>User: Return response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • twhittock-disguise

Poem

🐰 A rabbit hops through imports with care,
Auto-detecting what functions declare,
Sessions now lazy, modules tracked,
Naming refined, the APIs unpacked,
v1.3.0 hops forth with flair! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Merge dev into main' accurately describes the primary action—merging the dev branch into main for the 1.3.0 release—as confirmed by the PR objectives and commit summaries.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

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 merged commit 15446fc into main Mar 31, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant