Blueprint-based Python architecture generator with UML export
Project description
PyChitect
Build Python project blueprints, generate class diagrams, and export clean project structures with minimal code.
Features
- Create Python file blueprints
- Add imports and from-imports
- Define variables
- Define functions with parameters
- Define classes with methods and inheritance
- Generate runnable
.pyfiles - Generate UML class diagrams
- Export diagrams as PNG
- Automatic overwrite detection
- Blueprint structure inspection
Installation
pip install pychitect
Optional
For UML diagram generation:
pip install plantuml
Quick Start
from pychitect import *
use_file("project.py", "override")
insert_import(["os", "json"])
insert_from(
"datetime",
["datetime"]
)
create_variable(
"VERSION",
"1.0.0"
)
create_function(
"main",
["args"]
)
create_class(
"User",
methods=[
("__init__", ["self", "name"]),
("save", ["self"])
]
)
create_entry("main")
Generated file:
# imports
import os
import json
from datetime import datetime
# variables
VERSION = '1.0.0'
# classes
class User:
def __init__(self, name):
pass
def save(self):
pass
# functions
def main(args):
pass
# entries
if __name__ == '__main__':
main(args)
Functions
use_file
use_file(file, mode)
Parameters:
| Name | Description |
|---|---|
| file | Target Python file |
| mode | "append" or "override" |
Example:
use_file("app.py", "override")
insert_import
insert_import(modules)
Example:
insert_import([
"os",
"json",
"sys"
])
Result:
import os
import json
import sys
insert_from
insert_from(module, imports)
Example:
insert_from(
"datetime",
["datetime", "timedelta"]
)
Result:
from datetime import datetime, timedelta
create_variable
create_variable(name, value)
Example:
create_variable(
"DEBUG",
True
)
create_function
create_function(
name,
params=[]
)
Example:
create_function(
"login",
[
"username",
"password"
]
)
Result:
def login(username, password):
pass
create_class
create_class(
name,
methods=[],
parents=[]
)
Example:
create_class(
"User",
methods=[
("__init__", ["self", "name"]),
("save", ["self"])
]
)
Result:
class User:
def __init__(self, name):
pass
def save(self):
pass
Inheritance:
create_class(
"Admin",
parents=["User"]
)
Result:
class Admin(User):
pass
create_entry
create_entry("main")
Result:
if __name__ == '__main__':
main()
info
Display the current blueprint structure.
info()
Example output:
===== BLUEPRINT STRUCTURE =====
IMPORTS:
- import os
VARIABLES:
- DEBUG = True
CLASSES:
Class: User
Method: __init__(self, name)
Method: save(self)
FUNCTIONS:
Function: main(args)
ENTRYPOINT:
- if __name__ == '__main__':
==============================
show_logs
Display all collected logs.
show_logs()
create_class_diagram
Generate a UML class diagram.
create_class_diagram()
Output:
project.png
Keep generated .puml file:
create_class_diagram(
keep_puml=True
)
Example
from pychitect import *
use_file(
"shop.py",
"override"
)
insert_import([
"json"
])
create_variable(
"VERSION",
"1.0.0"
)
create_class(
"Product",
methods=[
("__init__", ["self", "name", "price"]),
("save", ["self"])
]
)
create_function(
"main"
)
create_entry(
"main"
)
create_class_diagram()
Generated:
shop.pyshop.png
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pychitect-1.0.0.tar.gz.
File metadata
- Download URL: pychitect-1.0.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b84d33d090c2159ffafc76b9b902126029dd7c9150d9facc5fe17aa3703d0758
|
|
| MD5 |
c14c4373488259e5daeb9cbde1b9c00c
|
|
| BLAKE2b-256 |
db57f88fa2fd64e34d861b28d20812406ab441b72a76b1ac97d686e38cb3e6d1
|
File details
Details for the file pychitect-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pychitect-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b0f5ea5783a1b3c62b41bd3806d193451967475043bf64485e29a2fdd0e677a
|
|
| MD5 |
46c20fa3a57027f259cce3ac3e39eb4b
|
|
| BLAKE2b-256 |
ef864eabe79c8cf80e618cd10d229d917ca29ce8267ee272d299c01f95d94867
|