A powerful Streamlit application that analyzes Python scripts and Jupyter notebooks to generate visual workflow diagrams. Perfect for understanding code structure, documenting workflows, and visualizing the relationships between functions, classes, and methods.
- File Upload: Support for
.py
,.ipynb
, and.txt
files - URL Fetching: Direct import from GitHub URLs (automatically converts to raw format)
- Code Pasting: Direct code input with syntax highlighting
- Function Detection: Identifies all function definitions with parameters
- Class Analysis: Maps classes and their methods
- Import Tracking: Lists all imports and dependencies
- Call Graph: Traces function call relationships
- Notebook Support: Cell-by-cell analysis for Jupyter notebooks
- Network Graph: Shows function/class relationships
- Color-coded Elements:
- π΄ Classes (Red)
- π΅ Functions (Blue)
- π Methods (Orange)
- Smart Text Wrapping: Handles long function names
- Interactive Layout: Spring-based positioning
- Sequential Workflow: Cell-by-cell progression
- Cell Type Recognition: Code vs. Markdown cells
- Content Preview: Shows cell contents and metadata
- Visual Arrows: Clear workflow direction
- High-Quality Downloads: PNG/JPEG export at 300 DPI
- Multiple Formats: Choose your preferred image format
- Easy Sharing: Direct download links
python >= 3.7
pip install streamlit matplotlib networkx requests numpy
- Clone or download the
workflow_analyzer.py
file - Install dependencies:
pip install streamlit matplotlib networkx requests numpy
- Run the application:
streamlit run workflow_analyzer.py
- Open your browser to
http://localhost:8501
- Select "Upload File" in the sidebar
- Choose your Python file (.py, .ipynb, or .txt)
- View the analysis and generated diagram
- Export as needed
- Select "Enter URL" in the sidebar
- Paste any GitHub file URL (e.g.,
https://raw.githubusercontent.com/Fraunhofer-ITMP/PySASC/refs/heads/main/SASC_v2.ipynb?token=GHSAT0AAAAAADCRFWKM6YJIQNT5JQ24VLVK2B23WDA
) - Click "Fetch from URL"
- The app automatically converts to raw format and analyzes
- Select "Paste Code" in the sidebar
- Paste your Python code directly
- Instant analysis and visualization
- Code Documentation: Generate visual documentation for complex projects
- Code Review: Quickly understand code structure and dependencies
- Refactoring: Identify tightly coupled components
- Onboarding: Help new team members understand codebase structure
- Notebook Analysis: Visualize Jupyter notebook workflows
- Pipeline Documentation: Document data processing pipelines
- Experiment Tracking: Understand analysis workflows
- Teaching Tool: Visualize code structure for students
- Assignment Review: Quickly assess student code organization
- Curriculum Planning: Show progression of coding concepts
- Python Scripts (
.py
): Full AST analysis with function call mapping - Jupyter Notebooks (
.ipynb
): JSON parsing with cell-by-cell analysis - Text Files (
.txt
): Basic parsing with cell delimiter detection
- Character Normalization: Fixes problematic Unicode characters
- Quote Standardization: Converts smart quotes to standard quotes
- Whitespace Handling: Normalizes various space characters
- Error Recovery: Graceful handling of syntax errors
- Automatic URL Conversion:
github.com/.../blob/...
βraw.githubusercontent.com/...
- Branch Support: Works with any branch or commit
- Error Handling: Clear feedback for inaccessible repositories
- Classes: Bright Red (#E74C3C) - Highly visible for main components
- Functions: Blue (#3498DB) - Clear distinction from methods
- Methods: Orange (#F39C12) - Easy identification of class methods
- Automatic Wrapping: Long function names split intelligently
- Underscore Splitting: Respects Python naming conventions
- Readable Font Size: Optimized for clarity
- Spring Layout: Automatic positioning based on relationships
- Scalable Design: Adapts to different numbers of elements
- High DPI Output: Professional quality for presentations
We welcome contributions! Here are some ways you can help:
- Additional file format support
- New visualization types
- Enhanced analysis capabilities
- UI/UX improvements
- Use the GitHub issues tab
- Include error messages and steps to reproduce
- Attach problematic files (if possible)
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
def calculate_area(radius):
return 3.14159 * radius ** 2
def calculate_volume(radius, height):
base_area = calculate_area(radius)
return base_area * height
class Circle:
def __init__(self, radius):
self.radius = radius
def area(self):
return calculate_area(self.radius)
Result: Network diagram showing function calls and class relationships
{
"cells": [
{
"cell_type": "markdown",
"source": ["# Data Analysis Workflow"]
},
{
"cell_type": "code",
"source": ["import pandas as pd\ndf = pd.read_csv('data.csv')"]
}
]
}
Result: Sequential workflow showing cell progression
"Syntax error in Python code"
- The file may contain special characters
- Try copying code to a plain text editor first
- Use the built-in character cleaning feature
"No cells found in notebook"
- Ensure the file is a valid .ipynb format
- Check that cells contain actual content
- Try the "Paste Code" method as alternative
"Error fetching URL"
- Verify the URL is accessible
- For private repositories, download and upload the file instead
- Check your internet connection
- Large files may take longer to analyze
- Complex notebooks with many cells will generate larger diagrams
- Use PNG format for better quality, JPEG for smaller file sizes
This project is licensed under the MIT License - see the LICENSE file for details.
- Streamlit Team: For the amazing web app framework
- NetworkX: For powerful graph visualization capabilities
- Matplotlib: For high-quality plotting functionality
- Python AST: For robust code parsing capabilities
- Languages: Python, Markdown
- Dependencies: 4 main packages
- File Size: ~25KB
- Features: 15+ core features
- Use Cases: 10+ identified scenarios
Get Started Now | Report Issues | Request Features
Made with β€οΈ for the Python community