Skip to main content

Mermaid diagram generator for Python code.

Project description

pymermaider

Ruff image image image

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> The path to a file or directory to process.

Options

  • -m, --multiple-files When processing a directory, this option will generate an individual Mermaid file for each file within the directory.

  • -o, --output-dir <OUTPUT> Specify the output directory for the generated Mermaid files. Defaults to ./output if not provided.

  • -h, --help Display help information for the command.

  • -V, --version Show the current version of pymermaider.


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 -m flag. 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

  • Output directory option
  • Better output file naming convention
  • Import resolution (sorta-kinda implemented now, but not good enough or even used yet)
  • More language support, maybe?? 😳🤔
  • Sort classes with relationships to be grouped together
  • Test suites!

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pymermaider-0.1.3-py3-none-win_arm64.whl (1.6 MB view details)

Uploaded Python 3 Windows ARM64

pymermaider-0.1.3-py3-none-win_amd64.whl (1.7 MB view details)

Uploaded Python 3 Windows x86-64

pymermaider-0.1.3-py3-none-win32.whl (1.6 MB view details)

Uploaded Python 3 Windows x86

pymermaider-0.1.3-py3-none-musllinux_1_2_x86_64.whl (1.8 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ x86-64

pymermaider-0.1.3-py3-none-musllinux_1_2_i686.whl (1.7 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ i686

pymermaider-0.1.3-py3-none-musllinux_1_2_armv7l.whl (1.7 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ ARMv7l

pymermaider-0.1.3-py3-none-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ ARM64

pymermaider-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

pymermaider-0.1.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.2 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ s390x

pymermaider-0.1.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.9 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ppc64le

pymermaider-0.1.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (1.9 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ppc64

pymermaider-0.1.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (1.8 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ i686

pymermaider-0.1.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.8 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARMv7l

pymermaider-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.8 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

pymermaider-0.1.3-py3-none-macosx_10_12_x86_64.whl (1.7 MB view details)

Uploaded Python 3 macOS 10.12+ x86-64

pymermaider-0.1.3-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (3.4 MB view details)

Uploaded Python 3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64

File details

Details for the file pymermaider-0.1.3-py3-none-win_arm64.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 1930c3a2cfd448d75603300f10d0c46955b38d8b47a3ade9bba8a9e61112a9df
MD5 66c4272aeff9aad91ec5892d38ab8208
BLAKE2b-256 22942db8a54f22ba7ba6bcaebe462bd8250bd15298400f1386037c4b7dd81c27

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 05bbf39cbc3e11eb3cfafad2f7f104b61a5bdaef75c06bc4b27f359a88cc42ba
MD5 857659da658a2b03ed773fd926379eef
BLAKE2b-256 8b458e3783bdc69f69897b8f82d0ac6453461a8873af320d3e3c5d44bd886b47

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-win32.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-win32.whl
Algorithm Hash digest
SHA256 e6480832f9a3b58ddd73f0de320e000e0bb5472860a1c93041d421b972450e2c
MD5 4047e9955abe8a500b6d40616b093e75
BLAKE2b-256 3d3e955d32915f9fe50a4ab4eee04ccb2aafc93be58fa865f4b393d830e3bac2

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d18607ce33d600de6a1bb326077d8d2f6a43fa4f2381b68cb9186a8c46cd6987
MD5 6e27aad6872c71e23fe345f4635b79ea
BLAKE2b-256 476d8dbd2bb060e79c9699f3b806bc75c8ae434feb554a96b426796ee5db07f5

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 2997bc6c78ae099ed517169a6e76e9e811a35c7dc3e4326bef2c1ee341481178
MD5 77e3907015aafa8180e1c3d4e79061ca
BLAKE2b-256 9a6a2842e1b9c6119e8f3378075a4977a583c614015a78b4799c48aa496cd885

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 45d71ea066cfa48d9848d8c4194ba3ff3a07522f79b6db45ef5dcb4fadab89e1
MD5 7792dbcb768925278425c2f6f1f78899
BLAKE2b-256 070c15608e8f0cb79d8263869b5e9d51993b82c4e814255b5f8bcb54224a7604

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 504f81ad36b66f48757fb24bac82fd22e65175c8ab63b37371ef8d814873c518
MD5 f7a1131415db979298f645d16395850d
BLAKE2b-256 9e690c752e9a9cdfd1588898a0ca24fcdb6de6cf7d2f81827840ccc428d6a9d4

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bdc5b3f9fa41eed7816d31c9981f2ef57f079ce738790ede835a9643f2d24763
MD5 911e54bf0558493905923ddfeb3dfb51
BLAKE2b-256 63564f9fe146b8370ca928223b67d278faf8b0ac38cb94f89d24d7bdb26e7131

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 9ed4f257b9e030b5bb848f1db6b68c181ffe68024dcd95ae662ad4569df9a1df
MD5 f13b4e7f6b39ede5d34bd013858c4671
BLAKE2b-256 04ca09ffa9743927d773d6350e121efeaab759c93305827412c14cd1428e53db

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 c68d65252df5f7191bfd8454e312cf5fc8e9db847fd18a4ce84929fb261ecf54
MD5 3c85fedcfa881f8e4cff5aa72531774c
BLAKE2b-256 0b4d8c18b0ac4ad97865a758f50e39469c1ee4569d1210e8a9809d44b7aeb7d6

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 b2431b5063e9d4fa08258e6de6b555591667ebc5b7e7da560cde6b90a8dc2aeb
MD5 4238fe4a952297dfa7570bb23dd3ac8d
BLAKE2b-256 3d5aff2c258867fd8c5077967c6abd2e11efb8c58b9d461d1b0081db72806d08

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 325e6ddb0d16b3c549e65cdf64f1840eeb3d46db6dfb5970a3b4da53776ff56f
MD5 35d64fe8fe4d2ef597754afeb08ad38e
BLAKE2b-256 83e1618784dbb5def1a7eedba9ac05479de9724f555b54e2fad92dcba1e055af

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 df3deb4c38b6b956c88d4c2d353a85748dcaaa31c805b05310fb4f771a652bb3
MD5 bbfec7cc78949235830d88e381047e21
BLAKE2b-256 0213390bc56d9997dbe7261a106285205230bdd4a97ad52c43c3315ad65c4111

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 362e29d9f64d4a83bbb4bed6506e5243741cbd98613ae44976979a1a5d59812b
MD5 1875fda5240f4bf447f717bf64c57868
BLAKE2b-256 24295d93b37465ddfdb0debd0a4812f992185c0c47776671e9a3c953a4bed34d

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 27733a2d8ea5657b8d680db1d399470039db288df10cc3a04415a6c003d9721c
MD5 4cb822b8ea246b4246271dc9d475e04f
BLAKE2b-256 1d28fc14cfbad086e30678606439384bb4f4a260f6836308d152e04633572d3c

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.3-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.3-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b3659cb0d3c29da297750b463ecd10e8e58535a70cc9c7ab87cd2f16ea12d68f
MD5 78f5cb4097d883719629b8bbee510bec
BLAKE2b-256 179e04e02c68058594f51389b93f0ef0421625e78fcbd43479130edd8aeb31e5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page