[Pather / AutoTool] rework route kwargs into tool_options, and actualyl pass them through AutoTool
This commit is contained in:
parent
49713896c3
commit
67afee7704
11 changed files with 865 additions and 130 deletions
46
MIGRATION.md
46
MIGRATION.md
|
|
@ -22,13 +22,13 @@ The biggest migration point is that the old routing verbs were renamed:
|
|||
| `Pather.pathU(...)` | `Pather.uturn(...)` |
|
||||
| `Pather.path_into(...)` | `Pather.trace_into(...)` |
|
||||
| `Pather.path_from(src, dst)` | `Pather.at(src).trace_into(dst)` |
|
||||
| `RenderPather.path(...)` | `Pather(..., auto_render=False).trace(...)` |
|
||||
| `RenderPather.path_to(...)` | `Pather(..., auto_render=False).trace_to(...)` |
|
||||
| `RenderPather.mpath(...)` | `Pather(..., auto_render=False).trace(...)` / `Pather(..., auto_render=False).trace_to(...)` |
|
||||
| `RenderPather.pathS(...)` | `Pather(..., auto_render=False).jog(...)` |
|
||||
| `RenderPather.pathU(...)` | `Pather(..., auto_render=False).uturn(...)` |
|
||||
| `RenderPather.path_into(...)` | `Pather(..., auto_render=False).trace_into(...)` |
|
||||
| `RenderPather.path_from(src, dst)` | `Pather(..., auto_render=False).at(src).trace_into(dst)` |
|
||||
| `RenderPather.path(...)` | `Pather(..., render='deferred').trace(...)` |
|
||||
| `RenderPather.path_to(...)` | `Pather(..., render='deferred').trace_to(...)` |
|
||||
| `RenderPather.mpath(...)` | `Pather(..., render='deferred').trace(...)` / `Pather(..., render='deferred').trace_to(...)` |
|
||||
| `RenderPather.pathS(...)` | `Pather(..., render='deferred').jog(...)` |
|
||||
| `RenderPather.pathU(...)` | `Pather(..., render='deferred').uturn(...)` |
|
||||
| `RenderPather.path_into(...)` | `Pather(..., render='deferred').trace_into(...)` |
|
||||
| `RenderPather.path_from(src, dst)` | `Pather(..., render='deferred').at(src).trace_into(dst)` |
|
||||
|
||||
There are also new convenience wrappers:
|
||||
|
||||
|
|
@ -123,13 +123,13 @@ from masque.builder.renderpather import RenderPather
|
|||
from masque.builder import Pather
|
||||
|
||||
builder = Pather(...)
|
||||
deferred = Pather(..., auto_render=False)
|
||||
deferred = Pather(..., render='deferred')
|
||||
```
|
||||
|
||||
Top-level imports from `masque` also continue to work.
|
||||
|
||||
`Pather` now defaults to `auto_render=True`, so plain construction replaces the
|
||||
old `Builder` behavior. Use `Pather(..., auto_render=False)` where you
|
||||
`Pather` now defaults to `render='auto'`, so plain construction replaces the
|
||||
old `Builder` behavior. Use `Pather(..., render='deferred')` where you
|
||||
previously used `RenderPather`.
|
||||
|
||||
## `BasicTool` was replaced
|
||||
|
|
@ -218,7 +218,7 @@ class MyTool(Tool):
|
|||
commit_planner=commit,
|
||||
),)
|
||||
|
||||
def render(self, batch: Sequence[RenderStep], **kwargs: Any):
|
||||
def render(self, batch: Sequence[RenderStep]):
|
||||
...
|
||||
```
|
||||
|
||||
|
|
@ -281,10 +281,32 @@ class MyTool(Tool):
|
|||
commit_planner=commit,
|
||||
),)
|
||||
|
||||
def render(self, batch: Sequence[RenderStep], **kwargs):
|
||||
def render(self, batch: Sequence[RenderStep]):
|
||||
...
|
||||
```
|
||||
|
||||
Routing entry points now name every supported route argument explicitly.
|
||||
Custom per-route planning values must be placed under `tool_options`:
|
||||
|
||||
```python
|
||||
pather.jog('A', 4, length=10, tool_options={'process_corner': 'slow'})
|
||||
```
|
||||
|
||||
The mapping is unpacked only for `Tool.primitive_offers()`. Route arguments do
|
||||
not leak into that namespace, and tool options are not forwarded to
|
||||
`Tool.render()`. An offer that needs route-specific render behavior must capture
|
||||
the selected value in its `commit()` result (`RenderStep.data`). `AutoTool`
|
||||
does this automatically for generated straight and S-bend primitives: the flat
|
||||
mapping is snapshotted per selected primitive and passed to its generator as
|
||||
keyword arguments during rendering. AutoTool options must not change generated
|
||||
ports or endpoint geometry. `PathTool` defines no tool options and rejects
|
||||
nonempty mappings.
|
||||
|
||||
AutoTool does not validate generator keyword signatures during planning. A bad
|
||||
keyword therefore raises when the generator runs, normally during rendering.
|
||||
Generators that require route options must provide explicit port metadata at
|
||||
registration; S-bend generators must also provide an explicit `endpoint`.
|
||||
|
||||
Primitive offers are local planning objects:
|
||||
|
||||
- `endpoint_at(parameter)` returns the local output `Port`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue