|
1 | 1 | # CLAUDE.md |
2 | 2 |
|
3 | | -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
4 | | - |
5 | 3 | ## Project Overview |
6 | 4 |
|
7 | | -PyFlowGraph is a universal node-based visual scripting editor built with Python and PySide6. It allows users to create, connect, and execute Python code as nodes in a data-driven graph. The project follows a "Code as Nodes" philosophy where pins are automatically generated by parsing Python function signatures. |
8 | | - |
9 | | -## Common Commands |
10 | | - |
11 | | -### Running the Application |
12 | | - |
13 | | -- **Windows**: `run.bat` or `.\run.bat` |
14 | | -- **Linux/macOS**: `./run.sh` |
15 | | -- Both scripts automatically activate the virtual environment and run `src/main.py` |
16 | | - |
17 | | -### Environment Setup |
18 | | - |
19 | | -1. Create virtual environment: `python3 -m venv venv` |
20 | | -2. Activate environment: |
21 | | - - Windows: `venv\Scripts\activate` |
22 | | - - Linux/macOS: `source venv/bin/activate` |
23 | | -3. Install dependencies: `pip install PySide6` |
24 | | - |
25 | | -### Virtual Environment Management |
26 | | - |
27 | | -- The application creates project-specific virtual environments in the `venvs/` directory |
28 | | -- Each graph can have its own isolated environment with custom pip dependencies |
29 | | -- Use "Run > Manage Environment" in the application to configure environments |
30 | | - |
31 | | -## Architecture Overview |
| 5 | +PyFlowGraph: Universal node-based visual scripting editor built with Python and PySide6. "Code as Nodes" philosophy with automatic pin generation from Python function signatures. |
32 | 6 |
|
33 | | -### Core Application Structure |
| 7 | +## Commands |
34 | 8 |
|
35 | | -All source code is organized in the `src/` directory: |
| 9 | +**Running**: `run.bat` (Windows) or `./run.sh` (Linux/macOS) |
| 10 | +**Testing**: `run_test_gui.bat` - Professional GUI test runner |
| 11 | +**Dependencies**: `pip install PySide6` |
36 | 12 |
|
37 | | -- **src/main.py**: Entry point, loads Font Awesome fonts and QSS stylesheet |
38 | | -- **src/node_editor_window.py**: Main QMainWindow with menus, toolbars, and dock widgets |
39 | | -- **src/node_editor_view.py**: QGraphicsView handling mouse/keyboard interactions (pan, zoom, copy/paste) |
40 | | -- **src/node_graph.py**: QGraphicsScene managing nodes, connections, and clipboard operations |
41 | | -- **src/graph_executor.py**: Execution engine that runs node graphs using subprocess isolation |
| 13 | +## Architecture |
42 | 14 |
|
43 | | -### Node System |
| 15 | +**Core**: `src/` contains 25+ Python modules |
| 16 | +- `main.py` - Entry point with Font Awesome fonts/QSS |
| 17 | +- `node_editor_window.py` - Main QMainWindow |
| 18 | +- `node_editor_view.py` - QGraphicsView (pan/zoom/copy/paste) |
| 19 | +- `node_graph.py` - QGraphicsScene (nodes/connections/clipboard) |
| 20 | +- `graph_executor.py` - Execution engine with subprocess isolation |
| 21 | +- `commands/` - Command pattern for undo/redo system |
44 | 22 |
|
45 | | -- **src/node.py**: Main Node class with automatic pin generation from Python function parsing |
46 | | -- **src/pin.py**: Input/output connection points with type-based coloring |
47 | | -- **src/connection.py**: Bezier curve connections between pins |
48 | | -- **src/reroute_node.py**: Simple organizational nodes for connection routing |
49 | | - |
50 | | -### Code Editing |
51 | | - |
52 | | -- **src/code_editor_dialog.py**: Modal dialog containing the code editor |
53 | | -- **src/python_code_editor.py**: Core editor widget with line numbers and smart indentation |
54 | | -- **src/python_syntax_highlighter.py**: Python syntax highlighting implementation |
55 | | - |
56 | | -### Event System |
57 | | - |
58 | | -- **src/event_system.py**: Event-driven execution system for interactive applications with live mode support |
59 | | - |
60 | | -### Utilities |
61 | | - |
62 | | -- **src/color_utils.py**: Color manipulation utilities |
63 | | -- **src/environment_manager.py**: Virtual environment management dialog |
64 | | -- **src/settings_dialog.py**: Application settings configuration |
65 | | -- **src/node_properties_dialog.py**: Node property editing interface |
66 | | -- **src/ui_utils.py**: Common UI utility functions and helpers |
67 | | -- **src/view_state_manager.py**: View state management for zoom and pan operations |
68 | | -- **src/execution_controller.py**: Central execution control and coordination |
69 | | -- **src/file_operations.py**: File loading, saving, and import/export operations |
70 | | -- **src/flow_format.py**: Markdown flow format parsing and serialization |
71 | | -- **src/test_runner_gui.py**: Professional GUI-based test runner for development |
| 23 | +**Node System**: `node.py`, `pin.py`, `connection.py`, `reroute_node.py` |
| 24 | +**Code Editing**: `code_editor_dialog.py`, `python_code_editor.py`, `python_syntax_highlighter.py` |
| 25 | +**Event System**: `event_system.py` - Live mode execution support |
72 | 26 |
|
73 | 27 | ## Key Concepts |
74 | 28 |
|
75 | | -### Node Function Parsing |
76 | | - |
77 | | -- Nodes automatically generate input pins from function parameters with type hints |
78 | | -- Output pins are created from return type annotations |
79 | | -- Supports single outputs (`-> str`) and multiple outputs (`-> Tuple[str, int]`) |
80 | | -- Type hints determine pin colors: `int`, `str`, `float`, `bool`, `Tuple` |
81 | | - |
82 | | -### Data Flow Execution |
83 | | - |
84 | | -- Graph execution is data-driven, not control-flow based |
85 | | -- Nodes execute when all input dependencies are satisfied |
86 | | -- Each node runs in an isolated subprocess for security |
87 | | -- Pin values are serialized/deserialized as JSON between nodes |
88 | | -- Supports both **Batch Mode** (traditional sequential execution) and **Live Mode** (event-driven interactive execution) |
89 | | - |
90 | | -### Graph Persistence |
91 | | - |
92 | | -- Graphs save to clean JSON format in the `examples/` directory |
93 | | -- Node positions, connections, and code are preserved |
94 | | -- Virtual environment requirements are stored with each graph |
| 29 | +**Node Function Parsing**: Automatic pin generation from Python function signatures with type hints |
| 30 | +**Data Flow Execution**: Data-driven (not control-flow), subprocess isolation, JSON serialization |
| 31 | +**Graph Persistence**: Clean JSON format, saved to `examples/` directory |
95 | 32 |
|
96 | 33 | ## File Organization |
97 | 34 |
|
98 | | -### Project Structure |
99 | | - |
100 | | -The project follows a clean, organized structure: |
101 | | - |
102 | 35 | ``` |
103 | 36 | PyFlowGraph/ |
104 | | -├── src/ # All Python source code |
105 | | -│ ├── resources/ # Font Awesome fonts embedded in src |
106 | | -│ └── test_runner_gui.py # Professional GUI test runner |
107 | | -├── tests/ # All test files |
108 | | -├── docs/ # Static documentation |
109 | | -├── test_reports/ # Generated test outputs and summaries |
110 | | -├── examples/ # Sample graph files (10 examples) |
111 | | -├── images/ # Screenshots and documentation images |
112 | | -├── pre-release/ # Pre-built releases and binaries |
113 | | -├── venv/ # Main application virtual environment |
114 | | -├── venvs/ # Project-specific virtual environments |
115 | | -├── .github/workflows/ # CI/CD pipeline |
116 | | -├── run.bat, run.sh # Application launcher scripts |
117 | | -├── run_test_gui.bat # Professional test runner GUI launcher |
118 | | -├── dark_theme.qss # Application stylesheet |
119 | | -├── requirements.txt # Python dependencies |
120 | | -├── LICENSE.txt # Project license |
121 | | -├── README.md # Project readme |
122 | | -└── CLAUDE.md # This file |
| 37 | +├── src/ # 25+ Python modules + commands/ |
| 38 | +├── tests/ # 18+ test files with GUI test runner |
| 39 | +├── docs/ # Organized documentation |
| 40 | +│ ├── architecture/ # Technical architecture docs |
| 41 | +│ ├── specifications/ # Feature specs (flow_spec.md, ui-ux, etc.) |
| 42 | +│ └── development/ # Testing guides, implementation notes |
| 43 | +├── examples/ # Sample .md graph files |
| 44 | +├── venv/ + venvs/ # Virtual environments |
| 45 | +└── run.bat, run_test_gui.bat # Launchers |
123 | 46 | ``` |
124 | 47 |
|
125 | | -### Core Directories |
126 | | - |
127 | | -- **`src/`**: All 24 Python modules organized in one location |
128 | | -- **`tests/`**: 7 test files with comprehensive GUI and execution testing |
129 | | -- **`docs/`**: Hand-written documentation (flow_spec.md, test guides) |
130 | | -- **`test_reports/`**: Auto-generated test outputs and summaries |
131 | | -- **`examples/`**: 10 sample .md graph files demonstrating features |
132 | | -- **`images/`**: Screenshots and documentation images for project visualization |
133 | | -- **`pre-release/`**: Pre-built application binaries and releases |
134 | | -- **`venv/`**: Main application virtual environment |
135 | | -- **`venvs/`**: Isolated Python environments for individual graph execution |
136 | | - |
137 | 48 | ## Testing |
138 | 49 |
|
139 | | -### Test Organization |
140 | | - |
141 | | -The test suite is organized around PyFlowGraph's core functional components: |
142 | | - |
143 | | -- **tests/test_node_system.py**: Core Node functionality (creation, properties, code management, serialization) |
144 | | -- **tests/test_pin_system.py**: Pin creation, type detection, positioning, and connection compatibility |
145 | | -- **tests/test_connection_system.py**: Connection/bezier curve creation, serialization, and reroute nodes |
146 | | -- **tests/test_graph_management.py**: Graph operations (node/connection management, clipboard, clearing) |
147 | | -- **tests/test_execution_engine.py**: Code execution, flow control, subprocess isolation, error handling |
148 | | -- **tests/test_file_formats.py**: Markdown and JSON format parsing, conversion, and file operations |
149 | | -- **tests/test_integration.py**: End-to-end workflows and real-world usage scenarios |
150 | | - |
151 | | -### Running Tests |
152 | | - |
153 | | -- **Test GUI**: `run_test_gui.bat` - Professional PySide6 test runner with visual interface |
154 | | -- **Manual**: `python tests/test_name.py` - Individual test files |
155 | | -- **Direct GUI**: `python src/test_runner_gui.py` - Run test GUI directly |
156 | | - |
157 | | -### Test Runner Features |
158 | | - |
159 | | -The new test runner GUI provides: |
160 | | -- Automatic test discovery from the `tests/` directory |
161 | | -- Visual test selection with checkboxes |
162 | | -- Real-time status indicators (green/red circles for pass/fail) |
163 | | -- Detailed test output viewing with syntax highlighting |
164 | | -- Background execution with progress tracking |
165 | | -- 5-second timeout per test for fast feedback |
166 | | -- Professional dark theme matching the main application |
167 | | - |
168 | | -### Test Design Principles |
169 | | - |
170 | | -- **Focused Coverage**: Each test module covers a single core component |
171 | | -- **Fast Execution**: All tests complete within 5 seconds total runtime |
172 | | -- **Deterministic**: Tests are reliable and not flaky |
173 | | -- **Comprehensive**: 100% coverage of fundamental functionality |
174 | | -- **Integration Testing**: Real-world usage scenarios and error conditions |
| 50 | +**Current Suite**: 18+ test files covering node system, pins, connections, execution, file formats |
| 51 | +**GUI Runner**: `run_test_gui.bat` - Professional PySide6 interface with real-time status |
| 52 | +**Coverage**: Core components, command system, integration scenarios |
175 | 53 |
|
176 | 54 | ## Development Notes |
177 | 55 |
|
178 | | -- This is an experimental AI-generated codebase for learning purposes |
179 | | -- The application uses PySide6 for the Qt-based GUI |
180 | | -- Font Awesome integration provides professional iconography |
181 | | -- All nodes execute in isolated environments for security |
182 | | -- Dependencies are managed via `requirements.txt` (PySide6, Nuitka for compilation) |
183 | | -- Don't add claude attribution to git commits. Don't ever add that it was generated with claude at the end of comments. This is bloat! Stop that! |
184 | | -- Don't use emoji's in code! it always fucks things up. |
185 | | - |
186 | | -## Documentation and markdown files |
187 | | - |
188 | | -- no emoji in code. no em dashes. |
189 | | -- no marketing BS. Only clean, professional, technical |
| 56 | +- Experimental AI-generated codebase for learning |
| 57 | +- PySide6 Qt-based GUI with Font Awesome icons |
| 58 | +- Isolated subprocess execution for security |
| 59 | +- No Claude attribution in commits or code comments |
| 60 | +- No emojis in code - causes issues |
| 61 | +- Clean, professional, technical documentation only |
0 commit comments