You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
8
+
## [1.3.0] - 2026-01-06
9
+
10
+
### Added
11
+
-**Lazy module registration**: `D3Session.execute()` and `D3AsyncSession.execute()` now automatically register a `@d3function` module on first use, eliminating the need to declare all modules in `context_modules` upfront.
12
+
-`registered_modules` tracking on session instances prevents duplicate registration calls.
13
+
-**Jupyter notebook support**: `@d3function` now automatically replaces a previously registered function when the same name is re-registered in the same module, with a warning log. This enables iterative workflows in Jupyter notebooks where cells are re-executed.
14
+
-**Automatic import detection**: `@d3function` now automatically discovers file-level imports used by the decorated function and includes them in the registered module. In Jupyter notebooks, place imports inside the function body instead.
15
+
16
+
### Removed
17
+
-`add_packages_in_current_file()`: Removed. Imports are now detected automatically by `@d3function`.
18
+
-`find_packages_in_current_file()`: Removed. Replaced by `find_imports_for_function()`.
19
+
20
+
### Changed
21
+
-`d3_api_plugin` has been renamed to `d3_api_execute`.
22
+
-`d3_api_aplugin` has been renamed to `d3_api_aexecute`.
23
+
-`context_modules` parameter type updated from `list[str]` to `set[str]` on `D3Session`, `D3AsyncSession`, and `D3SessionBase`.
24
+
- Updated documentation to reflect `pystub` proxy support.
25
+
- Bumped `actions/checkout` to v6 and `astral-sh/setup-uv` to v7 in CI.
26
+
- Added Test PyPI publish workflow (`test-publish.yml`) for dev version releases.
Copy file name to clipboardExpand all lines: README.md
+18-15Lines changed: 18 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,11 +83,11 @@ To enable IDE autocomplete and type checking for Designer's Python API, install
83
83
pip install designer-plugin-pystub
84
84
```
85
85
86
-
Once installed, import the stubs using the `TYPE_CHECKING` pattern. This provides type hints in your IDE without affecting runtime execution:
86
+
Once installed, import the stubs.
87
+
> **Important:**`pystub` provides type hints for Designer's API objects but not their implementations. These objects only exist in Designer's runtime and cannot be used in local Python code. They must only be referenced in code that will be executed remotely in Designer.
88
+
87
89
```python
88
-
from typing importTYPE_CHECKING
89
-
ifTYPE_CHECKING:
90
-
from designer_plugin.pystub.d3 import*
90
+
from designer_plugin.pystub import*
91
91
```
92
92
93
93
This allows you to get autocomplete for Designer objects like `resourceManager`, `Screen2`, `Path`, etc., while writing your plugin code.
@@ -100,9 +100,7 @@ The Client API allows you to define a class with methods that execute remotely o
100
100
101
101
```python
102
102
from designer_plugin.d3sdk import D3PluginClient
103
-
from typing importTYPE_CHECKING
104
-
ifTYPE_CHECKING:
105
-
from designer_plugin.pystub.d3 import*
103
+
from designer_plugin.pystub import*
106
104
107
105
# 1. Sync example -----------------------------------
108
106
classMySyncPlugin(D3PluginClient):
@@ -169,7 +167,15 @@ The Functional API offers two decorators: `@d3pythonscript` and `@d3function`:
169
167
-**`@d3function`**:
170
168
- Must be registered on Designer before execution.
171
169
- Functions decorated with the same `module_name` are grouped together and can call each other, enabling function chaining and code reuse.
172
-
- Registration is automatic when you pass module names to the session context manager (e.g., `D3AsyncSession('localhost', 80, ["mymodule"])`). If you don't provide module names, no registration occurs.
170
+
- Registration happens automatically on the first call to `execute()` or `rpc()` that references the module — no need to declare modules upfront. You can also pre-register specific modules by passing them to the session context manager (e.g., `D3AsyncSession('localhost', 80, {"mymodule"})`).
171
+
172
+
> **Jupyter Notebook:** File-level imports (e.g., `import numpy as np` in a separate cell) cannot be automatically detected. In Jupyter, place any required imports inside the function body itself:
173
+
> ```python
174
+
>@d3function("mymodule")
175
+
>defmy_fn():
176
+
>import numpy as np
177
+
>return np.array([1, 2])
178
+
>```
173
179
174
180
### Session API Methods
175
181
@@ -186,9 +192,7 @@ Both `D3AsyncSession` and `D3Session` provide two methods for executing function
186
192
187
193
```python
188
194
from designer_plugin.d3sdk import d3pythonscript, d3function, D3AsyncSession
189
-
from typing importTYPE_CHECKING
190
-
ifTYPE_CHECKING:
191
-
from designer_plugin.pystub.d3 import*
195
+
from designer_plugin.pystub import*
192
196
193
197
# 1. @d3pythonscript - simple one-off execution
194
198
@d3pythonscript
@@ -213,11 +217,11 @@ def my_time() -> str:
213
217
returnstr(datetime.datetime.now())
214
218
215
219
# Usage with async session
216
-
asyncwith D3AsyncSession('localhost', 80, ["mymodule"]) as session:
220
+
asyncwith D3AsyncSession('localhost', 80) as session:
0 commit comments