Skip to content

Commit 773c3ac

Browse files
committed
Merge branch 'refactor/big-refactor-squashed' into dev-refactored
2 parents 9cb9ede + b1d02b9 commit 773c3ac

File tree

160 files changed

+28006
-16874
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+28006
-16874
lines changed

.gitattributes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ docs/* linguist-documentation
22
examples/* linguist-documentation
33
tutorial/* linguist-documentation
44

5-
**/*.bom.tsv linguist-generated
6-
**/*.bom.csv linguist-generated
5+
**/*.tsv linguist-generated
6+
**/*.csv linguist-generated
77
**/*.gv linguist-generated
88
**/*.html linguist-generated
99
**/*.png linguist-generated

.github/workflows/main.yml

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,39 @@ on: [push, pull_request, workflow_dispatch]
44

55
jobs:
66
build:
7-
runs-on: ubuntu-latest
87
strategy:
9-
max-parallel: 4
8+
max-parallel: 6
109
matrix:
11-
python-version: [3.7, 3.8]
10+
# ubuntu-22.04 supports Python 3.7-3.12
11+
# ubuntu-24.04 (currently latest & preferred) supports Python 3.9-3.12
12+
# More details: https://github.com/actions/runner-images/issues/10636
13+
os: [ubuntu-latest]
14+
python-version: ["3.9", "3.10", "3.11", "3.12"]
15+
include:
16+
- os: ubuntu-22.04
17+
python-version: "3.7"
18+
- os: ubuntu-22.04
19+
python-version: "3.8"
20+
runs-on: ${{ matrix.os }}
1221
steps:
13-
- uses: actions/checkout@v2
14-
- name: Set up Python ${{ matrix.python-version }}
15-
uses: actions/setup-python@v2
16-
with:
17-
python-version: ${{ matrix.python-version }}
18-
- name: Setup Graphviz
19-
uses: ts-graphviz/setup-graphviz@v1
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install .
24-
- name: Create Examples
25-
run: PYTHONPATH=$(pwd)/src:$PYTHONPATH cd src/wireviz/ && python build_examples.py
26-
- name: Upload examples, demos, and tutorials
27-
uses: actions/upload-artifact@v2
28-
with:
29-
name: examples-and-tutorials
30-
path: |
31-
examples/
32-
tutorial/
22+
- uses: actions/checkout@v4
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Setup Graphviz
28+
uses: ts-graphviz/setup-graphviz@v2
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install .
33+
- name: Create Examples
34+
run: PYTHONPATH=$(pwd)/src/wireviz:$PYTHONPATH cd src/wireviz/tools/ && python build_examples.py
35+
- name: Upload examples, demos, and tutorials
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: examples-and-tutorials-v${{ matrix.python-version }}
39+
path: |
40+
examples/
41+
tutorial/
42+
if-no-files-found: error

.gitignore

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1+
# OS-specific files
12
.DS_Store
3+
desktop.ini
4+
Thumbs.db
5+
6+
# Development aids
27
.idea/
3-
.eggs
4-
__pycache__
5-
.*.swp
6-
*.egg-info
7-
*.pyc
8-
build
9-
data
10-
dist
8+
.vscode/
9+
temp/
1110
venv/
1211
.venv/
13-
desktop.ini
14-
thumbs.db
15-
temp/
12+
13+
# Build/compile/release artifacts
14+
build/
15+
dist/
16+
*.egg-info
17+
*.pyc
18+
19+
# Other temporary files
20+
__pycache__
21+
.*.swp

cleanup.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/zsh
2+
3+
autoflake -i --remove-all-unused-imports src/wireviz/*.py
4+
isort src/wireviz/*py
5+
black src/wireviz/*.py

devtools.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# The following tools have proven useful during development
2+
# Feel free to install while inside the WireViz virtualenv, using:
3+
# pip install -r devtools.txt
4+
5+
# Code formatting
6+
black # black src/wireviz/*.py
7+
isort # isort src/wireviz/*py
8+
9+
# Development aids
10+
pudb # import pudb; pudb.set_trace()
11+
autoflake # autoflake -i --remove-all-unused-imports src/wireviz/*.py
12+
pyan # pyan3 src/wireviz/*.py -uncge --html > temp/pyan.html

docs/CHANGELOG.md

Lines changed: 80 additions & 51 deletions
Large diffs are not rendered by default.

docs/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contribution Guidelines
22

3-
When contributing to this repository, please [submit a new issue](https://github.com/formatc1702/WireViz/issues) first to discuss the proposed change, before submitting a pull request.
3+
When contributing to this repository, please [submit a new issue](https://github.com/wireviz/WireViz/issues) first to discuss the proposed change, before submitting a pull request.
44

55
## Submitting a new Issue
66

@@ -27,7 +27,7 @@ When contributing to this repository, please [submit a new issue](https://github
2727
1. Push the changes to your fork.
2828
1. Please format your code using [`isort`](https://pycqa.github.io/isort/) and [`black`](https://black.readthedocs.io) before submitting.
2929
1. Submit a new pull request, using `dev` as the base branch.
30-
- If your code changes or extends the WireViz YAML syntax, be sure to update the [syntax description document](https://github.com/formatc1702/WireViz/blob/dev/docs/syntax.md) in your PR.
30+
- If your code changes or extends the WireViz YAML syntax, be sure to update the [syntax description document](https://github.com/wireviz/WireViz/blob/dev/docs/syntax.md) in your PR.
3131
1. Please include in the PR description (and optionally also in the commit message body) a reference (# followed by issue number) to the issue where the suggested changes are discussed.
3232

3333
### Hints

docs/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ Output file:
7474
7575
![Sample output diagram](../examples/demo01.png)
7676
77-
[Bill of Materials](../examples/demo01.bom.tsv) (auto-generated)
77+
[Bill of Materials](../examples/demo01.tsv) (auto-generated)
7878
7979
### Demo 02
8080
8181
![](../examples/demo02.png)
8282
83-
[Source](../examples/demo02.yml) - [Bill of Materials](../examples/demo02.bom.tsv)
83+
[Source](../examples/demo02.yml) - [Bill of Materials](../examples/demo02.tsv)
8484
8585
### Syntax, tutorial and example gallery
8686
@@ -133,11 +133,11 @@ Depending on the options specified, this will output some or all of the followin
133133
mywire.gv GraphViz output
134134
mywire.svg Wiring diagram as vector image
135135
mywire.png Wiring diagram as raster image
136-
mywire.bom.tsv BOM (bill of materials) as tab-separated text file
136+
mywire.tsv BOM (bill of materials) as tab-separated text file
137137
mywire.html HTML page with wiring diagram and BOM embedded
138138
```
139139

140-
Wildcars in the file path are also supported to process multiple files at once, e.g.:
140+
Wildcards in the file path are also supported to process multiple files at once, e.g.:
141141
```
142142
$ wireviz ~/path/to/files/*.yml
143143
```

docs/buildscript.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!--
44
The following text is taken from #118
5-
https://github.com/formatc1702/WireViz/pull/118
5+
https://github.com/wireviz/WireViz/pull/118
66
77
TODO: write a better explaination -->
88

@@ -26,7 +26,7 @@ Possible group names:
2626
- `tutorial` to process`tutorial/{readme.md,tutorial*.*}`
2727
- `demos` to process`examples/demo*.*`
2828

29-
Affected filetypes: `.gv`, `.bom.tsv`, `.png`, `.svg`, `.html`
29+
Affected filetypes: `.gv`, `.tsv`, `.png`, `.svg`, `.html`
3030

3131

3232
## Usage hints

docs/syntax.md

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ connections:
192192
```
193193

194194
- Each connection set is a list of components.
195-
- The minimum number of items is two.
195+
- The minimum number of items is one.
196196
- The maximum number of items is unlimited.
197197
- Items must alternatingly belong to the `connectors` and the `cables` sections.
198198
- When a connection set defines multiple parallel connections, the number of specified `<pin>`s and `<wire>`s for each component in the set must match. When specifying only one designator, one is auto-generated for each connection of the set.
@@ -207,7 +207,6 @@ connections:
207207
- `- <designator>: <int/str>` attaches a pin of the connector, referring to a pin number (from the connector's `pins` attribute) or a pin label (from its `pinlabels` attribute), provided the label is unique.
208208

209209
- `- <designator>` is allowed for simple connectors, since they have only one pin to connect.
210-
For connectors with `autogenerate: true`, a new instance, with auto-generated designator, is created.
211210

212211
#### Cables
213212

@@ -230,14 +229,10 @@ For connectors with `autogenerate: true`, a new instance, with auto-generated de
230229
- `- [<designator>, ..., <designator>]`
231230

232231
Attaches multiple different single pin connectors, one per connection in the set.
233-
For connectors with `autogenerate: true`, a new instance, with auto-generated designator, is created with every mention.
234-
Auto-generated and non-autogenerated connectors may be mixed.
235232

236233
- `- <designator>`
237234

238235
Attaches multiple instances of the same single pin connector, one per connectioin in the set.
239-
For connectors with `autogenerate: true`, a new instance, with auto-generated designator, is created for every connection in the set.
240-
Since only connectors with `pincount: 1` can be auto-generated, pin number 1 is implicit.
241236

242237
#### Cables
243238

@@ -280,7 +275,9 @@ connections:
280275
281276
### Autogeneration of items
282277
283-
For very simple, recurring connectors such as crimp ferrules, splices and others, where it would be a hassle to individually assign unique designators for every instance, autogeneration may be used. Both connectors and cables can be autogenerated.
278+
If multiple identical copies of a connector or cable are needed, it is possible to define them once as a template, and then generate multiple instances as needed. This is called autogeneration. Both connectors and cables can be autogenerated.
279+
280+
Autogenerated instances of components can be explicitly assigned a designator; this way, they can be referenced in multiple connection sets. However, it is also possible to generate unnamed instances of components. This is especially useful for components that do not need to be referenced in more than one connection set, and where naming each individual instance is an unnecessary complication.
284281
285282
Example (see `connections` section):
286283

@@ -322,9 +319,29 @@ connections:
322319
Since the internally assigned designator of an unnamed component is not known to the user, one instance of the connector can not be referenced again outside the point of creation (i.e. in other connection sets, or later in the same set). Autogeneration of unnamed instances is therefore only useful for terminals with only one wire attached, or splices with exactly one wire going in, and one wire going out.
323320
If a component is to be used in other connection sets (e.g. for a three-way splice, or a crimp where multiple wires are joined), a named instance needs to be used.
324321

322+
The default character to trigger autogeneration of components is `.`. A different character can be specified using the `template_separator` option (see below).
323+
325324
Names of autogenerated components are hidden by default. While they can be shown in the graphical output using the `show_name: true` option, it is not recommended to manually use the internally assigned designator (starting with a double underscore `__`), since it might change in future WireViz versions, or when the order of items in connection sets changes.
326325

327326

327+
### Unconnected components
328+
329+
Even if a component is not connected to any other components, it must be mentioned in a connection set for it to be displayed.
330+
331+
```yaml
332+
connectors:
333+
X1: # this connector will not be connected to any other components
334+
...
335+
336+
connections:
337+
-
338+
- X1 # minimal connection set to include connector in the diagram
339+
340+
```
341+
342+
If any component is defined in the `connectors` or `cables` sections but not referenced in `connections`, a warning is printed in the console.
343+
344+
328345
## Metadata entries
329346

330347
```yaml
@@ -338,6 +355,7 @@ Names of autogenerated components are hidden by default. While they can be shown
338355
# If no value is specified for 'title', then the
339356
# output filename without extension is used.
340357
```
358+
See [HTML Output Templates](../src/wireviz/templates/) for how metadata entries can be inserted into the HTML output.
341359

342360
## Options
343361

@@ -372,6 +390,9 @@ Names of autogenerated components are hidden by default. While they can be shown
372390
# about additional components inside the diagram node (connector/cable box).
373391
# If False, show all info about additional components inside the diagram node.
374392
mini_bom_mode: <bool> # Default = True
393+
394+
# Character to split template and designator for autogenerated components
395+
template_separator: <str> # Default = '.'
375396
```
376397

377398

@@ -393,6 +414,7 @@ Parts can be added to a connector or cable in the section `<additional-component
393414
# when used in a connector:
394415
# pincount number of pins of connector
395416
# populated number of populated positions in a connector
417+
# unpopulated number of unpopulated positions
396418
# when used in a cable:
397419
# wirecount number of wires of cable/bundle
398420
# terminations number of terminations on a cable/bundle
@@ -478,7 +500,7 @@ The following colors are understood:
478500
- `GD` ![##ffcf80](https://via.placeholder.com/15/ffcf80/000000?text=+) (gold)
479501

480502
<!-- color list generated with a helper script: -->
481-
<!-- https://gist.github.com/formatc1702/3c93fb4c5e392364899283f78672b952 -->
503+
<!-- https://gist.github.com/17o2/3c93fb4c5e392364899283f78672b952 -->
482504

483505
It is also possible to specify colors as hexadecimal RGB values, e.g. `#112233` or `#FFFF00:#009900`.
484506
Remember quoting strings containing a `#` in the YAML file.

examples/demo01.bom.tsv

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)