Skip to content

Automatic class diagram construction#66

Merged
PawelPlesniak merged 19 commits intodevelopfrom
emmuhamm/auto-class
May 8, 2026
Merged

Automatic class diagram construction#66
PawelPlesniak merged 19 commits intodevelopfrom
emmuhamm/auto-class

Conversation

@emmuhamm
Copy link
Copy Markdown
Collaborator

@emmuhamm emmuhamm commented Mar 26, 2026

Description

Fixes #57

We have a new tool! Automatic Class UML diagram generator!!

Copy paste of the docs from the CLI tool:

This command calls the UML helper functions directly to:
1. run pyreverse in a chosen working directory,
2. style the generated dot files,
3. optionally render them, and
4. optionally split the diagrams into connected components.

Usage:
    daqpytools-generate-uml [package name] --directory [package directory] 
        --output-directory [dir] --split 
    
    daqpytools-generate-uml daqpytools --output-directory pics
    daqpytools-generate-uml daqpytools 
        --directory some/path --output-directory pics --split
    daqpytools-generate-uml daqpytools --format none

The most basic usage is daqpytools-generate-uml [package name] --directory [package directory] --output-directory [dir] --split

Example outputs
Screenshot 2026-04-20 at 12 07 51

classes_styled

Some of the new files can also be called, for manual debugging:

python style_pyreverse.py daqpytools --output-directory pics
python split_diagram.py pics/classes_styled.dot --output-directory pics/split

Follow up for next time:

  • check that the output directory is still relative to the current terminal
  • make docs for the docs page
  • add pytests
  • check if you can put in your own formatting styles
  • Better file outputs (sho8uld have the dot files in a folder and the pngs in a separate one)

#68

Type of change

  • New feature or enhancement (non-breaking change which adds functionality)

Testing checklist

  • Unit tests pass (e.g. dbt-build --unittest)
  • Minimal system quicktest passes (pytest -s minimal_system_quick_test.py)
  • Full set of integration tests pass (dunedaq_integtest_bundle.sh)
  • Python tests pass if applicable (e.g. python -m pytest)
  • Pre-commit hooks run successfully if applicable (e.g. pre-commit run --all-files)

Manual test

  • Run daqpytools-generate-uml daqpytools --directory [path to daqpytools] --output-directory pics --split
  • Run daqpytools-generate-uml drunc --directory [path to drunc] --output-directory pics --split
  • Enjoy :)

Further checks

  • Code is commented where needed, particularly in hard-to-understand areas
  • Code style is correct (dbt-build --lint, and/or see https://dune-daq-sw.readthedocs.io/en/latest/packages/styleguide/)
  • If applicable, new tests have been added or an issue has been opened to tackle that in the future.
    (Indicate issue here: # (issue))

@emmuhamm emmuhamm self-assigned this Mar 26, 2026
@emmuhamm emmuhamm force-pushed the emmuhamm/auto-class branch from 84500be to 95c9dfe Compare April 15, 2026 15:00
@emmuhamm emmuhamm marked this pull request as ready for review April 20, 2026 11:08
@emmuhamm emmuhamm requested a review from PawelPlesniak April 20, 2026 11:09
@emmuhamm
Copy link
Copy Markdown
Collaborator Author

Hi @PawelPlesniak, this is my pet project and I've gotten it working quite nicely I think.

It should also automatically work for drunc.

Let me know what you think

@emmuhamm
Copy link
Copy Markdown
Collaborator Author

Commits from 399637c to cefebef are to support DUNE-DAQ/drunc#897

It was noticed that importing the CONTEXT_SETTINGS from the logging framework lead to daqwpytools basically importing everything thats required for the logging. Unofrtunately, this included erskafka, which in the github actions is not installed.

To remove this dependency, the formatting script was basically refactored to now have a utils folder which main purpose is to load the configs found in an inii file, adn then using that independently in the logging frameowrk and in the uml pmodule. This means that running the uml generator no longer requires any dependency on the ersikafka

@PawelPlesniak
Copy link
Copy Markdown
Collaborator

Thanks @emmuhamm, this is a great tool! I ran a few tests to get a complete idea of the requirements, and see

daqpytools-generate-uml -d drunc --output-directory drunc_pics --split drunc

works, but the output-directory option is relative to the directory option. This would be worth specifying in the help string.

I checked repos that are not locally installed, and it worked. I used the following to test

daqpytools-generate-uml runconf_ui --split

I ran MSQT just to make sure that the changes here do not affect the core code, and happily, all is well.

Copy link
Copy Markdown
Collaborator

@PawelPlesniak PawelPlesniak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice tool, thank you!

@PawelPlesniak PawelPlesniak merged commit ac4243c into develop May 8, 2026
3 checks passed
@PawelPlesniak PawelPlesniak deleted the emmuhamm/auto-class branch May 8, 2026 13:57
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.

[Doc]: Automatic documentation construction

3 participants