Akhil Velagapudi
222cced75e
Simplify Component properties -> KiCad footprint properties pipeline ( #256 )
...
* Dedup PhysicalValue
We had 2 different PhysicalValue structs in pcb-sch and pcb-zen-core
just to avoid adding starlark deps to pcb-sch. I don't think its worth
it.
* Use rust_decimal_macros
Factor out some duplicate code
* Add proper enum -> String attr support
* Add config("mpn") to generated components for compat
* Format list component properties nicely when exporting to kicad
* Format physical value, enum, list kicad properties in compiler
* Don't rely on __attr__ values
Handle typed, stringified component properties directly.
* Title case kicad properties
2025-10-30 16:08:48 -04:00
Akhil Velagapudi
680373c88b
Fix wasm build regression ( #254 )
...
My last PR added a transitive dependency on pcb-kicad to pcb-zen-wasm,
which caused the wasm build to fail.
Build wasm bundle in CI to prevent future regressions.
2025-10-30 00:27:39 -04:00
Akhil Velagapudi
30778a6561
Use kicad-cli for fallback bom instead of symbol parsing ( #253 )
...
* Use kicad-cli for fallback bom instead of symbol parsing
* Add snapshot test
2025-10-29 22:31:20 -04:00
Akhil Velagapudi
de8f97ec39
Add component modifiers + interior mutability ( #241 )
...
* Add component modifiers
* Add component interior mutability
* Fix rebase issues, update snapshots
* Add support for bottom-up modifiers
* Update spec
* Fix refcell panic
* Add builtin.current_module_path()
* Don't return component on Component()
* Add manufacturer to alternatives
* Make modifiers order-independent
* Resolve mpn from properties during construction
2025-10-29 15:47:17 -04:00
Diode Robot
e0d74088f7
Add warn() ( #252 )
...
Co-authored-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-28 11:24:41 -04:00
Akhil Velagapudi
372fe59552
Store module tree in eval context instead of module starlark value ( #251 )
...
* Store module tree outside modules
* Raise diagnostics on Module()
* Fix lsp, wasm to use new API
* Fix formatting, simplify
* process_pending_child doesn't return frozen heap
2025-10-24 14:12:06 -04:00
Akhil Velagapudi
671d9e4f92
Skip update check on pcb update ( #250 )
...
* Skip update check on `pcb update`
* Fix layout tests
* Delete old snapshots
2025-10-23 11:17:02 -04:00
Akhil Velagapudi
95cfb6c774
Include content size in zstd frame header ( #249 )
...
* Include content size in zstd frame header
KiCad needs this ...
* Add pcb layout --temp
To preview layout without a layout block
2025-10-22 23:41:31 -04:00
Lenny Khazan
14ed225337
fix 3d model embedding ( #247 )
...
* fix 3d model embedding
* update order
* fix order
2025-10-22 21:52:59 -04:00
Akhil Velagapudi
01d6763c81
Add mfr, source to search ( #246 )
...
Also, write component zen file to components/<mfr name>/<mpn>/<mpn>.zen
2025-10-22 10:33:17 -04:00
Akhil Velagapudi
d02f6e4b5c
Add HTML fab drawing to release ( #245 )
...
* Add HTML fab drawing to release
Writing to manufacturing/fab_drawing.html.
* Only show inner copper weight if it makes sense
2025-10-21 19:36:32 -04:00
Akhil Velagapudi
d9cdd3aa64
Improve pcb vendor perf ( #244 )
...
Reduced vendor time in test repo from 140s to 6s.
Classify remotes lazily instead of eagerly in fetch_remote.
2025-10-21 17:38:31 -04:00
Lenny Khazan
1709c3fa64
Parse description in pcb release ( #243 )
...
* Parse description in release
* update snap
2025-10-21 15:30:25 -04:00
Akhil Velagapudi
b51a972eb2
Include board config in release ( #242 )
...
JSON contents are written to <staging_dir>/layout/board_config.json.
2025-10-21 14:45:32 -04:00
Akhil Velagapudi
ef4f3693c5
Add pcb mcp ( #240 )
...
* Add mcp support for search_component, add_component
* Add get_zener_docs, fix add_component
* Update help snapshot
2025-10-21 13:33:10 -04:00
Akhil Velagapudi
606fc140cb
Add pcb auth, pcb scan, pcb search ( #236 )
...
* Add pcb auth, pcb scan
* Allow overriding APP, API urls
* Add pcb-scan crate
* Add pcb search
* Move all api stuff into separate crate
* Follow redirects, minor ux improvements
* Update snapshot
* Fix clippy lints
* Update lock file
* Download + extract images by default
* Use datasheel urls from download response
* Add pcb auth refresh
* Use use search API, do more work in parallel
* Dedup code
* Generate correct .zen file using template
* Remove unnecessary code
* Embed step file into kicad_mod
* Synchronize auth token refresh
* Switch to single datasheet url
Also normaize line endings.
* Fix step embedding
* Sanitize names, upgrade footprints
2025-10-20 23:24:45 -04:00
Akhil Velagapudi
9a8af05d2f
Add "--exclude" to pcb tag as well ( #238 )
2025-10-18 10:49:56 -04:00
Akhil Velagapudi
516cb23028
Always eval io() defaults ( #239 )
2025-10-17 18:10:14 -04:00
Akhil Velagapudi
930fa47937
Allow exclusion of certain artifacts during release ( #237 )
...
* Allow exclusion of certain artifacts during release
* Make enums the canonical identifier
2025-10-17 15:02:36 -04:00
Davide Asnaghi
f1d40b0bb3
[FEATURE] sync track and vias ( #110 )
...
* sync vias and track
* cleanup tests
* add test
* simplify virtual classes
* sync vias and track
* cleanup tests
* add test
* simplify virtual classes
* sync vias and track
* cleanup tests
* add test
* simplify virtual classes
* cleaner stdio handling
* use list for kicad iters to avoid windows locks
* explicitly delete board
* cleanup resources
* update snap
* Add Windows warning and disable Windows layout tests
* update formatting
* update formatting
---------
Co-authored-by: AnandKapadia <anand.kapadia1@gmail.com >
Co-authored-by: Lenny Khazan <lenny.khazan@gmail.com >
2025-10-16 17:23:19 -04:00
Lenny Khazan
fd81671a3b
Multi-unit symbol position support ( #235 )
...
* Multi-unit symbol position support
* Add error on @
* update test
2025-10-16 11:59:27 -04:00
Akhil Velagapudi
8cf661db95
Don't auto update pcb ( #234 )
...
Just print a message to stderr asking the user to run `pcb update`.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-15 15:22:03 -04:00
Akhil Velagapudi
78b63cd9c1
[ENG-102] Auto assign netclasses by matching impedances ( #232 )
...
* Sync units, board_config
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Parse netclasses
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Auto assign netclasses by matching impedances
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Only match net -> SE, DiffPair -> diff
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-15 09:45:47 -04:00
Akhil Velagapudi
d7bd751855
Set title, rev, date in drawing title block ( #230 )
...
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-14 20:40:11 -04:00
Akhil Velagapudi
eee722e306
Remove special handling of single-net interfaces ( #229 )
...
* Fix interface template cloning
Also, remove special-cased single net interface naming.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Update snapshots
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Delete using(), interface promotion
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add back proper interface type checking
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Update power check example
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Extract default value before type compilation
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-14 20:39:38 -04:00
Akhil Velagapudi
08460191ad
Fix bug where hijacked interfaces didn't have default values ( #231 )
...
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-14 18:39:01 -04:00
Akhil Velagapudi
84ddcb835c
Typed nets w/ metadata ( #221 )
...
* Add minimal repro
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Remove repro/ contents
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add new typed nets API
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Switch to new typed nets API
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Update snapshots
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* cargo fmt
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add net metadata w/ type checking
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Document builtin.net()
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Fix units in units.zen
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Treat symbol as standard net property
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Fix bug where casting between net types would alloc new id
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* fixup! Treat symbol as standard net property
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Use net contructor to assign default values
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add net conversion (Power -> Net)
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Make regular release builds faster
We can just do all the optimizations on cargo dist.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add .NET deprecated field, static typing for fields
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Allow NET keyword arg
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Make print(net) less verbose
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Hijack stdlib single-net interfaces
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Fix net naming regressions
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Rename builtin.net() -> builtin.net_type()
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-14 11:00:40 -04:00
Akhil Velagapudi
fe7441b7f4
Deferred child module evaluation ( #226 )
...
* Deferred child module evaluation
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Require load_resolver
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Avoid unsafe {}
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Define imports at top of file
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add minimal repro
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add custom enum impl with structural type checking
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Bump starlark-rust to use stable record type ids
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Remove repro/ contents
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Delete copy_value, deep copy
Also, migrate testbench to use deferred eval.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Fix Symbol type ID stability for config defaults
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-13 11:59:14 -04:00
Akhil Velagapudi
198eb0414e
Add back net/interface discriminant for signature json ( #227 )
...
Commit 2a8e1d3 swapped the module-signature serializer from our InputValue
wrapper to plain serde_json::Value. That dropped the legacy {"Net": {...}} /
{"Interface": {...}} tags inside __signature, so pcbviz’s hsheet code stopped
recognizing IOs (it only recurses when those tags are present). Normal
components were unaffected because they ignore __signature.
Reintroduce the legacy shape when exporting signatures—serialize
nets/interfaces explicitly so the JSON still carries the {"Net": …} and
{"Interface": …} wrappers expected by the viewer.
We could make a change in pcbviz to accept the new json, but seems like
it would be better to fix in pcb for now.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-11 11:07:48 -04:00
Akhil Velagapudi
22ea42fff5
Bump kicad to 9.0.5 ( #225 )
...
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-10 14:35:02 -04:00
Akhil Velagapudi
2a8e1d30ca
Replace InputValue with deep copy and native json ser/de ( #223 )
...
* Use deep_copy instead of input value conversion
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Delete InputValue
Use builtin starlarkvalue <> json serialization or deepcopy.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Dedup io() and config()
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Impl DeepCopyToHeap for records, enums
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-10 12:14:29 -04:00
Akhil Velagapudi
1b6dad8243
Make PhysicalValue consistent with PhysicalRange ( #222 )
...
PhysicalRange has a better typing strategy.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-09 13:07:34 -04:00
Davide Asnaghi
25ef81ef01
feat: use symbol reference as fallback ( #219 )
...
* add reference parsing
* fall back on symbol reference when not provided
* fmt
* update snapshots
* update snapshots
2025-10-08 15:00:07 -04:00
Akhil Velagapudi
0a77bbaa43
Add GLB export w/ gltfpacking ( #218 )
...
* Add GLB export w/ gltfpacking
Also separate 3d model exports into multiple tasks
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Switch to gltfpack-sys lib
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Bump gltfpack to drop cmake dependency
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-07 20:28:24 -04:00
Akhil Velagapudi
8170a10b1d
Add "ground" copper role, don't use role in symmetric checks ( #217 )
...
* Don't use role in symmetric check
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add "ground" copper role
This is only for internal use as kicad only supports power.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Sync stdlib board_config.zen for documentation
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-07 18:32:34 -04:00
Akhil Velagapudi
602303f9a1
Add description as Component parameter ( #215 )
...
* Add description as Component param
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Fall back to symbol datasheet, description if not set
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-05 20:48:59 -04:00
Akhil Velagapudi
6b65301cce
Add spec to BoardConfg() and datasheet to Component() ( #214 )
...
* Add spec to BoardConfig
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add datasheet as Component param
Also, sets the built-in "Datasheet" field instead of adding a custom
"datasheet" field.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-05 18:07:38 -04:00
Akhil Velagapudi
aacae1f857
Fix flaky test race condition ( #213 )
...
Both component_duplicate_pin_names and
component_manufacturer_from_symbol were using test_symbol.kicad_sym,
which caused the contents of one test to be visible to the other. Use
different file names as a short-term fix for this.
Example CI flakes: https://github.com/diodeinc/pcb/actions/runs/18253545573/job/51971797596?pr=212
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-05 00:27:53 -04:00
Akhil Velagapudi
304551b1db
Add better error messages, update blinky.zen (and add it to CI) ( #212 )
...
* Improve pcb layout error messages
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Update blinky code to use versioned stdlib, board config
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Keep examples/blinky.zen in sync with README.md blinky
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Build all examples in CI
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Build all examples
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-05 00:27:42 -04:00
Akhil Velagapudi
4042c809c7
Fetch all tags and branches when updating git dependencies ( #209 )
...
The previous implementation only fetched the default refspec, which could
miss new tags, branches, or force-updated refs. This caused worktree
creation to fail when trying to check out newly published versions.
Now explicitly fetches:
- All tags (--tags)
- All branches (+refs/heads/*:refs/heads/*)
- Force-updated refs (--force)
- Prunes deleted refs (--prune, --prune-tags)
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-04 22:15:48 -04:00
Davide Asnaghi
58f91840a8
add support for dielectric sublayers ( #208 )
2025-10-05 03:25:26 +02:00
Diode Robot
2d81c942aa
Only delete worktrees on pcb clean ( #207 )
...
* Only delete worktrees on `pcb clean`
Leave the bare repos as they're just stable object stores.
If `--force` is set, nuke everything.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add fast path that bypasses file locking
fslock is a bit slow on macos
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
Co-authored-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-04 01:16:53 -04:00
Akhil Velagapudi
a877cfd530
Use git worktrees for more efficient dep fetching ( #206 )
...
Loading multiple versions/refs from the same repository required
separate full clones. This was slow, wasted disk space, and network
bandwidth despite having 90%+ content overlap in some cases.
Use git worktrees with a shared bare repository as the object store.
Each version gets a lightweight working directory that references the
same underlying git objects.
Also use a .lock file to avoid race conditions.
Cache Structure:
~/.cache/pcb/github/{user}/{repo}/
├── .repo/ # Shared bare repo
├── .repo.lock # Lock file
├── v0.2.7/ # Worktree
└── v0.2.10/ # Worktree
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-04 00:15:01 -04:00
Lenny Khazan
03776f66f0
[ENG-84] First-party DNP support ( #204 )
...
* [ENG-84] First-party DNP support
* format
2025-10-03 11:01:35 -04:00
Lenny Khazan
da5eecaf98
Fix geber export ( #203 )
2025-10-02 18:31:00 -04:00
Akhil Velagapudi
67b164f34b
Add builtin.add_electrical_check ( #199 )
...
* Add builtin.add_electrical_check
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add snapshot tests
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add checks arg to io()
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* le final api
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Allow constructing PhysicalRange with PhysicalRange value
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Reduce API surface, only expose check_voltage_within
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-02 17:57:46 -04:00
Akhil Velagapudi
56c88f23de
Make TestBench() check eval lazy ( #198 )
...
* Don't alloc to get suppress_errors field
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Make TestBench() check eval lazy
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Simplify
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Remove evalmode
It's no longer needed as pcb build and pcb test do eval the same way
now. The only difference is post-eval.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Update TestBench() spec
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
* Add a rano parse unit test
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-02 17:43:29 -04:00
Akhil Velagapudi
5bfe35c143
Fix single-net interface net naming ( #201 )
...
Before: check that interface has 1 field and that it is a net
After: check that interface has 1 net field (and no interfaces)
This allows for adding metadata fields without changing the net naming.
This should (hopefully) not cause that much churn because we haven't
really used metadata fields in interfaces yet.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com >
2025-10-02 13:25:06 -04:00
Lenny Khazan
e6b5ff186e
First-party component manufacturer support ( #200 )
...
* Add manufacturer to component
* Parse manufacturer from symbol
* add to netlist
* cargo fmt
2025-10-02 09:24:14 -07:00
Lenny Khazan
1b5886086a
Fix for removePositions lookup ( #196 )
2025-10-01 17:59:44 -04:00