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

Uploaded Python 3 Windows ARM64

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

Uploaded Python 3 Windows x86-64

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

Uploaded Python 3 Windows x86

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

Uploaded Python 3 musllinux: musl 1.2+ i686

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

Uploaded Python 3 musllinux: musl 1.2+ ARMv7l

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

Uploaded Python 3 musllinux: musl 1.2+ ARM64

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

Uploaded Python 3 macOS 10.12+ x86-64

pymermaider-0.1.1-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (3.3 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.1-py3-none-win_arm64.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 3e8b9414fa1ca3b40b227c7cf04e83ffcf6e52f62b7d97a3376b909a089ea9b2
MD5 06fdc51ac51321af4d35db834ddbb306
BLAKE2b-256 9f8e5732e6760d2300aab17e86ae712d760dda65b632634deca22cefe7c938aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 e0300382146bbbee516fca18d6cf5c23c005c65593c8f8043624230895a869df
MD5 87ddda3de046de64b7bca65fa41dadc7
BLAKE2b-256 3fbe3a2e072a9ea059936bcc3d2fd8b9f7632d3b75dabc32797c62511d658d7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-win32.whl
Algorithm Hash digest
SHA256 f67e59e33df7c8529f4f375943f1c81ce45fb9ac4b80f5bd6491149a1b26a016
MD5 e638ac868a3c18cff00920d6c5071f24
BLAKE2b-256 6cd5704dac4681a6bfcb531e939daf28a5f931da4ad69901c117cc2f562fecb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 29e99637b6d67ab17a5e7ca21da741a67583bbaaa4a236f543ce1e4716acb718
MD5 b331216870a54426c5776d177b8e1da2
BLAKE2b-256 c88994665235bdea6271d7cc295937e08b7b73865b56dc72f2f698b4e16c1689

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 1a3da5b9c103e6afd6677ff74b298764a225cf4ca44de27c44b816fa331e884b
MD5 0e0c98d97790ea2973629c9f85b2699d
BLAKE2b-256 3bfa17711abc1c40da8e3a6d6e14f6c9bd109139b99221e5bc5c1f5a354acc92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 27ddd9d81201136713b0593d4eb974fa028442aa74b3ead4f580a1cf2f8b02d6
MD5 7f793a1e60664f15fd04c051eabf5864
BLAKE2b-256 84d4b2dcfc43c7ae89d68a2d9baa667bfe8131e74edb3e95c0690f730cf8ec8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 9e3da1efdc6a70ad03c95e5e3cf47be927230e5c3d389ba470e688494da1b566
MD5 d1caec672e8486cf0daf2237b19f50e3
BLAKE2b-256 61a0067dc5a55085e4ab0458f7057b7ff290047d32a2e3aff6eb604987d20bfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 61d0fbbb0d4422f2920ebfa7da9f56d0449c76413556429256aa84954e2639e8
MD5 4c0c68ca0d9a764909acf58ba6cfd440
BLAKE2b-256 105160bd9942b5888b599d6d3a12d449979133f49c2dd5759c21f3a62c15b446

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 2464c1e294904bf5835458af0a8d101a00ad32e49309f7ab9511c1199a79bb68
MD5 423835082d36a7ee80bed30ccf29e69d
BLAKE2b-256 083a1741f06e5cbffdffe713cd11654c41ce4abb93a9a253294fdb8fc0926293

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 4fdf37adc5d0393dc4272c061697d4a2045e33713e26e841dfe34e56c79fa516
MD5 7039c449a26f087f088588fe7a4822aa
BLAKE2b-256 fbd3f94b6936c7a3c4087b1dcf39b99de968e83398b14097d09de2e21adcdc26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 91beb93104ed1c8672ee218d4d49badaf6ea95d3fe3911de24255ea1ac017727
MD5 90b4ae86a22c8d3c2d4ca82bb9ffbbb6
BLAKE2b-256 0a902a5560cadaa904159aac8fabbd08f588d3375911c8e14cdd514e4cfd9d28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 2c11a73935a08bc75f7e23f1190a99dca1ec1d79718ba5fff3fa6f0b5f601978
MD5 608b700f07b7992867c48b8d992dc5cc
BLAKE2b-256 94603424b334947fa81b5832ea64c34e4209f1c69818432a69899c14e2eb1294

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 83d71e1f4287bb5e5fd6bd5f226967d0a0fba34221af247339769cab7d3d61f5
MD5 4b0cd140f49f05e6f47eb8d1d5285a65
BLAKE2b-256 919d7d4adcf3e78836bb78203e040177229d9af0814a2e3bb9b86a58b4d24cb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3bae525eb7566e8d4e3f7ea688be0f57d25121e28e310542a7515f01e23fd6d5
MD5 206725b2a82016085f174cef4c9a8b7a
BLAKE2b-256 db51572c89c9f8809d58794c5c596dc72e8761fe0e5482c5bbd3e5657b00e658

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.1-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fda8fd9120eaaa1405c328e50b25cd113e50c1cd1f222f592038a8a09ba1a9e5
MD5 7494a8a6b53ae04466aef67a2fafe960
BLAKE2b-256 285950444cf573e22358477e278ce1d3ed516954f69359e8fdb986755e0cb44b

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.1-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.1-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 da0f9886ed0c11a13ba94ac80eb63969936cf4d3391dcd70f74637d94021a14c
MD5 29fe127a3c872226f3744006f2682c05
BLAKE2b-256 39063dbfa070429673235c520e88dc300caef2a5aea14733a97e152c419ed0b3

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