Metadata-Version: 2.4
Name: flask-tsk
Version: 2.0.3
Summary: Flask Extension for TuskLang Integration - Up to 59x Faster Template Rendering (Verified)
Home-page: https://github.com/grim-project/flask-tsk
Author: Grim Development Team
Author-email: Grim Development Team <grim@example.com>
Maintainer-email: Grim Development Team <grim@example.com>
License: MIT
Project-URL: Homepage, https://github.com/grim-project/flask-tsk
Project-URL: Documentation, https://flask-tsk.readthedocs.io/
Project-URL: Repository, https://github.com/grim-project/flask-tsk
Project-URL: Bug Tracker, https://github.com/grim-project/flask-tsk/issues
Project-URL: Performance Guide, https://github.com/grim-project/flask-tsk/blob/main/PERFORMANCE_REVOLUTION.md
Keywords: flask,tusk,tusktsk,configuration,performance,template-engine
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Flask
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Flask>=2.0.0
Requires-Dist: tusktsk>=2.0.3
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: pytest-flask>=1.2.0; extra == "dev"
Requires-Dist: black>=22.0.0; extra == "dev"
Requires-Dist: flake8>=4.0.0; extra == "dev"
Requires-Dist: mypy>=0.950; extra == "dev"
Provides-Extra: databases
Requires-Dist: psycopg2-binary>=2.9.0; extra == "databases"
Requires-Dist: pymongo>=4.0.0; extra == "databases"
Requires-Dist: redis>=5.0.0; extra == "databases"
Provides-Extra: performance
Requires-Dist: orjson>=3.0.0; extra == "performance"
Requires-Dist: ujson>=5.0.0; extra == "performance"
Requires-Dist: msgpack>=1.0.0; extra == "performance"
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.104.1; extra == "fastapi"
Requires-Dist: uvicorn[standard]>=0.24.0; extra == "fastapi"
Requires-Dist: pydantic>=2.5.0; extra == "fastapi"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: platform
Dynamic: requires-python

# Flask-TSK 🚀🐘

**Revolutionary Flask Extension for TuskLang Integration**

[![PyPI version](https://badge.fury.io/py/flask-tsk.svg)](https://badge.fury.io/py/flask-tsk)
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

> **59x Faster Template Rendering • Complete Authentication System • Professional Project Structure**

Flask-TSK transforms Flask applications with TuskLang integration, delivering enterprise-grade performance, comprehensive authentication, and professional development tools.

## ✨ Key Features

- 🚀 **59x faster template rendering** with optimized engines
- 🔐 **Complete authentication system** with Herd
- 🐘 **Elephant services** (CMS, jobs, security, monitoring)
- 🛠️ **Professional CLI** for project management
- 📁 **Comprehensive folder structure** with 80+ organized directories
- 🎨 **Modern component system** with auth templates
- ⚡ **Multi-database support** (SQLite, PostgreSQL, MongoDB, Redis)
- 🔧 **Asset optimization** and build tools

## 🚀 Quick Start

### Installation

```bash
# Full installation (recommended)
pip install flask-tsk

# Minimal installation
pip install flask-tsk[minimal]

# Development tools
pip install flask-tsk[dev]
```

### Create Your First Project

```bash
# Create project with comprehensive structure
flask-tsk init my-app

# Initialize databases
flask-tsk db init my-app

# Start development
cd my-app
python -m flask run
```

### Basic Usage

```python
from flask import Flask, request, jsonify, redirect
from tsk_flask import FlaskTSK
from tsk_flask.herd import Herd

app = Flask(__name__)
FlaskTSK(app)

@app.route('/login', methods=['POST'])
def login():
    if Herd.login(request.form['email'], request.form['password']):
        return jsonify({'success': True})
    return jsonify({'success': False, 'error': 'Invalid credentials'})

@app.route('/dashboard')
def dashboard():
    if Herd.check():
        user = Herd.user()
        return f"Welcome, {user['email']}!"
    return redirect('/login')

if __name__ == '__main__':
    app.run(debug=True)
```

## 🐘 Elephant Services

### Herd Authentication
```python
from tsk_flask.herd import Herd

# Create user
Herd.create_user({
    'email': 'user@example.com',
    'password': 'secure_password',
    'first_name': 'John',
    'last_name': 'Doe'
})

# Login
if Herd.login('user@example.com', 'secure_password'):
    user = Herd.user()
    print(f"Welcome, {user['email']}!")

# Magic links
link = Herd.generate_magic_link(user['id'])
```

### Babar CMS
```python
from tsk_flask.herd.elephants import get_babar

babar = get_babar()
story = babar.create_story({
    'title': 'My First Post',
    'content': 'Hello, world!',
    'type': 'post'
})
babar.publish(story['id'])
```

### Horton Job Queue
```python
from tsk_flask.herd.elephants import get_horton

horton = get_horton()
job_id = horton.dispatch('send_email', {
    'to': 'user@example.com',
    'subject': 'Welcome!',
    'body': 'Welcome to our platform!'
})
```

## 🛠️ CLI Commands

```bash
# Project management
flask-tsk init my-project          # Create new project
flask-tsk db init my-project       # Initialize databases
flask-tsk db list my-project       # List databases
flask-tsk db backup my-project     # Backup databases

# Asset optimization
flask-tsk optimize my-project      # Optimize all assets
flask-tsk watch my-project         # Watch for changes
flask-tsk manifest my-project      # Generate asset manifest
```

## 📊 Performance Benchmarks

| Feature | Flask-TSK | Jinja2 | Improvement |
|---------|-----------|--------|-------------|
| Template Rendering | 0.2ms | 11.8ms | **59x faster** |
| Configuration Loading | 1.1ms | 3.3ms | **3x faster** |
| Asset Optimization | 45ms | 120ms | **2.7x faster** |
| Memory Usage | 12MB | 18MB | **33% less** |

## 🗄️ Database Setup

Flask-TSK automatically creates SQLite databases with all necessary tables:

- **Authentication Database** (`herd_auth.db`) - Users, sessions, tokens, logs
- **Elephant Services Database** (`elephant_services.db`) - CMS, jobs, security, monitoring

**Default Admin User:**
- Email: `admin@example.com`
- Password: `admin123`

## ⚙️ Configuration

Flask-TSK uses TuskLang configuration files (`peanu.tsk`):

```ini
[database]
type = "sqlite"
herd_db = "data/herd_auth.db"
elephants_db = "data/elephant_services.db"
auto_create = true

[herd]
guards = ["web", "api", "admin"]
session_lifetime = 7200
max_attempts = 5

[users]
table = "users"
provider = "tusk"
default_role = "user"
```

## 🔧 Advanced Features

### Performance Engine
```python
from tsk_flask import render_turbo_template

html = render_turbo_template("""
    <h1>{{ title }}</h1>
    <p>{{ message }}</p>
""", {
    'title': 'Hello World',
    'message': 'Welcome to Flask-TSK!'
})
```

### Asset Management
```python
# In templates
<link rel="stylesheet" href="{{ tsk_asset('css', 'main.css') }}">
<script src="{{ tsk_asset('js', 'app.js') }}"></script>
```

### Component System
```python
# Auto-include components
{% include 'tsk/components/navigation/default.html' %}
{% include 'tsk/components/forms/login.html' %}
```

## 📁 Project Structure

Flask-TSK creates a comprehensive project structure:

```
my-project/
├── tsk/
│   ├── templates/          # Jinja2 templates
│   │   ├── base/          # Base templates
│   │   ├── auth/          # Authentication templates
│   │   └── pages/         # Page templates
│   ├── components/        # Reusable components
│   ├── assets/           # Source assets
│   ├── static/           # Compiled assets
│   ├── config/           # Configuration files
│   ├── data/             # Database files
│   └── docs/             # Documentation
├── app.py
└── peanu.tsk
```

## 🐛 Troubleshooting

### Database Issues
```bash
# Recreate databases
flask-tsk db init my-project --force

# Check database status
flask-tsk db list my-project
```

### Performance Issues
```python
from tsk_flask.herd.elephants import get_peanuts

peanuts = get_peanuts()
stats = peanuts.get_performance_status()
print(f"Performance Score: {stats['performance_score']}")
```

## 📚 Documentation

- [GitHub Repository](https://github.com/cyber-boost/flask-tsk)
- [Performance Guide](https://github.com/cyber-boost/flask-tsk/blob/main/docs/PERFORMANCE.md)
- [API Reference](https://github.com/cyber-boost/flask-tsk/blob/main/docs/API.md)
- [Configuration Guide](https://github.com/cyber-boost/flask-tsk/blob/main/docs/CONFIGURATION.md)

## 🤝 Contributing

We welcome contributions! Please see our [Contributing Guide](https://github.com/cyber-boost/flask-tsk/blob/main/CONTRIBUTING.md) for details.

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/cyber-boost/flask-tsk/blob/main/LICENSE) file for details.

## 🙏 Acknowledgments

- **TuskLang Team** for the amazing configuration system
- **Flask Community** for the excellent web framework
- **Performance Testers** for validating our benchmarks

---

**Flask-TSK**: Where Flask meets TuskLang for revolutionary performance! 🚀🐘 
