Skip to content

Merge refactored code into dev #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 51 commits into from
Mar 8, 2025
Merged

Merge refactored code into dev #447

merged 51 commits into from
Mar 8, 2025

Conversation

17o2
Copy link
Collaborator

@17o2 17o2 commented Mar 1, 2025

Here is what I have done:

  • Take the code from Large scale refactoring #251, the big refactoring that has been on hold for years
  • Create a new branch based on it, and squash most intermediate WIP commits into one to make it easier to handle
  • Cherry-pick all suggestions from other users where possible/applicable
    • This includes bugfixes submitted to v0.4 and v0.4.1
  • Adapt the refactored code by hand to reflect other users' contributions where a simple cherry-pick was not possible due to the refactoring; taking care to include Co-authored-by info in the commit to preserve original authorship
  • Exclude some commits for now (see list below)
  • Solve all merge conflicts and create the dev-refactored branch, which can now be fast-forward-merged into dev

How I envision the next steps:

  • Figure out why the GitHub build is failing at the moment
  • Merge this into dev, so everyone can finally move on to the new codebase
  • Implement the changes listed below
  • Fix the inevitable bugs and possible regressions that might have occurred
  • Base all new developments, bugfixes, PRs on the new code

Please share any thoughts you have on this process. If there is no strong argument against it, it will be merged into dev and #251 will be closed unmerged (but preserved). Thank you!


The following commits are explicitly NOT yet part of the PR and should be added afterwards. I need to look into the code a bit more in-depth to figure out how to implement these changes in the refactored code, but did not want them to hold up the process.

17o2 and others added 30 commits September 12, 2023 19:37
`edotor.net` does not seem to like leading underscores, which makes GraphViz debugging difficult.
no diff should ocurr as a result of the refactoring

Add `metadata.title` to `demo01.yml`

to avoid diffs later when calling via CLI

Add temporary loop to `demo01`

for debugging purposes

Add `cleanup.sh` (maybe move/delete later? or add commit hook?)

Deprecate Python 3.7, add Python 3.10

Add `devtools.txt`

Add `pyan` to `devtools.txt`

Add sample use to `devtools.txt`
Refactor connector node generation

Further refactor connector node generation

Rebuild demos

Generate gauge string inside Cable object

WIP: refactor cable node generation

Implement HTML indentation

WIP

More WIP

Remove old stuff, slightly simplify code

Outsource `gv_pin_table()`, simplify padding

Add TODOs

Outsource `set_dot_basics()` and `apply_dot_tweaks()`

Make setting HTML tag attributes easier through `kwargs`

Fix and simplify bgcolor logic

Reactivate cable edge generation

Outsource `gv_edge_wire()`

Make connecting things more object-oriented

Alphabetize HTML tags, improve bgcolor rendering

Make mates object-oriented

Run `autoflake -i`

Run `autoflake -i --remove-all-unused-imports`

Streamline assignment of ports to simple connectors

Implement color objects

Use color objects in WireViz

Re-sort `wv_colors.py`

Make green color darker

Break longer lines not caught by `black`

because they were unbroken strings or comments

Make variable name more expressive

Apply dot tweaks last

Remove unused line

Improve subclassing of components, prepare for BOM refactoring

Clean up

Include nested additional components in BOM

do not add autogenerated designators to BOM

Improve BOM generation (TODO: wires from a bundle)

Prepare `harness.populate_bom()`

Change `description` to `type` in additional BOM item YAML

Define CLI epilog str in single statement

Rename modules, adjust imports, move `build_examples.py`

Restructure and update `.gitignore`

Clarify `wireviz.parse()` input types

Implement BOM population (missing: qty multipliers)

Make `pin_objects` and `wire_objects` dictionaries

Compute qty's of additional components (WIP)

Add qty test file

Adapt `tutorial08.yml` (remove `unit` field)

Add `tabulate` to dependency list (might remove later if not needed)

Sort BOM by category, assign BOM IDs

Rename `Options.color_mode` to `.color_output_mod` for consistency

Change BOM output file extension from `.bom.tsv` to `.tsv`

Implement BOM bubbles

Stop recursive nesting of additional components

Add BOM bubble to additional component list (WIP)

Fix gauge conversion

Fix line breaks in code

Optimize BOM bubble geometry

Implement pin color output

Small issue: GraphViz warning
```
Warning: table size too small for content
```

Add some test files to `tests/` directory

Update test files

Allow multiple colors for components

Implement multiple colors for components, improve multicolor table rendering

Fix color cell implementation

Fix node background color rendering

Add test file for node and title bgcolors

WIP: BOM modes

Add TODO for empty connector pin tables

Comment out BOM modes (WIP) and BOM bubbles

Resume work on BOM

Include part number info in BOM table

Fix BOM output in TSV and HTML

Add bundles' wires' part number info to BOM

Add TODOs

Implement bundle part number rendering

Improve conductor table rendering

Fix additional component BOM table layout

Disable CLI BOM output

Add suggestions from #246

Add suggestions from #186

Add .vscode/ to .gitignore

Fix PyLance problems

Update interim version number

Fix zero-size cell for simple connectors without type

Implement additional parameters dict for components

Implement note for additional components

Thicken additional component table

Add placeholder for add.comp. PN info

Apply black
It seems "-dev" (normalized to ".dev") should only be directly followed
by a number for different deveopment releases of the same version.
See full description: https://peps.python.org/pep-0440/
Complementary changes to the commit with the same title
earlier in the same PR. Avoid refering to the old filenames.
Allow absent "prefix" in group entries to simplify the code
Bug: 0x112233:0x445566 in YAML input didn't convert such colors
to #112233:#445566 and the strings where just passed as uppercase
to the .gv file. Hence Graphviz printed warnings about unknown
colors and used black as color instead.

Add test for int as string. Re-ordered if statements to give an
exception when a color has an unknown type.
#251 (comment)

No output changed for any examples/tutorial/tests input.
…utils.py`

Remove unused attribute

Remove unused `&&` in GitHub workflow

Remove duplicate `category` attribute

Removed from `Connector` class since it is already defined in the `Component` superclass.

Remove unnecessary casting of `int` to `float`

#251 (comment)

Continue work on BOM handling (WIP)
Use version from v0.4.1 master branch.
Fix missing link to v0.4.1 (L8) so it's not forgotten.
Co-authored-by: Jeremy Ruhland (hatchery) <jeremy@goopypanther.org>

squash me
Co-authored-by: kvid <kvid@users.noreply.github.com>
This happened to be a regression for WireViz-Web [1], which aims to do
as much in memory as possible.

[1] https://github.com/daq-tools/wireviz-web.

kvid rebased and mixed original commit with similar change by Daniel Rojas

Co-authored-by: Andreas Motl <andreas.motl@panodata.org>
Co-authored-by: kvid <kvid@users.noreply.github.com>
Co-authored-by: kvid <kvid@users.noreply.github.com>
Remove the references in the CLI help, but keep the placeholders elsewhere in the code as a TODO
Co-authored-by: kvid <kvid@users.noreply.github.com>
Running 6 different Python versions (3.7 to 3.12) in parallel now.
NOTE: This is in conflict with #309, but can be resolved easily in a later PR.

GitHub Actions require an update:
- actions/upload-artifact@v3 is scheduled for deprecation on November
30, 2024.
- Similarly, v1/v2 are scheduled for deprecation on June 30, 2024.
- Updating this comes with a breaking change in upload-artifact@v4:

Uploading to the same named Artifact multiple times.

Due to how Artifacts are created in this new version, it is no longer
possible to upload to the same named Artifact multiple times. You must
either split the uploads into multiple Artifacts with different names,
or only upload once. Otherwise you will encounter an error.

The artifact .zip files therefore have the python version added to
their name.
Use ubuntu-22.04 only for Python 3.7-3.8
by including them separately into the matrix.
In Windows might OSError(errno=EINVAL) be raised instead of the already
catched exceptions in some cases (depending on the Python version).

Suggested fix posted by JarrettR in
#344 (comment)

Co-authored-by: kvid <kvid@users.noreply.github.com>
Co-authored-by: JarrettR <jrainier@gmail.com>
Specify all HTML files under templates folder
to be included as package data files.
The CLI handling code was redesigned for v0.4 and it seems the code
to assign a default title from v0.3.1 has been messed up. This bug
has not been triggered by build_examples.py due to it seems to call
the parse() function differently.

The output_name should be used as default title when present.

This will fix the #360 bug report.

Co-authored-by: kvid <kvid@users.noreply.github.com>
The project was moved into the new organization 2023-05-30, but old
URLs are still working due to automatic redirects by GitHub.

#316 (comment)

Co-authored-by: kvid <kvid@users.noreply.github.com>
kvid and others added 12 commits March 1, 2025 19:41
Fixes #377 (makes HTML output template placeholders more consistent)

Co-authored-by: kvid <kvid@users.noreply.github.com>
Might help in reported issues like #342
Raising TypeError is better than assert. (Black reformatted)

Co-authored-by: Andreas Motl <andreas.motl@panodata.org>
In Windows might OSError(errno = None) be raised instead of the already
catched exceptions in some cases (depending on the Python version)

Fixes #391
In Windows might ValueError be raised instead of the already
catched exceptions in some cases (depending on the Python version)

Fixes point 2 of #318 (review)
Clarify all exceptions catched, including changes in #392

Co-authored-by: kvid <kvid@users.noreply.github.com>
A number of such warnings showed up when running e.g.
PYTHONWARNINGS=always python build_examples.py
PYTHONWARNINGS=always wireviz ../../examples/demo0?.yml
See #309 (comment)

Fix: All open() calls should be in a "with open() as x" statement
to ensure closing the file when exiting the block in any way.
Otherwise, use the new file_read_text() or file_write_text() functions
to read or write the whole utf-8 text file and closing it.

Co-authored-by: kvid <kvid@users.noreply.github.com>
Co-authored-by: kvid <kvid@users.noreply.github.com>
@tobiasfalk
Copy link

Yayyyy🗣🗣

@17o2 17o2 force-pushed the dev-refactored branch from 8dfd523 to 773c3ac Compare March 1, 2025 19:40
@17o2 17o2 force-pushed the dev-refactored branch from 773c3ac to 01c3771 Compare March 1, 2025 19:45
@17o2 17o2 requested a review from kvid March 1, 2025 19:56
@17o2
Copy link
Collaborator Author

17o2 commented Mar 2, 2025

Perhaps it would make sense to flip it around: force-push this branch onto #251 (so that the discussion there remains part of the merged code) and use a separate branch to preserve the full history. 🤔

@tobiasfalk
Copy link

I think it is less error prown if this is merged into dev and #251 is closed or left alone.
And since you pointed to #251 already in history, it is preserved good enough.

@17o2
Copy link
Collaborator Author

17o2 commented Mar 8, 2025

Time to just do it and move forward with the new code. 💪
I will create a new issue for the commits I left open for now (see initial message) so they don't get lost.

@17o2 17o2 merged commit 01c3771 into dev Mar 8, 2025
12 checks passed
@17o2 17o2 deleted the dev-refactored branch March 8, 2025 09:36
@17o2 17o2 removed the request for review from kvid March 8, 2025 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants