An advanced, professional-grade web application for Python code analysis, formatting, and quality assessment. Built with Flask and featuring a modern, responsive user interface.
- Syntax Checking: Validate Python code syntax with detailed error reporting
- Code Linting: Advanced linting using flake8 with customizable rules
- Code Formatting: Automatic code formatting using Black formatter
- Complexity Analysis: Code complexity analysis using Radon metrics
- Real-time Statistics: Live line count, character count, and file information
- File Management: Upload Python files, download formatted code
- Theme Support: Dark/light theme toggle with multiple editor themes
- Settings Panel: Customizable editor preferences and application settings
- Toast Notifications: User-friendly feedback system
- Health Monitoring: System health check endpoint
- Share Functionality: Code sharing capabilities (extensible)
- CORS Support: Cross-origin request handling
- Rate Limiting: Built-in request rate limiting
- Input Validation: Comprehensive code input validation
- Error Handling: Robust error handling with detailed logging
- Resource Management: Automatic cleanup of temporary files
- Python 3.11 or higher
- pip package manager
-
Clone or download the application files
-
Install dependencies:
pip install -r enhanced_requirements.txt
-
Run the application:
python enhanced_app.py
-
Access the application: Open your browser and navigate to
http://localhost:5000
The application requires the following Python packages:
- Flask>=2.3.0
- Flask-CORS>=4.0.0
- black>=23.0.0
- flake8>=6.0.0
- radon>=6.0.0
- Werkzeug>=2.3.0
python-code-studio-pro/
βββ enhanced_app.py # Main Flask application
βββ requirements.txt # Python dependencies
βββ templates/
β βββ index.html # Main HTML template
βββ static/
β βββ css/
β β βββ style.css # Application styles
β βββ js/
β βββ app.js # Frontend JavaScript
βββ README.md # This file
βββ test_results.md # Testing documentation
βββ app.log # Application logs (created at runtime)
-
Syntax Check:
- Select the "Syntax Check" tab
- Click "Run Syntax Check" to validate your Python code
-
Code Linting:
- Select the "Linter" tab
- Click "Run Linter" to identify code quality issues
-
Code Formatting:
- Select the "Formatter" tab
- Click "Run Formatter" to automatically format your code
-
Complexity Analysis:
- Select the "Complexity" tab
- Click "Run Complexity" to analyze code complexity metrics
- Upload File: Click "Upload File" to load a Python file into the editor
- Download Code: Click "Download Code" to save your code as a .py file
- Copy Code: Use the copy button in the editor header
- Clear Editor: Use the trash button to clear the editor content
- Theme Toggle: Click the moon/sun icon to switch between dark and light themes
- Settings: Click the gear icon to access editor preferences
- Editor Themes: Choose from Dracula, Default, Monokai, and Material themes
- Font Size: Adjust editor font size from 12px to 24px
- Line Wrapping: Enable/disable line wrapping in the editor
FLASK_DEBUG
: Set to 'true' for debug mode (default: false)SECRET_KEY
: Flask secret key (default: development key)
The application includes several configurable settings:
- Max Content Length: 1MB file size limit
- Rate Limit: 60 requests per minute per IP
- Flake8 Rules: Customizable linting rules
- Black Formatting: Configurable formatting options
The application includes a health check endpoint at /health
that returns:
{
"status": "healthy",
"timestamp": "2025-08-06T09:41:31.725361",
"features": {
"complexity_analysis": true,
"formatting": true,
"linting": true,
"syntax_check": true
}
}
python enhanced_app.py
For production deployment, consider:
-
Use a WSGI server (e.g., Gunicorn):
pip install gunicorn gunicorn -w 4 -b 0.0.0.0:5000 enhanced_app:app
-
Set environment variables:
export FLASK_DEBUG=false export SECRET_KEY=your-secret-key-here
-
Configure reverse proxy (e.g., Nginx) for static files and SSL
The application has been thoroughly tested with all features working correctly:
- β Syntax checking with detailed error reporting
- β Linting with flake8 integration
- β Code formatting with Black
- β Complexity analysis with Radon
- β File upload/download functionality
- β Theme switching and settings
- β Health check endpoint
- β Error handling and validation
- β Responsive design and mobile support
See test_results.md
for detailed testing documentation.
- Input Validation: Comprehensive validation of code input
- Rate Limiting: Protection against abuse
- CORS Configuration: Secure cross-origin request handling
- Error Handling: Secure error messages without information leakage
- File Size Limits: Protection against large file uploads
- Dangerous Pattern Detection: Monitoring for potentially harmful code patterns
- Modern Design: Professional dark theme with light theme option
- Responsive Layout: Works on desktop, tablet, and mobile devices
- Code Editor: Syntax-highlighted editor with multiple themes
- Real-time Feedback: Live statistics and toast notifications
- Keyboard Shortcuts: Efficient keyboard navigation
- Loading States: Visual feedback during processing
- Modal Dialogs: Settings and sharing functionality
GET /
: Main application interfacePOST /process_code
: Code processing endpointGET /health
: System health check
Endpoint: POST /process_code
Request Body:
{
"code": "Python code string",
"action": "check|lint|format|complexity"
}
Response Examples:
Syntax Check Success:
{
"status": "success",
"message": "Syntax is valid! β",
"details": {
"lines": 47,
"characters": 1162
}
}
Linting Issues:
{
"status": "lint_errors",
"message": "Found 3 linting issue(s)",
"errors": ["Line 1:1: F401 'os' imported but unused"],
"details": {
"issues_count": 3,
"lines_checked": 47
}
}
This application was developed as an enhanced version of a Python code analysis tool. Future enhancements could include:
- Integration with additional linting tools (pylint, mypy)
- Code coverage analysis
- Git integration for version control
- Plugin system for custom analyzers
- Collaborative editing features
- Cloud storage integration
This project is developed for educational and professional use. Please ensure compliance with all dependency licenses.
Developed & Maintained with β€οΈ by Anjani Dubey
- Install dependencies:
pip install -r enhanced_requirements.txt
- Run the application:
python enhanced_app.py
- Open browser: Navigate to
http://localhost:5000
- Start coding: Paste your Python code and select an analysis tool
- Enjoy: Professional code analysis at your fingertips!
For support or questions, please refer to the test results and documentation provided.