# UML Class Diagram Generator


## Overview
The **UML Class Diagram Generator** is a powerful Python-based tool designed to automatically generate UML class diagrams from Python source code. It parses your Python files, extracts class definitions, methods, and attributes, and creates a structured UML diagram in XML format. This diagram can be easily visualized using tools like [draw.io](https://app.diagrams.net/).
This tool is perfect for developers and teams who want to quickly visualize the architecture of their Python projects without manually drawing class diagrams.
## Features
- **Automatic Class Parsing**: Detects and parses class definitions, including methods and attributes.
- **Import Resolution**: Automatically resolves and includes imported files within the specified package.
- **Interactive Command-Line Interface**: Guides you through selecting the base directory and main script for UML generation.
- **UML Diagram in XML**: Outputs the UML class diagram in XML format, ready to be opened with diagram tools like draw.io.
## Installation
You can install the UML Class Diagram Generator directly from PyPI:
```bash
pip install uml-class-diagram-generator
```
## Usage
After installing, you can generate UML class diagrams using the command-line tool `generate-uml`.
### Basic Usage
1. **Navigate to your project directory**:
```bash
cd /path/to/your/project
```
2. **Run the UML generator**:
```bash
generate-uml
```
3. **Follow the prompts**:
- Enter the base package directory (default is `src`).
- Select the main script for which you want to generate the UML diagram.
- Enter the name of the sub-package directory to resolve imports.
4. **Find your UML Diagram**:
- The tool will generate an XML file named `<sub_package_directory>_class_diagram.xml`.
- Open this XML file in [draw.io](https://app.diagrams.net/) to view the class diagram.
### Example
Let's say you have the following directory structure:
```
my_project/
│
├── src/
│ ├── main.py
│ └── module/
│ └── my_class.py
└── tests/
└── test_my_class.py
```
You would run `generate-uml`, specify `src` as the base directory, select `main.py` as the main script, and provide `module` as the sub-package directory. The tool will then generate a `module_class_diagram.xml` file containing the UML diagram for the classes in `main.py` and `my_class.py`.
## Contributing
Contributions are welcome! If you'd like to contribute to this project, please fork the repository and submit a pull request. For major changes, please open an issue to discuss what you would like to change.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Support
If you encounter any issues or have questions, feel free to open an issue on the [GitHub repository](https://github.com/siddharthverma-1607/uml-class-diagram-generator).
## Acknowledgments
- This tool leverages Python's Abstract Syntax Tree (AST) module to parse and analyze Python source code.
- Inspired by the need for efficient project architecture visualization.
Raw data
{
"_id": null,
"home_page": "https://github.com/siddharthverma-1607/uml-class-diagram-generator.git",
"name": "uml-class-diagram-generator",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Siddharth Verma",
"author_email": "siddharthverma.er.cse@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/89/6f/8c56fabf85575f4386192b1bf9d65e855fd862498c4ace5e227cb10f7f75/uml_class_diagram_generator-0.1.tar.gz",
"platform": null,
"description": "# UML Class Diagram Generator\r\n\r\n\r\n\r\n\r\n## Overview\r\n\r\nThe **UML Class Diagram Generator** is a powerful Python-based tool designed to automatically generate UML class diagrams from Python source code. It parses your Python files, extracts class definitions, methods, and attributes, and creates a structured UML diagram in XML format. This diagram can be easily visualized using tools like [draw.io](https://app.diagrams.net/).\r\n\r\nThis tool is perfect for developers and teams who want to quickly visualize the architecture of their Python projects without manually drawing class diagrams.\r\n\r\n## Features\r\n\r\n- **Automatic Class Parsing**: Detects and parses class definitions, including methods and attributes.\r\n- **Import Resolution**: Automatically resolves and includes imported files within the specified package.\r\n- **Interactive Command-Line Interface**: Guides you through selecting the base directory and main script for UML generation.\r\n- **UML Diagram in XML**: Outputs the UML class diagram in XML format, ready to be opened with diagram tools like draw.io.\r\n\r\n## Installation\r\n\r\nYou can install the UML Class Diagram Generator directly from PyPI:\r\n\r\n```bash\r\npip install uml-class-diagram-generator\r\n```\r\n\r\n## Usage\r\n\r\nAfter installing, you can generate UML class diagrams using the command-line tool `generate-uml`.\r\n\r\n### Basic Usage\r\n\r\n1. **Navigate to your project directory**:\r\n\r\n ```bash\r\n cd /path/to/your/project\r\n ```\r\n\r\n2. **Run the UML generator**:\r\n\r\n ```bash\r\n generate-uml\r\n ```\r\n\r\n3. **Follow the prompts**:\r\n - Enter the base package directory (default is `src`).\r\n - Select the main script for which you want to generate the UML diagram.\r\n - Enter the name of the sub-package directory to resolve imports.\r\n\r\n4. **Find your UML Diagram**:\r\n - The tool will generate an XML file named `<sub_package_directory>_class_diagram.xml`.\r\n - Open this XML file in [draw.io](https://app.diagrams.net/) to view the class diagram.\r\n\r\n### Example\r\n\r\nLet's say you have the following directory structure:\r\n\r\n```\r\nmy_project/\r\n\u00e2\u201d\u201a\r\n\u00e2\u201d\u0153\u00e2\u201d\u20ac\u00e2\u201d\u20ac src/\r\n\u00e2\u201d\u201a \u00e2\u201d\u0153\u00e2\u201d\u20ac\u00e2\u201d\u20ac main.py\r\n\u00e2\u201d\u201a \u00e2\u201d\u201d\u00e2\u201d\u20ac\u00e2\u201d\u20ac module/\r\n\u00e2\u201d\u201a \u00e2\u201d\u201d\u00e2\u201d\u20ac\u00e2\u201d\u20ac my_class.py\r\n\u00e2\u201d\u201d\u00e2\u201d\u20ac\u00e2\u201d\u20ac tests/\r\n \u00e2\u201d\u201d\u00e2\u201d\u20ac\u00e2\u201d\u20ac test_my_class.py\r\n```\r\n\r\nYou would run `generate-uml`, specify `src` as the base directory, select `main.py` as the main script, and provide `module` as the sub-package directory. The tool will then generate a `module_class_diagram.xml` file containing the UML diagram for the classes in `main.py` and `my_class.py`.\r\n\r\n## Contributing\r\n\r\nContributions are welcome! If you'd like to contribute to this project, please fork the repository and submit a pull request. For major changes, please open an issue to discuss what you would like to change.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Support\r\n\r\nIf you encounter any issues or have questions, feel free to open an issue on the [GitHub repository](https://github.com/siddharthverma-1607/uml-class-diagram-generator).\r\n\r\n## Acknowledgments\r\n\r\n- This tool leverages Python's Abstract Syntax Tree (AST) module to parse and analyze Python source code.\r\n- Inspired by the need for efficient project architecture visualization.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A tool to generate UML Class Diagrams from Python source code.",
"version": "0.1",
"project_urls": {
"Homepage": "https://github.com/siddharthverma-1607/uml-class-diagram-generator.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a3e1f4c4f45e608290a74d9c274ef7d1703f05a4e33f9d7f79aa671f791a2621",
"md5": "65400c7099c93d1f6d0d9d7f12c7e81c",
"sha256": "2b08ac14c234087bf1863a78ac7a100580463a185ed1c290551baa2c8b316e7b"
},
"downloads": -1,
"filename": "uml_class_diagram_generator-0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "65400c7099c93d1f6d0d9d7f12c7e81c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 6629,
"upload_time": "2024-08-09T19:24:03",
"upload_time_iso_8601": "2024-08-09T19:24:03.288382Z",
"url": "https://files.pythonhosted.org/packages/a3/e1/f4c4f45e608290a74d9c274ef7d1703f05a4e33f9d7f79aa671f791a2621/uml_class_diagram_generator-0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "896f8c56fabf85575f4386192b1bf9d65e855fd862498c4ace5e227cb10f7f75",
"md5": "66c58bf4b331d4eee92feb2c9a0c9774",
"sha256": "caaebcd05a641a704d5257ea433e09e82c5dea03322174225b0ec007c646dd14"
},
"downloads": -1,
"filename": "uml_class_diagram_generator-0.1.tar.gz",
"has_sig": false,
"md5_digest": "66c58bf4b331d4eee92feb2c9a0c9774",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 6144,
"upload_time": "2024-08-09T19:24:04",
"upload_time_iso_8601": "2024-08-09T19:24:04.776845Z",
"url": "https://files.pythonhosted.org/packages/89/6f/8c56fabf85575f4386192b1bf9d65e855fd862498c4ace5e227cb10f7f75/uml_class_diagram_generator-0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-09 19:24:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "siddharthverma-1607",
"github_project": "uml-class-diagram-generator",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "uml-class-diagram-generator"
}