Skip to main content

Mermaid diagram generator for Python code.

Project description

pymermaider

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.

License: MIT

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

Ensure you have Rust installed on your system. This project is not currently available as a crate or binary, so it'll have to be compiled on your machine with cargo build --release. You'll find the executable in ./target/release/

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

Uploaded Python 3 Windows ARM64

pymermaider-0.1.0-py3-none-win_amd64.whl (1.8 MB view details)

Uploaded Python 3 Windows x86-64

pymermaider-0.1.0-py3-none-win32.whl (1.7 MB view details)

Uploaded Python 3 Windows x86

pymermaider-0.1.0-py3-none-musllinux_1_2_x86_64.whl (2.1 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ x86-64

pymermaider-0.1.0-py3-none-musllinux_1_2_i686.whl (2.1 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ i686

pymermaider-0.1.0-py3-none-musllinux_1_2_armv7l.whl (2.0 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ ARMv7l

pymermaider-0.1.0-py3-none-musllinux_1_2_aarch64.whl (2.0 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ ARM64

pymermaider-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

pymermaider-0.1.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.3 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ s390x

pymermaider-0.1.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.2 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ppc64le

pymermaider-0.1.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (2.3 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ppc64

pymermaider-0.1.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (2.2 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ i686

pymermaider-0.1.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.0 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARMv7l

pymermaider-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

pymermaider-0.1.0-py3-none-macosx_10_12_x86_64.whl (2.0 MB view details)

Uploaded Python 3 macOS 10.12+ x86-64

pymermaider-0.1.0-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (3.9 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.0-py3-none-win_arm64.whl.

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 34d79541e8ab679ad03d34f85e844e63e5bb69152f97e3baff1ebf4e9fd4059b
MD5 5db49c91075ccbe581ca6b48374ffb34
BLAKE2b-256 91d18cc7689b6a4ee26752dbaf055baffc936f6bab4f6294f65a6467ddd9e7e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 1ab42f1924255cbc3867bbfc703015fca17f87ca887eae163f818511311dbcca
MD5 60c6d5a678e965d32d4124e464a69778
BLAKE2b-256 fe1cef507485393589520b3a06c138626b890f84c0f026b56c246d2323014f5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 904331276b2ad5e2df3a96d48dd917c90256747987b6429dc88fb878723fc9d5
MD5 4f36b040f8a68795d1b0e356a61c4bd6
BLAKE2b-256 1a653d9928031e121f8e097663285efb8c97877c38c072aad26f963822b784c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9303e0a888cd8facf66e7f4842b466cd3d3ba9877fc25140253612e313c07fe1
MD5 86b6ec6bd18ccfff00ec2778db12677d
BLAKE2b-256 d609c965f226e012e737d0fbf364e8be292ccf364ee0252bf399748f6514b7f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 5a1f257aec86f449167e7449e761f1fd9f0f96fd98bfc62c249c4455fa5cf3e9
MD5 51bfd6c7088b5941da67bb416695ed73
BLAKE2b-256 ff7038a122abc3e6eab3f6316aa00a273cf0c2a5c70b22e2dd606a57805515b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 cca89ba3f10f02c58f8fc3f1010e032a3acd6d208fb511b8b3cf08eddfcf7f38
MD5 3d63c1731df44177593d21128db7ef6b
BLAKE2b-256 b6cd1e97bfdaa9d0e97cc9c3b5b0d6ba10f3fdb399b6fc9abdea223b7f8ea9de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 385bd9cdf79dc4c497b5810816f35725ac84ed282139afbfcde79d81f839940d
MD5 c3969d2b41d7431a361b01f08d230a9f
BLAKE2b-256 9c6cc5f6c31e4c1a384643fa3bf9f93f1a29d836a0f0b0c33c3988c75ec4af47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 549f23804c34c782b9bb1c60594660452f23ea27f27b1d610ef711a85df13d45
MD5 6c482971b46aa1c878c4b0974333dedc
BLAKE2b-256 91c85a70b25d22e155fe7a98d984297418fa69ba24739ff6d754dffe120af61f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 1648c7c32f9ee91a16894562c53b0ce4ae5c3b6ad6c39759f61c988eb86d59df
MD5 6e60bce4e84eada5104af1129e5f227a
BLAKE2b-256 59c69713ac343d05c2f1734c55dfeb28b6411e9f5de28e15a902c0998faf3e64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 46a330bec1e2ccd908142d6e8ee8cef1038634cb1b1b337c950c8b85574e7bf3
MD5 8dd59a66e3d03289e4368f48d44f99e4
BLAKE2b-256 2c502b8f7ba207a6c13c15f2b590794bd71fc07fbf9eb11fb89dbf66d1552a97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 3cda0c523f95f61d8043c5c1ac0c8fa631762b357cebc6932c2370862e6325c9
MD5 9a08300281c44bef498ebc819f11a167
BLAKE2b-256 60302323c5aacdb104196ed351341145a3948800f04c9aa0fb1afec35f5af046

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 34216d6f1663b5f5dfb34b1ccf146c7a2629c4e57ae17f09eb09d00789d4704d
MD5 bcdcb1550e182f92d4bcb9b338d81507
BLAKE2b-256 25e683e6acc7c46d7ffab804717029164e82add5abe472e6274f0421d0886cf2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 4a5747bcef04dc1cffd801a585322c82e315d0dec8b79d86799fac038cac565f
MD5 5a31fd3a3db6185f9a5137f5302a7a8a
BLAKE2b-256 4d44493223c8231247b93b6e1b012f87700670ea2fb528b36c40abff34835da4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 103e66c71eb0f6432506e02d1e7d9b58fecdf8dfb79aee0ca2e2b3d73270fd90
MD5 c92705c5612d2810462a2c536580fd83
BLAKE2b-256 6c111a9976c9b9ce6f09620c8bc12990efecc8b551d16f62888f9a8d1cb1a958

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymermaider-0.1.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2af3df23e966ae6608097bfa204d4d87fd9df71554fb6c1f5c1c378de94db702
MD5 f1e0789f45f13ddb21ffefd53667aa57
BLAKE2b-256 3de56f117c711ebbdff9b6d4e1db58e87dd7ba78aa3a7d5378c4793766f9cc2a

See more details on using hashes here.

File details

Details for the file pymermaider-0.1.0-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.0-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 cc4cb728c067bd4cf4d52b023a81b0cbc89d68815dc5de79427e80384017eaae
MD5 005d42b5852f69e7413efbf2f84c4e5f
BLAKE2b-256 eefb25f093cd396c3277ff08b1331d456327fc388d754d6a835bb44ec8587665

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