uniwire 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. uniwire-0.1.0/.gitignore +37 -0
  2. uniwire-0.1.0/CHANGELOG.md +71 -0
  3. uniwire-0.1.0/LICENSE +202 -0
  4. uniwire-0.1.0/NOTICE +31 -0
  5. uniwire-0.1.0/PKG-INFO +224 -0
  6. uniwire-0.1.0/README.md +178 -0
  7. uniwire-0.1.0/examples/01_studio_apartment.uniwire.json +70 -0
  8. uniwire-0.1.0/examples/02_house_3_bedrooms_tt.uniwire.json +109 -0
  9. uniwire-0.1.0/examples/03_house_three_phase_heat_pump_ev.uniwire.json +122 -0
  10. uniwire-0.1.0/examples/04_uk_consumer_unit_rcbo.uniwire.json +78 -0
  11. uniwire-0.1.0/examples/05_us_residential_200a_panel.uniwire.json +98 -0
  12. uniwire-0.1.0/examples/06_german_single_family_house.uniwire.json +114 -0
  13. uniwire-0.1.0/examples/07_apartment_building_risers.uniwire.json +989 -0
  14. uniwire-0.1.0/examples/08_small_retail_shop.uniwire.json +109 -0
  15. uniwire-0.1.0/examples/09_bakery_three_phase.uniwire.json +100 -0
  16. uniwire-0.1.0/examples/10_holiday_cottage_generator.uniwire.json +90 -0
  17. uniwire-0.1.0/examples/11_tiny_house_off_grid_pv.uniwire.json +92 -0
  18. uniwire-0.1.0/examples/12_garage_workshop_motors.uniwire.json +78 -0
  19. uniwire-0.1.0/examples/13_swimming_pool_equipment.uniwire.json +71 -0
  20. uniwire-0.1.0/examples/14_farmhouse_barn_long_feeder.uniwire.json +96 -0
  21. uniwire-0.1.0/examples/15_smart_home_load_shedding.uniwire.json +103 -0
  22. uniwire-0.1.0/examples/16_dental_practice_ups.uniwire.json +111 -0
  23. uniwire-0.1.0/examples/17_hair_salon_it_230v.uniwire.json +63 -0
  24. uniwire-0.1.0/examples/18_office_building_main_lv_switchboard.uniwire.json +584 -0
  25. uniwire-0.1.0/examples/19_ecole_tgbt_td.uniwire.json +587 -0
  26. uniwire-0.1.0/examples/20_hotel_kitchen_board.uniwire.json +350 -0
  27. uniwire-0.1.0/examples/21_supermarket_refrigeration_hvac.uniwire.json +360 -0
  28. uniwire-0.1.0/examples/22_bloc_operatoire_it_medical.uniwire.json +281 -0
  29. uniwire-0.1.0/examples/23_server_room_ups_2n.uniwire.json +366 -0
  30. uniwire-0.1.0/examples/24_factory_mcc_motor_starters.uniwire.json +242 -0
  31. uniwire-0.1.0/examples/25_poste_hta_bt_1000kva.uniwire.json +191 -0
  32. uniwire-0.1.0/examples/26_two_transformers_bus_tie.uniwire.json +194 -0
  33. uniwire-0.1.0/examples/27_standby_generator_ats_load_shedding.uniwire.json +257 -0
  34. uniwire-0.1.0/examples/28_gymnase_eclairage_sportif.uniwire.json +235 -0
  35. uniwire-0.1.0/examples/29_car_park_ventilation_fire_safety.uniwire.json +270 -0
  36. uniwire-0.1.0/examples/30_station_traitement_eau_it.uniwire.json +390 -0
  37. uniwire-0.1.0/examples/31_warehouse_docks_forklift_charging.uniwire.json +381 -0
  38. uniwire-0.1.0/examples/32_us_retail_480y277_stepdown.uniwire.json +372 -0
  39. uniwire-0.1.0/examples/33_workshop_metering_cts.uniwire.json +230 -0
  40. uniwire-0.1.0/examples/34_chantier_distribution_provisoire.uniwire.json +316 -0
  41. uniwire-0.1.0/examples/35_pv_selfconsumption_string_fr.uniwire.json +114 -0
  42. uniwire-0.1.0/examples/36_pv_microinverters_ac_battery_fr.uniwire.json +109 -0
  43. uniwire-0.1.0/examples/37_rooftop_pv_100kwp.uniwire.json +109 -0
  44. uniwire-0.1.0/examples/38_pv_farm_lv_combiners.uniwire.json +1389 -0
  45. uniwire-0.1.0/examples/39_hybrid_inverter_backup_us.uniwire.json +533 -0
  46. uniwire-0.1.0/examples/40_ev_charging_hub_load_management.uniwire.json +470 -0
  47. uniwire-0.1.0/examples/41_bess_container_dc_microgrid.uniwire.json +589 -0
  48. uniwire-0.1.0/examples/42_public_lighting_cabinet_fr.uniwire.json +83 -0
  49. uniwire-0.1.0/examples/43_logo_lighting_pumps.uniwire.json +469 -0
  50. uniwire-0.1.0/examples/44_m241_remote_io_480v.uniwire.json +562 -0
  51. uniwire-0.1.0/examples/45_irrigation_vfd_plc_fr.uniwire.json +446 -0
  52. uniwire-0.1.0/examples/46_lift_machine_room.uniwire.json +63 -0
  53. uniwire-0.1.0/examples/47_marina_shore_power.uniwire.json +805 -0
  54. uniwire-0.1.0/examples/48_heat_pump_plant_room_fr.uniwire.json +433 -0
  55. uniwire-0.1.0/examples/49_chp_parallel_grid.uniwire.json +335 -0
  56. uniwire-0.1.0/examples/50_telecom_shelter_48vdc.uniwire.json +516 -0
  57. uniwire-0.1.0/examples/51_pumping_station_plc_fr.uniwire.json +78 -0
  58. uniwire-0.1.0/examples/52_dual_source_selectable_feeders.uniwire.json +135 -0
  59. uniwire-0.1.0/examples/code/house_fr.py +71 -0
  60. uniwire-0.1.0/examples/code/office_board.py +72 -0
  61. uniwire-0.1.0/examples/code/pumping_station.py +38 -0
  62. uniwire-0.1.0/pyproject.toml +96 -0
  63. uniwire-0.1.0/schema/uniwire.schema.json +28134 -0
  64. uniwire-0.1.0/src/uniwire/__init__.py +19 -0
  65. uniwire-0.1.0/src/uniwire/bom.py +79 -0
  66. uniwire-0.1.0/src/uniwire/build.py +563 -0
  67. uniwire-0.1.0/src/uniwire/cli.py +268 -0
  68. uniwire-0.1.0/src/uniwire/exports.py +153 -0
  69. uniwire-0.1.0/src/uniwire/graph.py +82 -0
  70. uniwire-0.1.0/src/uniwire/i18n.py +434 -0
  71. uniwire-0.1.0/src/uniwire/labels.py +378 -0
  72. uniwire-0.1.0/src/uniwire/layout/__init__.py +22 -0
  73. uniwire-0.1.0/src/uniwire/layout/engine.py +1955 -0
  74. uniwire-0.1.0/src/uniwire/layout/multiline.py +1944 -0
  75. uniwire-0.1.0/src/uniwire/layout/routing.py +224 -0
  76. uniwire-0.1.0/src/uniwire/llm/__init__.py +17 -0
  77. uniwire-0.1.0/src/uniwire/llm/card.py +510 -0
  78. uniwire-0.1.0/src/uniwire/llm/describe.py +281 -0
  79. uniwire-0.1.0/src/uniwire/llm/evaluate.py +232 -0
  80. uniwire-0.1.0/src/uniwire/llm/link.py +43 -0
  81. uniwire-0.1.0/src/uniwire/llm/patch.py +472 -0
  82. uniwire-0.1.0/src/uniwire/llm/sandbox.py +170 -0
  83. uniwire-0.1.0/src/uniwire/llm/store.py +100 -0
  84. uniwire-0.1.0/src/uniwire/llm/tools.py +412 -0
  85. uniwire-0.1.0/src/uniwire/marks.py +332 -0
  86. uniwire-0.1.0/src/uniwire/mcp_server.py +432 -0
  87. uniwire-0.1.0/src/uniwire/model/__init__.py +22 -0
  88. uniwire-0.1.0/src/uniwire/model/base.py +128 -0
  89. uniwire-0.1.0/src/uniwire/model/document.py +231 -0
  90. uniwire-0.1.0/src/uniwire/model/nodes.py +572 -0
  91. uniwire-0.1.0/src/uniwire/py.typed +0 -0
  92. uniwire-0.1.0/src/uniwire/registry/__init__.py +74 -0
  93. uniwire-0.1.0/src/uniwire/registry/core.json +745 -0
  94. uniwire-0.1.0/src/uniwire/registry/data/LICENSES.md +20 -0
  95. uniwire-0.1.0/src/uniwire/registry/data/iz_tables.json +651 -0
  96. uniwire-0.1.0/src/uniwire/render/__init__.py +128 -0
  97. uniwire-0.1.0/src/uniwire/render/colors.py +399 -0
  98. uniwire-0.1.0/src/uniwire/render/frame.py +231 -0
  99. uniwire-0.1.0/src/uniwire/render/pdf.py +147 -0
  100. uniwire-0.1.0/src/uniwire/render/scene.py +185 -0
  101. uniwire-0.1.0/src/uniwire/render/semantics.py +93 -0
  102. uniwire-0.1.0/src/uniwire/render/svg.py +100 -0
  103. uniwire-0.1.0/src/uniwire/resolve.py +239 -0
  104. uniwire-0.1.0/src/uniwire/rules/__init__.py +95 -0
  105. uniwire-0.1.0/src/uniwire/rules/core.py +128 -0
  106. uniwire-0.1.0/src/uniwire/rules/iec60364.py +93 -0
  107. uniwire-0.1.0/src/uniwire/rules/nfc15100.py +281 -0
  108. uniwire-0.1.0/src/uniwire/rules/plc.py +82 -0
  109. uniwire-0.1.0/src/uniwire/schema.py +51 -0
  110. uniwire-0.1.0/src/uniwire/symbols/__init__.py +601 -0
  111. uniwire-0.1.0/src/uniwire/symbols/sheet.py +25 -0
  112. uniwire-0.1.0/src/uniwire/tolerate.py +140 -0
  113. uniwire-0.1.0/src/uniwire/units.py +131 -0
  114. uniwire-0.1.0/tests/__init__.py +0 -0
  115. uniwire-0.1.0/tests/conftest.py +3 -0
  116. uniwire-0.1.0/tests/test_build.py +117 -0
  117. uniwire-0.1.0/tests/test_examples.py +125 -0
  118. uniwire-0.1.0/tests/test_i18n.py +48 -0
  119. uniwire-0.1.0/tests/test_labels_layout.py +277 -0
  120. uniwire-0.1.0/tests/test_llm.py +326 -0
  121. uniwire-0.1.0/tests/test_llm_evals.py +74 -0
  122. uniwire-0.1.0/tests/test_llm_mcp.py +135 -0
  123. uniwire-0.1.0/tests/test_llm_store.py +51 -0
  124. uniwire-0.1.0/tests/test_marks.py +192 -0
  125. uniwire-0.1.0/tests/test_model.py +129 -0
  126. uniwire-0.1.0/tests/test_multiline.py +142 -0
  127. uniwire-0.1.0/tests/test_plc_bom.py +110 -0
  128. uniwire-0.1.0/tests/test_power_links.py +173 -0
  129. uniwire-0.1.0/tests/test_registry.py +63 -0
  130. uniwire-0.1.0/tests/test_render.py +54 -0
  131. uniwire-0.1.0/tests/test_rules.py +225 -0
  132. uniwire-0.1.0/tests/test_schema.py +26 -0
  133. uniwire-0.1.0/tests/test_security.py +364 -0
  134. uniwire-0.1.0/tests/test_svg_contract.py +186 -0
  135. uniwire-0.1.0/tests/test_tolerate.py +78 -0
@@ -0,0 +1,37 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+ uv.lock
11
+
12
+ # Tools
13
+ .pytest_cache/
14
+ .ruff_cache/
15
+ .mypy_cache/
16
+ .coverage
17
+ .coverage.*
18
+ htmlcov/
19
+ *.log
20
+
21
+ # Generated output
22
+ out/
23
+ site/
24
+ viewer/dist/
25
+ viewer/examples/
26
+ viewer/version.json
27
+ viewer/favicon.svg
28
+ viewer/favicon-16.svg
29
+
30
+ # Secrets
31
+ .env
32
+ .env.*
33
+
34
+ # Editors and systems
35
+ .DS_Store
36
+ .idea/
37
+ .vscode/
@@ -0,0 +1,71 @@
1
+ # Changelog
2
+
3
+ All notable changes to the uniwire format and to the `uniwire` Python library are documented here.
4
+ The format and the library are versioned separately: the format follows `1.y.z` (see
5
+ [SPEC §9](https://uniwire.sh/docs/SPEC/#9-extensibility-and-versions)), the library follows its own semantic
6
+ version.
7
+
8
+ ## Unreleased
9
+
10
+ ## 0.1.0 (format 1.0)
11
+
12
+ First release of the uniwire format and of the `uniwire` Python library (Apache-2.0; specification text under
13
+ CC BY 4.0).
14
+
15
+ * Format 1.0: `*.uniwire.json` documents describing an installation as a power tree (sources, devices, loads)
16
+ plus `links` for everything outside the tree; typed nodes (53 types), templates, views; published JSON
17
+ Schema at <https://uniwire.sh/schema/v1/uniwire.schema.json>
18
+ ([specification](https://uniwire.sh/docs/SPEC/)).
19
+ * Node types for utility supplies, MV/LV transformers, generators, UPS, PV, batteries, inverters, protective
20
+ and switching devices, instrument transformers, protection relays, insulation monitors, busbars, boards,
21
+ terminal blocks, loads, modular PLCs (ordered modules, roles, protocols, channel ports) and power supplies.
22
+ * Common node fields (`count`, `circuit`, `un_V`, `ib_A`, `normal_state`, `locks`...), auxiliary devices outside
23
+ the tree (`devices[]`), addressable enclosures (`enclosures[]`), key interlocks (`interlocks[]`, `locks[]` on
24
+ nodes and links).
25
+ * Link kinds `transfer`, `tie`, `bypass`, `parallel`, `infeed`, `earth`, `control`, `interlock`, `trip`,
26
+ `measure`, `data` and `key`, with optional cable, device and terminal / channel ports.
27
+ * Structured `product` references on every node and PLC module; bill of materials as CSV (`uniwire bom`).
28
+ * Validation with explicit messages (unknown fields, wrong units, broken references); any `1.y.z` document is
29
+ accepted.
30
+ * Rule profiles: `core`, `nfc15100` (French dwellings), `iec60364` (cable current-carrying capacity from the
31
+ GUIA-BT-19 tables), PLC consistency checks, interlock check.
32
+ * Single-line diagrams: automatic layout, automatic sheet splitting with cross-references, circuit schedule,
33
+ enclosure frames, title block, revisions and notes, top-down or bottom-up drawings.
34
+ * Multi-line power diagrams derived from the same document: one line per conductor (L1, L2, L3, N, PE / PEN),
35
+ one contact per pole, RCD toroids, PEN split, transformer windings, motors, busbars as one rail per
36
+ conductor; `uniwire render --kind multi-line` for any document.
37
+ * Colour modes per view: conductors (IEC 60445 or North-American colours), phase, source, status or voltage
38
+ level, with palette overrides and a legend.
39
+ * Wire marking (the part of [UEP-0001](https://uniwire.sh/docs/uep/0001-terminals-and-wires/) that format 1.0
40
+ can carry): marking rules per view, manual marks in `cable.marks`, cable tags on the drawings; CSV exports
41
+ `uniwire wires`, `uniwire markers`, `uniwire cables`, and `uniwire marks [--write]`.
42
+ * SVG output with a documented structure contract
43
+ ([Python API](https://uniwire.sh/docs/api/#svg-structure)); multi-sheet PDF with bookmarks and clickable
44
+ cross-sheet references.
45
+ * English and French rendering (`meta.lang`); CLI messages follow `UNIWIRE_LANG`.
46
+ * Code-first API `uniwire.build`: installations as Python code
47
+ ([guide](https://uniwire.sh/docs/build/)).
48
+ * Command line `uniwire`: `validate`, `check`, `render`, `bom`, `wires`, `markers`, `cables`, `marks`,
49
+ `graph`, `normalize`, `schema`, `symbols`, `card`, `describe`, `patch`, `link`, `--version`.
50
+ * Terminal / connectivity-node graph derived from the document, with CIM, IFC and IEC 61850 SCL mappings.
51
+ * Tolerant reading of unambiguous near-miss values (`poles: 2`, `cores: "3G2.5"`, `range_A: [15, 45]`...), each
52
+ reported by the rule `core.normalized`; `installation.premises` scopes dwelling-only rules.
53
+ * LLM tools ([guide](https://uniwire.sh/docs/llm/)): reference card generated from the model (`uniwire card`),
54
+ text outline with stable ids (`uniwire describe`), id-based edits (`uniwire patch`), flat node table, links that
55
+ open a document in the web editor (`uniwire link`, `viewer_url` in the MCP tool results).
56
+ * MCP server `uniwire-mcp` (extra `uniwire[mcp]`): stdio and HTTP transports, tools to validate, check,
57
+ describe, patch, render and export documents, bundled examples; a public mode with bounded inputs,
58
+ worker processes and timeouts, short editor links (`--store`) and a usage log without caller addresses,
59
+ used by the hosted endpoint <https://mcp.uniwire.sh/mcp>; every tool has a title and read-only annotations;
60
+ check results state their scope (automatic checks, not a conformity certificate).
61
+ Setup for ChatGPT, Claude, Cursor and VS Code: [uniwire in your assistant](https://uniwire.sh/docs/assistants/).
62
+ * LLM evaluation tasks with a runner that makes no network calls
63
+ ([evals/llm](https://github.com/uniwire-dev/uniwire/tree/main/evals/llm)).
64
+ * Hardened parsing: bounded quantity and reference parsers, nesting limit, CSV formula neutralisation,
65
+ XML-safe SVG, PDF and CSV output.
66
+ * 52 example documents ([examples](https://github.com/uniwire-dev/uniwire/tree/main/examples)): dwellings,
67
+ commercial and industrial boards, MV/LV substations, standby sources, PV, EV charging, UPS, PLCs.
68
+ * Optional IEC 81346-2 class table in the separate data package `uniwire-data-iec81346` (CC BY-SA 4.0),
69
+ `pip install "uniwire[iec81346]"`.
70
+ * Draft proposal [UEP-0001 "Terminals, terminal strips and wires"](https://uniwire.sh/docs/uep/0001-terminals-and-wires/)
71
+ for format 2.0.
uniwire-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
uniwire-0.1.0/NOTICE ADDED
@@ -0,0 +1,31 @@
1
+ uniwire: open standard and reference library for describing electrical installations
2
+ (single-line and multi-line diagrams)
3
+ Copyright 2026 The uniwire contributors
4
+ https://github.com/uniwire-dev/uniwire
5
+
6
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
7
+
8
+ The uniwire specification text (docs/SPEC.md) is licensed under the Creative Commons Attribution 4.0
9
+ International licence (CC BY 4.0), see docs/LICENSE-SPEC.md.
10
+
11
+ uniwire symbols are original drawings made for this project.
12
+
13
+ Third-party data:
14
+ - Current-carrying capacity tables (src/uniwire/registry/data/iz_tables.json) reproduce values
15
+ from the public Spanish technical guide GUIA-BT-19 (tables taken from UNE 20460-5-523:2004),
16
+ cited in the file header (see src/uniwire/registry/data/LICENSES.md).
17
+
18
+ Optional data package (distributed separately, not covered by the Apache License):
19
+ - uniwire-data-iec81346 (packages/uniwire-data-iec81346), installed with
20
+ `pip install "uniwire[iec81346]"`, contains an IEC 81346-2:2019 class table derived from the
21
+ Wikipedia article "IEC 81346" and is licensed under CC BY-SA 4.0 (see its README and LICENSE).
22
+
23
+ Fonts:
24
+ - No font files are included. The documentation theme and the web viewer (viewer/) refer to the Public
25
+ Sans and JetBrains Mono fonts (SIL Open Font License 1.1) served by the uniwire.sh website at
26
+ /assets/fonts/, and fall back to system fonts when built and served on their own.
27
+
28
+ Used but not bundled:
29
+ - The web viewer loads Pyodide (Mozilla Public License 2.0) and CodeMirror 6 (MIT) from public CDNs at run
30
+ time.
31
+ - The documentation is built with MkDocs and Material for MkDocs (BSD-2-Clause and MIT).
uniwire-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,224 @@
1
+ Metadata-Version: 2.5
2
+ Name: uniwire
3
+ Version: 0.1.0
4
+ Summary: Electrical diagrams, as code: an open standard to describe electrical installations, with validation, rules, BOM, wire lists and single-line / multi-line SVG/PDF drawings
5
+ Project-URL: Homepage, https://uniwire.sh
6
+ Project-URL: Documentation, https://uniwire.sh/docs/
7
+ Project-URL: Repository, https://github.com/uniwire-dev/uniwire
8
+ Project-URL: Issues, https://github.com/uniwire-dev/uniwire/issues
9
+ Project-URL: Changelog, https://github.com/uniwire-dev/uniwire/blob/main/CHANGELOG.md
10
+ Author: uniwire contributors
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ License-File: NOTICE
14
+ Keywords: CAD,IEC 60364,IEC 60617,NF C 15-100,diagram as code,electrical,mcp,multi-line diagram,one-line diagram,schema unifilaire,single-line diagram
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Environment :: Console
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Intended Audience :: Manufacturing
19
+ Classifier: Intended Audience :: Science/Research
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: 3.14
28
+ Classifier: Topic :: Multimedia :: Graphics
29
+ Classifier: Topic :: Scientific/Engineering
30
+ Classifier: Typing :: Typed
31
+ Requires-Python: >=3.10
32
+ Requires-Dist: pydantic>=2.7
33
+ Provides-Extra: dev
34
+ Requires-Dist: jsonschema>=4.20; extra == 'dev'
35
+ Requires-Dist: mcp>=2.0; extra == 'dev'
36
+ Requires-Dist: pytest>=8; extra == 'dev'
37
+ Requires-Dist: reportlab>=4; extra == 'dev'
38
+ Requires-Dist: ruff>=0.6; extra == 'dev'
39
+ Provides-Extra: iec81346
40
+ Requires-Dist: uniwire-data-iec81346; extra == 'iec81346'
41
+ Provides-Extra: mcp
42
+ Requires-Dist: mcp>=2.0; extra == 'mcp'
43
+ Provides-Extra: pdf
44
+ Requires-Dist: reportlab>=4; extra == 'pdf'
45
+ Description-Content-Type: text/markdown
46
+
47
+ # uniwire
48
+
49
+ **Electrical diagrams, as code.**
50
+
51
+ An open standard to describe electrical installations, and the reference Python library that validates
52
+ them, checks them against rules and draws their single-line and multi-line diagrams.
53
+
54
+ [![CI](https://img.shields.io/github/actions/workflow/status/uniwire-dev/uniwire/ci.yml?branch=main&label=CI)](https://github.com/uniwire-dev/uniwire/actions/workflows/ci.yml)
55
+ [![PyPI](https://img.shields.io/pypi/v/uniwire)](https://pypi.org/project/uniwire/)
56
+ [![Python](https://img.shields.io/pypi/pyversions/uniwire)](https://pypi.org/project/uniwire/)
57
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/uniwire-dev/uniwire/blob/main/LICENSE)
58
+
59
+ You describe the **installation** (sources, protective devices, cables, loads, PLCs) in a `*.uniwire.json`
60
+ file or in Python, and uniwire computes the drawings. No coordinates, no CAD file: a text file you can
61
+ review and diff.
62
+
63
+ * **Format**: `*.uniwire.json`, format 1.0, defined by the [specification](https://uniwire.sh/docs/SPEC/)
64
+ and validated by a published JSON Schema: <https://uniwire.sh/schema/v1/uniwire.schema.json>.
65
+ * **Library**: `pip install uniwire`: Python API, code-first builder and the `uniwire` command line.
66
+ * **Documentation**: <https://uniwire.sh/docs/>
67
+ * **Web viewer**: <https://uniwire.sh/viewer/>, paste a document to validate, check and draw it in the browser.
68
+
69
+ ## Features
70
+
71
+ * **Single-line and multi-line diagrams** from the same document: the multi-line view derives every
72
+ conductor (L1, L2, L3, N, PE, PEN) from the single-line data, with no extra input.
73
+ * **53 node types**: utility grid, transformers, generators, UPS, PV, batteries, inverters; breakers,
74
+ RCDs, RCBOs, fuses, switch-disconnectors, contactors, motor starters, transfer switches, SPDs,
75
+ protection relays, instrument transformers, insulation monitors; busbars, boards, terminal blocks;
76
+ lighting, sockets, heating, motors, EV chargers, modular PLCs and more.
77
+ * **Tree + links**: the power tree is the backbone; transfers, bus ties, infeeds, earthing, control,
78
+ interlocks, trips, measurements and data buses are links. A terminal / connectivity-node graph is
79
+ derived automatically, with CIM, IFC and IEC 61850 SCL mappings.
80
+ * **Closed typing and unit-suffixed fields**: `in_A`, `idn_mA`, `section_mm2`, `p_kW`; unknown fields are
81
+ errors (`calibre` instead of `in_A` is caught), extensions live in `ext`. Templates declare a device once.
82
+ * **Rule profiles**: `core` (always), `nfc15100` (French dwellings), `iec60364` (cable current-carrying
83
+ capacity), plus PLC consistency checks.
84
+ * **Bill of materials**: structured `product` references (manufacturer, part number, range, accessories)
85
+ on any node or PLC module, aggregated to CSV (`uniwire bom`).
86
+ * **Wire and cable marking**: marking rules per view (manual, sequential, per potential, pattern), marks
87
+ drawn on the multi-line diagram, and CSV exports: wire list (`uniwire wires`), wire marker list
88
+ (`uniwire markers`), cable schedule (`uniwire cables`); `uniwire marks --write` freezes the marks.
89
+ * **Colour modes**: conductors in their IEC 60445 or North-American colours, or colouring by phase,
90
+ source, status or voltage level.
91
+ * **Sheets**: paper size, sub-tree views, automatic sheet splitting with cross-references, circuit schedule,
92
+ enclosure frames, title block, revisions and notes. **SVG** output is deterministic and diff-friendly;
93
+ the multi-sheet **PDF** has clickable links between sheets.
94
+ * **English and French rendering**, selected per document with `meta.lang`.
95
+ * **LLM tooling**: a reference card generated from the model (`uniwire card`), a text outline with
96
+ stable ids (`uniwire describe`), id-based edits (`uniwire patch`), an MCP server (`uniwire-mcp`, stdio)
97
+ and a hosted MCP endpoint at <https://mcp.uniwire.sh/mcp>, plus
98
+ [llms.txt](https://uniwire.sh/llms.txt) for assistants (full reference card
99
+ included). Setup for ChatGPT, Claude, Cursor and VS Code:
100
+ [uniwire in your assistant](https://uniwire.sh/docs/assistants/); details in
101
+ [LLM tools](https://uniwire.sh/docs/llm/).
102
+
103
+ ## Gallery
104
+
105
+ <table>
106
+ <tr>
107
+ <td width="50%"><a href="https://github.com/uniwire-dev/uniwire/blob/main/examples/02_house_3_bedrooms_tt.uniwire.json"><img src="https://github.com/uniwire-dev/uniwire/raw/main/docs/gallery/02_house_3_bedrooms_tt.png" alt="French house, TT, single-line diagram"></a><br><sub>French house, TT (NF C 15-100), single-line</sub></td>
108
+ <td width="50%"><a href="https://github.com/uniwire-dev/uniwire/blob/main/examples/06_german_single_family_house.uniwire.json"><img src="https://github.com/uniwire-dev/uniwire/raw/main/docs/gallery/06_german_single_family_house.png" alt="German house, TN-C-S, multi-line diagram in conductor colours"></a><br><sub>German house, TN-C-S, multi-line in conductor colours</sub></td>
109
+ </tr>
110
+ <tr>
111
+ <td width="50%"><a href="https://github.com/uniwire-dev/uniwire/blob/main/examples/18_office_building_main_lv_switchboard.uniwire.json"><img src="https://github.com/uniwire-dev/uniwire/raw/main/docs/gallery/18_office_building_main_lv_switchboard.png" alt="Office building main LV switchboard"></a><br><sub>Office building, main LV switchboard</sub></td>
112
+ <td width="50%"><a href="https://github.com/uniwire-dev/uniwire/blob/main/examples/25_poste_hta_bt_1000kva.uniwire.json"><img src="https://github.com/uniwire-dev/uniwire/raw/main/docs/gallery/25_poste_hta_bt_1000kva.png" alt="MV/LV substation, 1000 kVA"></a><br><sub>MV/LV substation, 1000 kVA</sub></td>
113
+ </tr>
114
+ <tr>
115
+ <td width="50%"><a href="https://github.com/uniwire-dev/uniwire/blob/main/examples/27_standby_generator_ats_load_shedding.uniwire.json"><img src="https://github.com/uniwire-dev/uniwire/raw/main/docs/gallery/27_standby_generator_ats_load_shedding.png" alt="Standby generator, automatic transfer switch, load shedding"></a><br><sub>Standby generator, ATS, load shedding</sub></td>
116
+ <td width="50%"><a href="https://github.com/uniwire-dev/uniwire/blob/main/examples/24_factory_mcc_motor_starters.uniwire.json"><img src="https://github.com/uniwire-dev/uniwire/raw/main/docs/gallery/24_factory_mcc_motor_starters.png" alt="Motor control centre, multi-line diagram with wire marks"></a><br><sub>Motor control centre, multi-line with wire marks</sub></td>
117
+ </tr>
118
+ </table>
119
+
120
+ All 52 examples are in [examples/](https://github.com/uniwire-dev/uniwire/tree/main/examples) and listed in the
121
+ [documentation](https://uniwire.sh/docs/examples/); open any of them in the [web viewer](https://uniwire.sh/viewer/).
122
+
123
+ ## Install
124
+
125
+ ```bash
126
+ pip install uniwire # validation, rules, SVG rendering, bill of materials, exports
127
+ pip install "uniwire[pdf]" # + PDF output (reportlab)
128
+ pip install "uniwire[mcp]" # + MCP server (uniwire-mcp)
129
+ pip install "uniwire[iec81346]" # + optional IEC 81346-2 class table (separate CC BY-SA 4.0 data package)
130
+ ```
131
+
132
+ Python 3.10 or later. The only required dependency is pydantic.
133
+
134
+ ## Quickstart
135
+
136
+ A document in JSON:
137
+
138
+ ```json
139
+ {
140
+ "$schema": "https://uniwire.sh/schema/v1/uniwire.schema.json",
141
+ "uniwire": "1.0.0",
142
+ "profiles": ["nfc15100"],
143
+ "meta": { "title": "Small house", "lang": "en" },
144
+ "installation": { "earthing": "TT", "system": "1P+N", "un_V": 230 },
145
+ "templates": { "C16": { "type": "breaker", "in_A": 16, "curve": "C" } },
146
+ "sources": [
147
+ { "type": "grid", "label": "Utility", "children": [
148
+ { "type": "main_breaker", "ref": "-Q0", "range_A": "15-45", "in_A": 45, "idn_mA": 500, "selective": true,
149
+ "children": [
150
+ { "type": "rcd", "ref": "-Q1", "in_A": 40, "idn_mA": 30, "rcd_type": "A", "children": [
151
+ { "type": "breaker", "ref": "-Q11", "use": "C16", "cable": { "cores": "3G", "section_mm2": 1.5 },
152
+ "children": [ { "type": "lighting", "label": "Lighting", "points": 6 } ] },
153
+ { "type": "breaker", "ref": "-Q12", "in_A": 20, "curve": "C", "cable": { "cores": "3G", "section_mm2": 2.5 },
154
+ "children": [ { "type": "socket", "label": "Sockets", "points": 8 } ] }
155
+ ] }
156
+ ] }
157
+ ] }
158
+ ]
159
+ }
160
+ ```
161
+
162
+ The tree is the power flow (source, protective devices, loads); whatever falls outside the tree
163
+ (transfer switches, bus ties, control and data connections) goes in `links`.
164
+
165
+ ```bash
166
+ uniwire validate house.uniwire.json # schema + integrity
167
+ uniwire check house.uniwire.json # rule profiles (exit code 1 on errors)
168
+ uniwire render house.uniwire.json # SVG sheets in out/house/
169
+ uniwire render house.uniwire.json -f pdf -o house.pdf
170
+ uniwire render house.uniwire.json --kind multi-line # multi-line power diagram
171
+ uniwire bom house.uniwire.json -o house.bom.csv # bill of materials
172
+ uniwire wires house.uniwire.json # wire list (also: markers, cables, marks)
173
+ uniwire card # reference card for assistants
174
+ ```
175
+
176
+ The same installation in Python:
177
+
178
+ ```python
179
+ from uniwire.build import *
180
+
181
+ with Installation("Small house", earthing="TT", system="1P+N", un="230 V", profiles=["nfc15100"]) as inst:
182
+ with Grid("Utility"), MainBreaker("-Q0", "15-45 A", idn="500 mA", selective=True):
183
+ with RCD("-Q1", "40 A", "30 mA", type="A"):
184
+ Breaker("-Q11", "C16", cable="3G1,5") >> Lighting("Lighting", points=6)
185
+ Breaker("-Q12", "C20", cable="3G2,5 18 m") >> Socket("Sockets", points=8)
186
+
187
+ for finding in inst.check():
188
+ print(finding)
189
+ inst.save("house.uniwire.json")
190
+ inst.render("house.pdf")
191
+ ```
192
+
193
+ `with` makes an element the parent of everything created inside it, `>>` chains elements, ratings and
194
+ cables are written the way they appear on drawings (`"C16"`, `"3G2,5 18 m"`). See the
195
+ [code-first API](https://uniwire.sh/docs/build/) and the [Python API and CLI](https://uniwire.sh/docs/api/).
196
+
197
+ ## Roadmap
198
+
199
+ * **Terminals, terminal strips and wires**: [UEP-0001](https://uniwire.sh/docs/uep/0001-terminals-and-wires/),
200
+ a draft for format 2.0 (named ports, terminal strips, wires and cables as objects, potentials).
201
+ * **Control schematics**: coils, auxiliary contacts with cross-references, terminal plans and wire numbers,
202
+ built on named ports.
203
+ * **Exports**: DXF drawings, pandapower networks for load-flow and short-circuit studies.
204
+
205
+ Ideas and format proposals are welcome: see
206
+ [CONTRIBUTING.md](https://github.com/uniwire-dev/uniwire/blob/main/CONTRIBUTING.md).
207
+
208
+ ## Contributing
209
+
210
+ Bug reports, examples, rules, symbols and translations are welcome. Read
211
+ [CONTRIBUTING.md](https://github.com/uniwire-dev/uniwire/blob/main/CONTRIBUTING.md) (development setup, tests,
212
+ uniwire Enhancement Proposals) and the
213
+ [Code of Conduct](https://github.com/uniwire-dev/uniwire/blob/main/CODE_OF_CONDUCT.md). Report security issues
214
+ privately, see [SECURITY.md](https://github.com/uniwire-dev/uniwire/blob/main/SECURITY.md).
215
+
216
+ ## Licences
217
+
218
+ * Code, CLI and JSON Schema: [Apache License 2.0](https://github.com/uniwire-dev/uniwire/blob/main/LICENSE).
219
+ * Specification text: [CC BY 4.0](https://github.com/uniwire-dev/uniwire/blob/main/docs/LICENSE-SPEC.md):
220
+ implement it freely, in any software.
221
+ * Optional data package `uniwire-data-iec81346` (IEC 81346-2 class table): CC BY-SA 4.0, distributed
222
+ separately (`pip install "uniwire[iec81346]"`).
223
+
224
+ See [NOTICE](https://github.com/uniwire-dev/uniwire/blob/main/NOTICE) for third-party notices.