pymermaider
Try the online pymermaider playground! powered by WebAssembly 🎉
pymermaider is a tool written in Rust designed to generate mermaid.js class diagrams from Python code. By analyzing Python code, pymermaider automatically generates mermaid.js-compatible diagrams that represent the class structures, including classes, methods, attributes, and their relationships. This tool aims to simplify the documentation process for Python projects, making it easier to visualize class hierarchies and relationships.
Features
- Automatic Class Diagram Generation: Generate detailed class diagrams from Python codebases with minimal configuration.
- Mermaid.js Compatibility: Outputs diagrams in mermaid.js markdown syntax, ready to be embedded in your markdown documents or rendered using mermaid.js tools. GitHub supports this natively as you'll see below!
Installation
pymermaider is available on PYPI:
# With pip.
pip install pymermaider
# With pipx.
pipx install pymermaider
Usage
pymermaider [OPTIONS] <PATH>
Arguments
<PATH>Path to a file or directory. Use '-' to read Python source from stdin.
Options
-
-m, --multiple-filesProcess each file individually, outputting a mermaid file for each file. Only used when path is a directory. -
-o, --output-dir <OUTPUT>Output directory for mermaid files. [default: ./output] -
--output-format <OUTPUT_FORMAT>Output file format. [default: md] [possible values: md, mmd]mmdmay become the default in the future, depending on user feedback
-
--output <OUTPUT>Output file path. Use '-' to write to stdout. Not compatible with--multiple-files. -
-h, --helpDisplay help information for the command. -
-V, --versionShow the current version ofpymermaider.
File Selection:
--exclude <FILE_PATTERN>: Excludes specific files and/or directories from being analyzed.--extend-exclude <FILE_PATTERN>: Similar to--exclude, but adds additional files and directories to exclude on top of those already specified.
Example for --extend-exclude:
pymermaider /path/to/dir --extend-exclude "**/tests/*,**/docs/*"
This command will exclude any folders within the subdirectories of /path/to/dir that are named tests or docs.
Export raw Mermaid to .mmd:
pymermaider /path/to/dir --output-dir ./output --output-format mmd
I/O Examples
# py file -> stdout
pymermaider my_file.py --output -
# stdin -> stdout
cat my_file.py | pymermaider - --output -
# py file -> file (raw Mermaid)
pymermaider my_file.py --output-format mmd --output diagram.mmd
# directory -> stdout (single combined diagram)
pymermaider ./my_project --output - > diagram.md
NOTES:
- Some codebases are so massive that processing the directory into one file will result in mermaid code that's too large to render. By default, it's 50,000 characters. This is a good reason for the
-mflag. You can break class diagrams apart more easily into multiple renderings.
Example
Given a Python file example.py with the following content:
class Animal:
def __init__(self, name: str) -> None:
self.name = name
class Dog(Animal):
def bark(self) -> str:
return "Woof!"
Running pymermaider on this file will provide:
classDiagram
class Animal {
- __init__(self, name) None
}
class Dog {
+ bark(self) str
}
Dog --|> Animal
Future Additions
- Import/type resolution powered by ty
- More language support, maybe?? 😳🤔
Known Issues
- methods with property-setter decorators can be confusing in the output
Contributing
Contributions are more than welcome, just make a PR and we'll go from there!
License
This project is licensed under the MIT license. Please see the LICENSE file for more details.
Metadata
Release files for pymermaider 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 35.3 MB
Release files / pymermaider-0.1.6-py3-none-win_arm64.whl
| Download URL | pymermaider-0.1.6-py3-none-win_arm64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
2f03d411aae3c0e7e221165d670eff2dcbe63e6ecc5af5c424bf9ca859cf5d01
|
|
BLAKE2b-256 checksum How to use checksums |
3e6a09fcb76aee008a65a8c1fa2f47171baabe0ce68b7da1ebb54839260560a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-win_amd64.whl
| Download URL | pymermaider-0.1.6-py3-none-win_amd64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
7a77ceb982ebb685eb11209b84340af5cea8d83de6876f7dc86b222d617e5f61
|
|
BLAKE2b-256 checksum How to use checksums |
c41d4d27f47e6ec5dd63b17bdba0b5c0d7641dd591c6f3335f0cfc213285e8bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-win32.whl
| Download URL | pymermaider-0.1.6-py3-none-win32.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Python 3 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
eedf8d26b0a21ad60d09af0d625c93d8cd78800ed7f14be1f0b303dc9a75b565
|
|
BLAKE2b-256 checksum How to use checksums |
0f2fa51742258631f3a3b8b4b452d843cda14a95022636c04a7705a39e976cc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-musllinux_1_2_x86_64.whl
| Download URL | pymermaider-0.1.6-py3-none-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | Linux musl 1.2+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
3d2c1692b09f8bf05fbfc0236355866c75e00a3db29cbd599aa08f34462586f6
|
|
BLAKE2b-256 checksum How to use checksums |
694def49ef341e29806c7824f72f511e1f7422dfb6b26d73c5d2f2500fbc562e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-musllinux_1_2_i686.whl
| Download URL | pymermaider-0.1.6-py3-none-musllinux_1_2_i686.whl |
|---|---|
| Size | 2.1 MB |
| Tags | Linux musl 1.2+ x86-32 Python 3 |
|
SHA-256 checksum How to use checksums |
d2257055422aaa798aa40c868b65525f1f93df6cb08beb1d49b78aa405479e6e
|
|
BLAKE2b-256 checksum How to use checksums |
ca24a65fde187d4c283535e6abe2927886be703af133f95417fe989c9c4a5da7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-musllinux_1_2_armv7l.whl
| Download URL | pymermaider-0.1.6-py3-none-musllinux_1_2_armv7l.whl |
|---|---|
| Size | 2.0 MB |
| Tags | Linux musl 1.2+ ARMv7l Python 3 |
|
SHA-256 checksum How to use checksums |
a187d3c026d5262bba0f9cc299fbe27af768416c3d0ebda40dabb17130d132ba
|
|
BLAKE2b-256 checksum How to use checksums |
43fae92661c51170e2662965f88ce94716a71094531f507914d0be813390b8a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-musllinux_1_2_aarch64.whl
| Download URL | pymermaider-0.1.6-py3-none-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | Linux musl 1.2+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
5145da900032ea319976eaf39c907519dd47a03b4f0d9325045d527891604afd
|
|
BLAKE2b-256 checksum How to use checksums |
ae8788cdc113dd6903d710146848a7ed19412568054f9e452fb4fb46c7da79c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pymermaider-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
677027348574c89d5de7701698a56f6ef0277ffaa9c6f00b390caaf11ab9648d
|
|
BLAKE2b-256 checksum How to use checksums |
55cb52ff884c418dcbf5f97db2f49c5f5a00ab7a29acc10f4bb6fc14a92a38ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
| Download URL | pymermaider-0.1.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl |
|---|---|
| Size | 2.2 MB |
| Tags | Linux glibc 2.17+ IBM System/390x Python 3 |
|
SHA-256 checksum How to use checksums |
fbfe36dd41842a01d6cd71645b1231d9a2dddb6004155a8d5af9173d86595155
|
|
BLAKE2b-256 checksum How to use checksums |
f0a9a3a6931c4fde06db59712ac7807be37a69fbf0b025391868e511a8b46186
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
| Download URL | pymermaider-0.1.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl |
|---|---|
| Size | 2.2 MB |
| Tags | Linux glibc 2.17+ PowerPC 64-le Python 3 |
|
SHA-256 checksum How to use checksums |
7ceadc05ba54beaf856275ad3f37a4d8d970829a6f64b4f7c60b3075a8bd06a9
|
|
BLAKE2b-256 checksum How to use checksums |
fc4de0b7d40eff409a235ada43f38fdebb2d582956e1b1ebe9a4cec06371e28a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
| Download URL | pymermaider-0.1.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | Linux glibc 2.17+ PowerPC 64-be Python 3 |
|
SHA-256 checksum How to use checksums |
297050894bc901e21ea571be271f4c056b5f6664e0715e3e50dc7f4d4ebdf36e
|
|
BLAKE2b-256 checksum How to use checksums |
9eeb4e001b0621f6898343c46aa19b2bc5bd4c76ce848ec0ac173c0da4d0f39c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | pymermaider-0.1.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 2.1 MB |
| Tags | Linux glibc 2.17+ x86-32 Python 3 |
|
SHA-256 checksum How to use checksums |
621eca3c4edb7922f48654cb7c858fa905b3f362e7932b58cb713c327207c63b
|
|
BLAKE2b-256 checksum How to use checksums |
566f4d166d963f536d00ed3745caa102d0221363473330b45a1f9133cff37f68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
| Download URL | pymermaider-0.1.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl |
|---|---|
| Size | 2.0 MB |
| Tags | Linux glibc 2.17+ ARMv7l Python 3 |
|
SHA-256 checksum How to use checksums |
6f9a1f424d2b595e185e0f182b21504be0df606b7c35ae75f75b781d0a14b020
|
|
BLAKE2b-256 checksum How to use checksums |
f7849f7bdac92eadf8645275d33f565b65b90ab5372f4fd2b912db52337c32b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pymermaider-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
36aeb5a3003451121129d5b6026f4087d78604761f8e014edd6aed795d043ed2
|
|
BLAKE2b-256 checksum How to use checksums |
bfd8cdab501efb868c4eb7545a56d5ed3e888239bf79220811e019a479f74983
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-macosx_10_12_x86_64.whl
| Download URL | pymermaider-0.1.6-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
c2d58663e3abb001c540e00d8699dd0f4fc3e9e8479998730a74e9f566ac885a
|
|
BLAKE2b-256 checksum How to use checksums |
7141244080105e131c0646ddcac87138c91940cceb5899e6879f714561c5beca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / pymermaider-0.1.6-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | pymermaider-0.1.6-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 4.0 MB |
| Tags | Python 3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
49339b433b4a216c4fc53787127703eb5809c543e3901f4166e94bb606f6a998
|
|
BLAKE2b-256 checksum How to use checksums |
bd8238028d65f8097e8fc59da3e13173d32147d1cfaf7a2e5dec4b1d2dd59304
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Security for pymermaider 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.