# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['py2puml', 'py2puml.domain']

package_data = \
{'': ['*']}

setup_kwargs = {
    'name': 'py2puml',
    'version': '0.3.0',
    'description': 'Generate Plantuml diagrams to document your python code ',
    'long_description': '<div align="center">\n  <a href="https://www.python.org/psf-landing/" target="_blank">\n    <img width="350px" alt="Python logo"\n      src="https://www.python.org/static/community_logos/python-logo-generic.svg" />\n  </a>\n  <a href="http://plantuml.com/" target="_blank">\n    <img width="116px" height="112px" alt="PlantUML logo" src="http://s.plantuml.com/logoc.png" style="margin-bottom: 40px" vspace="40px" />\n  </a>\n  <h1>Python to PlantUML</h1>\n</div>\n\nGenerate Plantuml diagrams to document your python code\n\n# How it works\n\n## Features\n\nFrom a given path corresponding to a folder containing python code, `py2puml` loads each file as a module and generate a class diagram with the [PlantUML](https://plantuml.com/en/class-diagram) using:\n\n* inspection to detect the classes to document (see the [inspect](https://docs.python.org/3/library/inspect.html) module)\n* annotations (the python type hinting syntax) to detect the attributes and their types (see the [typing](https://docs.python.org/3/library/typing.html) module)\n* fields for classes derived from namedtuples\n* composition and inheritance relationships are drawn only between the domain classes (this is designed on purpose, for documentation sake)\n\n## Current limitations\n\n* type hinting is optional when writing Python code and discarded when it is executed, as mentionned in the [typing official documentation](https://docs.python.org/3/library/typing.html). The quality of the diagram output by `py2puml` depends on the reliability with which the type annotations were written\n\n> The Python runtime does not enforce function and variable type annotations. They can be used by third party tools such as type checkers, IDEs, linters, etc.\n\n* complex type hints with more than one level of genericity are not properly handled for the moment: `List[MyClass]` or `Dict[str, MyClass]` are handled properly, `Dict[str, List[MyClass]]` is not. If your domain classes (also called business objects or DTOs) have attributes with complex type hints, it may be a code smell indicating that you should write a class which would better represent the business logic. But I may improve this part of the library as well 😀\n\n* `py2puml` does not inspect sub-folders recursively, but it is planned\n\n* `py2puml` outputs diagrams in PlantUML syntax, which can be saved in text files along your python code and versioned with them. To generate image files, use the PlantUML runtime or a docker image (see [think/plantuml](https://hub.docker.com/r/think/plantuml))\n\n* `py2puml` uses features of python 3 (generators for example) and thus won\'t work with python 2 runtimes. It relies on native python modules and uses no 3rd-party library, except [pytest](https://docs.pytest.org/en/latest/) as a development dependency for running the unit-tests\n\nIf you like tools around PlantUML, you may also be interested in this [lucsorel/plantuml-file-loader](https://github.com/lucsorel/plantuml-file-loader) project: A webpack loader which converts PlantUML files into images during the webpack processing (useful to [include PlantUML diagrams in your slides](https://github.com/lucsorel/markdown-image-loader/blob/master/README.md#web-based-slideshows) with RevealJS or RemarkJS).\n\n# Install\n\nInstall from the github repository:\n\n* with `pip`:\n\n```sh\npip install py2puml\n```\n\n* with [poetry](https://pipenv.readthedocs.io/en/latest/):\n\n```sh\npoetry add py2puml\n```\n\n* with [pipenv](https://pipenv.readthedocs.io/en/latest/):\n\n```sh\npipenv install py2puml\n```\n\n# Usage\n\nFor example, to create the diagram of the classes used by `py2puml`:\n\n* import the py2puml function in your script (see [py2puml/example.py](py2puml/example.py)):\n\n```python\nfrom py2puml.py2puml import py2puml\n\n# outputs the PlantUML content in the terminal\nprint(\'\'.join(py2puml(\'py2puml/domain\', \'py2puml.domain\')))\n\n# writes the PlantUML content in a file\nwith open(\'py2puml/domain.puml\', \'w\') as puml_file:\n    puml_file.writelines(py2puml(\'py2puml/domain\', \'py2puml.domain\'))\n```\n\n* running it (`python3 -m py2puml.example`) will output the PlantUML diagram in the terminal and write it in a file\n\n```plantuml\n@startuml\nclass py2puml.domain.umlclass.UmlAttribute {\n  name: str\n  type: str\n}\nclass py2puml.domain.umlclass.UmlClass {\n  attributes: List[UmlAttribute]\n}\nclass py2puml.domain.umlitem.UmlItem {\n  name: str\n  fqdn: str\n}\nclass py2puml.domain.umlenum.Member {\n  name: str\n  value: str\n}\nclass py2puml.domain.umlenum.UmlEnum {\n  members: List[Member]\n}\nenum py2puml.domain.umlrelation.RelType {\n  COMPOSITION: *\n  INHERITANCE: <|\n}\nclass py2puml.domain.umlrelation.UmlRelation {\n  source_fqdn: str\n  target_fqdn: str\n  type: RelType\n}\npy2puml.domain.umlclass.UmlClass *-- py2puml.domain.umlclass.UmlAttribute\npy2puml.domain.umlitem.UmlItem <|-- py2puml.domain.umlclass.UmlClass\npy2puml.domain.umlenum.UmlEnum *-- py2puml.domain.umlenum.Member\npy2puml.domain.umlitem.UmlItem <|-- py2puml.domain.umlenum.UmlEnum\npy2puml.domain.umlrelation.UmlRelation *-- py2puml.domain.umlrelation.RelType\n@enduml\n```\n\nWhich renders like this:\n\n![](https://www.plantuml.com/plantuml/png/ZP91IyGm48Nl-HKvBsmF7iiUTbaA1jnMQZs9I7OxIY19Qp8H5jV_xZIse5GsFULrQBvvCozRZz9XC9gTjFIUz-URdhwojZDIsOnah6UFHkyGdJe61Fx9EBVIGCuzEj9uxaVzbSRi1n4HSWBwdDyfZq-_cpnVOIa4Cw04dJCph--jJPa16qns07C4Dxl_8NM0HG1oKD0P2IR2fa5-qCC8mu__t7UW9QhEPZNeXhON6VlgS5yzY4PKPSvNL13bRL6BPbVkYvnlBdC_SnvvgaSTcRuBxWGlSIbJMjAz0SRItm17BzGc6TzglLxqL5WYlCs5GAbkBB5_CdCzuoKk4Y6pPJkFNj9niotObkhi6m00)\n\n# Tests\n\n```sh\npython3 -m pytest -v\n```\n\n# Changelog\n\n* `0.3.0`: handle classes derived from namedtuples (attribute types are `any`)\n* `0.2.0`: handle inheritance relationships and enums. Unit tested\n* `0.1.3`: first release, handle all module of a folder and compositions of domain classes\n\n# Licence\n\nUnless stated otherwise all works are licensed under the [MIT license](http://spdx.org/licenses/MIT.html), a copy of which is included [here](LICENSE).\n\n# Contributions\n\n* [Luc Sorel-Giffo](https://github.com/lucsorel)\n\nPull-requests are welcome and will be processed on a best-effort basis.\n\n\n# Alternatives\n\nIf `py2puml` does not meet your needs (suggestions and pull-requests are **welcome**), you can have a look at these projects which follow other approaches (AST, linting, modeling):\n\n* [cb109/pyplantuml](https://github.com/cb109/pyplantuml)\n* [deadbok/py-puml-tools](https://github.com/deadbok/py-puml-tools)\n* [caballero/genUML](https://github.com/jose-caballero/genUML)\n',
    'author': 'Luc Sorel-Giffo',
    'author_email': None,
    'maintainer': 'Luc Sorel-Giffo',
    'maintainer_email': None,
    'url': 'https://github.com/lucsorel/py2puml',
    'packages': packages,
    'package_data': package_data,
    'python_requires': '>=3.7,<4.0',
}


setup(**setup_kwargs)
