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.2-py3-none-win_arm64.whl (1.6 MB view details)

Uploaded Python 3 Windows ARM64

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

Uploaded Python 3 Windows x86-64

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

Uploaded Python 3 Windows x86

pymermaider-0.1.2-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.2-py3-none-musllinux_1_2_i686.whl (1.7 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ i686

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

Uploaded Python 3 musllinux: musl 1.2+ ARMv7l

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

Uploaded Python 3 musllinux: musl 1.2+ ARM64

pymermaider-0.1.2-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.2-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.2-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.2-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.2-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.2-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.2-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.2-py3-none-macosx_10_12_x86_64.whl (1.7 MB view details)

Uploaded Python 3 macOS 10.12+ x86-64

pymermaider-0.1.2-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.2-py3-none-win_arm64.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 963704c9911273ef43cbb25c2de0a773ea511d602fa0c92e6068227c7bed1cae
MD5 982647692165aea232469ac67dc41e90
BLAKE2b-256 885b265bd420bfcb4b1038974e9b26f206731f794faa976365b58cabeefc680b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 e1125571b234f80e10a27bda90ffbdc59f39fda6a73d27713461af5c3367c1d5
MD5 626d88d8d46dec1f6ea24023e458ef5d
BLAKE2b-256 0588cd8923263a4eaba711cf1bce9b71b7743102a22fe453b2f4d09ae08c9760

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-win32.whl
Algorithm Hash digest
SHA256 80c8c6e36e0a84f027be73b74a6d4610fdaf90c7329d1e417bf2f3546f1a7324
MD5 e9c1ff21b3d557a54122ea94a209c289
BLAKE2b-256 919f24234f8dc349a41cf7e507b9be3cbee66cc9e2988a89c941f85e46a1d589

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f5f264af1eec95baafb4799d04d514839a6be0500c058d43892e0ac31ea2d66d
MD5 29c6dbeaff1bf4c4ce52b2b8f4be962f
BLAKE2b-256 5f9a864fe3391b0659b3868b6d5f3eeceadd31584fb278f4cd7afdc51c42e53e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 bc77391f78449941ae15c1ce5835810e025eb60a3cf25c06861b8cdf7251691b
MD5 b23681f6f1a541f37e539ccecbf41714
BLAKE2b-256 cd822c38a9c0114b0427ba437e96fcb4c1b4fab445dea45a35ced01dae6f0f49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 f887a46b78dd48a4c4cdba42a36b55efd2c18c2a20fed6ab275e703e58439bf0
MD5 39099d02e2bf1b8edd45ce9e8c8ff2c0
BLAKE2b-256 ed459771c3cc16160718efdf8b3f3b59147e09f66c85a4bb8dc6d9a9197647a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a24171793443adb91df976b5b432a692758d2ad9e85064964d545cccacaf1fe2
MD5 2310b98a37a4a6b7b01841044c474767
BLAKE2b-256 6673fc0247ffc0cbc42b9e4221951168e1c754ada8c0a7dc5dac4ef89d2c39e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 484aa691a966cfab49fbc0be6ebef50088e74276972a6327c030f64ffdf4ded5
MD5 2cc7b6357efd9366a19323a6946c3c1d
BLAKE2b-256 ffcb9300bf9c1cae9eb4bd344968c88877fb8987d10374e41d562a1898545b44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 2618d044e5caf199106ce2ce3699ea7c3625ea5c58430fa8188e80e3e6df2d63
MD5 cea4cf9071f55693ff28a1b66e8c0dc2
BLAKE2b-256 73bfc5b22aae5da1788a25a8a411053084ad8342f7ae852bd8949922d060985a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 d91c9452b30f76ab8364ff406700f346f5b075c74540e7c4f9749bf1a9327d58
MD5 28d2484f5500ead2302ed6c0fc6a68ca
BLAKE2b-256 6a944be46e6a5e5ab29f66c3f335160b70d39447687a23dabc2eaa9ac6ad7328

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 439e20fd8c374913d5fcc185528d5810d3d40df796ea015b22a1eba78a9429b5
MD5 d2bd09b113b27993c6c1d6e8fa644865
BLAKE2b-256 8b7cde191f99c3086094a2923b8b44b17dc0a20b5358c0badf8f6b93b1b8b627

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 29d9594bca6f91fb8d9486387e1e7d8089c7f4fe5b4f792e8394f76df5ff865f
MD5 33cad9fdef404b49e90880ff1c038ab9
BLAKE2b-256 462c8e0d14902ff978b8f91e09978e6c650412a57b6af8b2da6e68fd684d4692

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 02b10676c63fe53aaa8604dc49be3b62853bdce9443dab13440fe026abfce386
MD5 22b8f5773a26d88215945af49e86e73c
BLAKE2b-256 3f02da4f886d453bf89173bdd4cc585ad5db8f120c7d406dc133494d73880725

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f4b7737bfab1a86194dd8299e3da825c43d446a7ffa35336cb8fa4e7e7e70f30
MD5 036ed414b11a7c7b37b4f5a4ece6e61b
BLAKE2b-256 48b5b349c48c78ed2030edeeb879094be8aed5421c4198457b00dba64e84dce2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.2-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 305ba150cb2a24fd179db5830888439a0f7d00370cbe11cfd22a962a33249a74
MD5 0b1dc27c1abb17d768ea65e2af309478
BLAKE2b-256 635ba51c190d50ee7f5866bd08b3d58d91f2cd30cf17fefd2455ddc57b35e507

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.2-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.2-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 6aa398e29ea3e9810b1d7ff0d84258ab30f7025a5f93a8cd2747282abc94a649
MD5 b4d9e71eb40888b52b589d46469741f1
BLAKE2b-256 12c8eba8595a5177d182757ba041eadca87f6709153efbd2b20259aa947d564c

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