erdantic


Nameerdantic JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryEntity relationship diagrams for Python data model classes like Pydantic.
upload_time2024-04-11 16:40:12
maintainerNone
docs_urlNone
authorJay Qi
requires_python>=3.8
licenseMIT License
keywords attrs dataclasses entity relationship diagram erd pydantic
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # erdantic: Entity Relationship Diagrams

[![Docs Status](https://img.shields.io/badge/docs-stable-informational)](https://erdantic.drivendata.org/)
[![PyPI](https://img.shields.io/pypi/v/erdantic.svg)](https://pypi.org/project/erdantic/)
[![conda-forge](https://img.shields.io/conda/vn/conda-forge/erdantic.svg)](https://anaconda.org/conda-forge/erdantic)
[![conda-forge feedstock](https://img.shields.io/badge/conda--forge-feedstock-yellowgreen)](https://github.com/conda-forge/erdantic-feedstock)
[![tests](https://github.com/drivendataorg/erdantic/workflows/tests/badge.svg?branch=main)](https://github.com/drivendataorg/erdantic/actions?query=workflow%3Atests+branch%3Amain)
[![codecov](https://codecov.io/gh/drivendataorg/erdantic/branch/main/graph/badge.svg)](https://codecov.io/gh/drivendataorg/erdantic)

> [!NOTE]
> erdantic v1.0 has been released! See the [changelog](./HISTORY.md) for more information.

**erdantic** is a simple tool for drawing [entity relationship diagrams (ERDs)](https://en.wikipedia.org/wiki/Data_modeling#Entity%E2%80%93relationship_diagrams) for Python data model classes. Diagrams are rendered using the venerable [Graphviz](https://graphviz.org/) library. Supported data modeling frameworks are:

- [Pydantic V2](https://docs.pydantic.dev/latest/)
- [Pydantic V1 legacy](https://docs.pydantic.dev/latest/migration/#continue-using-pydantic-v1-features)
- [attrs](https://www.attrs.org/en/stable/)
- [dataclasses](https://docs.python.org/3/library/dataclasses.html) from the Python standard library

You can use erdantic either as a convenient CLI or as a Python library. Great for adding a simple and clean data model reference to your documentation.

<object type="image/svg+xml" data="./docs/docs/assets/example_diagram.svg" width="100%" typemustmatch><img alt="Example diagram created by erdantic" src="./docs/docs/assets/example_diagram.svg"></object>

## Installation

erdantic's graph modeling depends on [pygraphviz](https://pygraphviz.github.io/documentation/stable/index.html) and [Graphviz](https://graphviz.org/), an open-source C library. If you are on Linux or macOS, the easiest way to install everything together is to use conda and conda-forge:

```bash
conda install erdantic -c conda-forge
```

If not using conda, Graphviz must be installed first (before you can install pygraphviz). For recommended options and installation troubleshooting, see the [pygraphviz docs](https://pygraphviz.github.io/documentation/stable/install.html). Then to install erdantic and its Python dependencies from PyPI:

```bash
pip install erdantic
```

### Development version

You can get the development version from GitHub with:

```bash
pip install git+https://github.com/drivendataorg/erdantic.git#egg=erdantic
```

## Quick usage

First, make sure that the data model classes that you want to include in your diagram are importable. This means the code with your models should either be available on your [`sys.path`](https://docs.python.org/3/library/sys_path_init.html) or installed into the same virtual environment as erdantic.

The fastest way to produce a diagram like the above example is to use the erdantic CLI. Simply specify the full dotted import path to your model and an output file path. The rendered format is interpreted from the filename extension.

```bash
erdantic erdantic.examples.pydantic.Party -o diagram.png
```

You can also import the erdantic Python library. This lets you inspect the diagram data and potentially modify it. You will have greater ability to customize the diagram in Python.

```python
import erdantic as erd
from erdantic.examples.pydantic import Party

# Easy one-liner
erd.draw(Party, out="diagram.png")

# Or create a diagram object that you can inspect and do stuff with
diagram = erd.create(Party)
list(diagram.models.keys())
#> [ 'erdantic.examples.pydantic.Adventurer',
#>   'erdantic.examples.pydantic.Party',
#>   'erdantic.examples.pydantic.Quest',
#>   'erdantic.examples.pydantic.QuestGiver']
diagram.draw("diagram.png")
```

Check out the "Usage Examples" section of our [docs](https://erdantic.drivendata.org/) to see more.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "erdantic",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "attrs, dataclasses, entity relationship diagram, erd, pydantic",
    "author": "Jay Qi",
    "author_email": "DrivenData <info@drivendata.org>",
    "download_url": "https://files.pythonhosted.org/packages/45/5e/b93b7d34be056a0699e65a13659b98491edc6a76a25aea06da9be3049840/erdantic-1.0.2.tar.gz",
    "platform": null,
    "description": "# erdantic: Entity Relationship Diagrams\n\n[![Docs Status](https://img.shields.io/badge/docs-stable-informational)](https://erdantic.drivendata.org/)\n[![PyPI](https://img.shields.io/pypi/v/erdantic.svg)](https://pypi.org/project/erdantic/)\n[![conda-forge](https://img.shields.io/conda/vn/conda-forge/erdantic.svg)](https://anaconda.org/conda-forge/erdantic)\n[![conda-forge feedstock](https://img.shields.io/badge/conda--forge-feedstock-yellowgreen)](https://github.com/conda-forge/erdantic-feedstock)\n[![tests](https://github.com/drivendataorg/erdantic/workflows/tests/badge.svg?branch=main)](https://github.com/drivendataorg/erdantic/actions?query=workflow%3Atests+branch%3Amain)\n[![codecov](https://codecov.io/gh/drivendataorg/erdantic/branch/main/graph/badge.svg)](https://codecov.io/gh/drivendataorg/erdantic)\n\n> [!NOTE]\n> erdantic v1.0 has been released! See the [changelog](./HISTORY.md) for more information.\n\n**erdantic** is a simple tool for drawing [entity relationship diagrams (ERDs)](https://en.wikipedia.org/wiki/Data_modeling#Entity%E2%80%93relationship_diagrams) for Python data model classes. Diagrams are rendered using the venerable [Graphviz](https://graphviz.org/) library. Supported data modeling frameworks are:\n\n- [Pydantic V2](https://docs.pydantic.dev/latest/)\n- [Pydantic V1 legacy](https://docs.pydantic.dev/latest/migration/#continue-using-pydantic-v1-features)\n- [attrs](https://www.attrs.org/en/stable/)\n- [dataclasses](https://docs.python.org/3/library/dataclasses.html) from the Python standard library\n\nYou can use erdantic either as a convenient CLI or as a Python library. Great for adding a simple and clean data model reference to your documentation.\n\n<object type=\"image/svg+xml\" data=\"./docs/docs/assets/example_diagram.svg\" width=\"100%\" typemustmatch><img alt=\"Example diagram created by erdantic\" src=\"./docs/docs/assets/example_diagram.svg\"></object>\n\n## Installation\n\nerdantic's graph modeling depends on [pygraphviz](https://pygraphviz.github.io/documentation/stable/index.html) and [Graphviz](https://graphviz.org/), an open-source C library. If you are on Linux or macOS, the easiest way to install everything together is to use conda and conda-forge:\n\n```bash\nconda install erdantic -c conda-forge\n```\n\nIf not using conda, Graphviz must be installed first (before you can install pygraphviz). For recommended options and installation troubleshooting, see the [pygraphviz docs](https://pygraphviz.github.io/documentation/stable/install.html). Then to install erdantic and its Python dependencies from PyPI:\n\n```bash\npip install erdantic\n```\n\n### Development version\n\nYou can get the development version from GitHub with:\n\n```bash\npip install git+https://github.com/drivendataorg/erdantic.git#egg=erdantic\n```\n\n## Quick usage\n\nFirst, make sure that the data model classes that you want to include in your diagram are importable. This means the code with your models should either be available on your [`sys.path`](https://docs.python.org/3/library/sys_path_init.html) or installed into the same virtual environment as erdantic.\n\nThe fastest way to produce a diagram like the above example is to use the erdantic CLI. Simply specify the full dotted import path to your model and an output file path. The rendered format is interpreted from the filename extension.\n\n```bash\nerdantic erdantic.examples.pydantic.Party -o diagram.png\n```\n\nYou can also import the erdantic Python library. This lets you inspect the diagram data and potentially modify it. You will have greater ability to customize the diagram in Python.\n\n```python\nimport erdantic as erd\nfrom erdantic.examples.pydantic import Party\n\n# Easy one-liner\nerd.draw(Party, out=\"diagram.png\")\n\n# Or create a diagram object that you can inspect and do stuff with\ndiagram = erd.create(Party)\nlist(diagram.models.keys())\n#> [ 'erdantic.examples.pydantic.Adventurer',\n#>   'erdantic.examples.pydantic.Party',\n#>   'erdantic.examples.pydantic.Quest',\n#>   'erdantic.examples.pydantic.QuestGiver']\ndiagram.draw(\"diagram.png\")\n```\n\nCheck out the \"Usage Examples\" section of our [docs](https://erdantic.drivendata.org/) to see more.\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Entity relationship diagrams for Python data model classes like Pydantic.",
    "version": "1.0.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/drivendataorg/erdantic/issues",
        "Changelog": "https://erdantic.drivendata.org/stable/changelog/",
        "Documentation": "https://erdantic.drivendata.org/",
        "Repository": "https://github.com/drivendataorg/erdantic"
    },
    "split_keywords": [
        "attrs",
        " dataclasses",
        " entity relationship diagram",
        " erd",
        " pydantic"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "29071df5b41c547fe729cd359dbd6aa17e6fdab5a50a1ce2bfaed1f22a44ae0c",
                "md5": "7ff302391aa8f8371dd3809bfdf7e2e4",
                "sha256": "c3166c9e179f7118370c249e772310c111a95e2f434eed7bc8ec4694a19af887"
            },
            "downloads": -1,
            "filename": "erdantic-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7ff302391aa8f8371dd3809bfdf7e2e4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 30300,
            "upload_time": "2024-04-11T16:40:10",
            "upload_time_iso_8601": "2024-04-11T16:40:10.078563Z",
            "url": "https://files.pythonhosted.org/packages/29/07/1df5b41c547fe729cd359dbd6aa17e6fdab5a50a1ce2bfaed1f22a44ae0c/erdantic-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "455eb93b7d34be056a0699e65a13659b98491edc6a76a25aea06da9be3049840",
                "md5": "d95d4423d376cbd7833564c507dfc334",
                "sha256": "97ff6fbe5c266f5b7c4a66d70858d6fcb0403478080e911f4ad3c7b9057ee793"
            },
            "downloads": -1,
            "filename": "erdantic-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d95d4423d376cbd7833564c507dfc334",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 813128,
            "upload_time": "2024-04-11T16:40:12",
            "upload_time_iso_8601": "2024-04-11T16:40:12.111471Z",
            "url": "https://files.pythonhosted.org/packages/45/5e/b93b7d34be056a0699e65a13659b98491edc6a76a25aea06da9be3049840/erdantic-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-11 16:40:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "drivendataorg",
    "github_project": "erdantic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "erdantic"
}
        
Elapsed time: 0.22944s