Metadata-Version: 2.4
Name: hython-cli
Version: 0.1.5
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Build Tools
Classifier: Environment :: Console
License-File: LICENSE
Summary: Zero-Interruption Python Automation Engine
Home-Page: https://hython.dev
Author: Hython Labs
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://hython.dev/changelog/
Project-URL: Documentation, https://hython.dev/docs/
Project-URL: Homepage, https://hython.dev
Project-URL: Repository, https://github.com/hython-labs/hython

# Hython ⚡
### Zero-Interruption Python Automation

> **"Don't ask the developer to fix something that Hython can safely fix itself.  
> And after fixing it: Tell the developer what happened, without making them participate in the process."**

Hython is an automation-first Python environment orchestrator and developer workflow engine. It completely eliminates the friction of managing virtual environments, installing missing dependencies, matching Python versions, configuring IDE settings, and answering routine `[Y/n]` prompts.

📖 **For detailed step-by-step guides with real-world project walkthroughs, see [Official Documentation](https://hython.dev/docs/).**

---

## The Mental Model

```text
Developer intent (`hython` or `hython app.py`)
       ↓
Hython inspects project & requirements
       ↓
Hython resolves environment & runtimes
       ↓
Hython fixes safe problems automatically (auto-installs, auto-migrates, auto-imports)
       ↓
Hython runs the project & reports concisely
```

The developer should think:
> *I have a Python project. I want to build and run it. `hython`. That's it.*

---

## Key Features

- 🚫 **No Routine Prompts:** Never stops execution for safe, deterministic actions like creating `.venv` or installing missing dependencies.
- ⚡ **Live Auto-Import Watcher (`hython watch`):** Monitors your code in real-time. Whenever you save a file in VS Code or Cursor, Hython detects unbound symbols (e.g. `JsonResponse`, `requests`, `models`), auto-installs any missing packages, and inserts the import statements into your code automatically.
- 🛠️ **Zero-Boilerplate Project Scaffolding (`hython new`):** Create production-ready Django, FastAPI, Flask, or script projects in 1 command with pre-warmed virtualenvs, `.env`, `.gitignore`, and IDE configs.
- 🩺 **Self-Healing Environments:** If `.venv` is missing, corrupted, or out-of-sync, Hython recreates or synchronizes it seamlessly.
- 📦 **Dynamic Import Healing:** Intercepts `ModuleNotFoundError` during both pre-flight static analysis and runtime execution. It maps module names to PyPI packages (e.g. `yaml` → `PyYAML`, `dateutil` → `python-dateutil`, `PIL` → `Pillow`, `psycopg2` → `psycopg2-binary`) and installs them automatically.
- 🧠 **Automatic IDE & Framework IntelliSense:** Instantly writes `.vscode/settings.json`, `.vscode/extensions.json`, and `pyrightconfig.json` with Pylance depth 5 package indexing and type stubs (`django-stubs`, `django-stubs-ext`). Autocomplete and auto-import proposals work lively as you type.
- 🗄️ **Pre-Flight Django Auto-Migrations:** Detects unmade model changes via dry-run check, automatically generates migrations, and applies them before server or test launch.
- 🔌 **Auto-Wiring Django Apps:** When you run `hython manage.py startapp <app>`, Hython automatically registers the new app in `INSTALLED_APPS` inside `settings.py`.
- 🌐 **Instant Free-Port Routing:** Automatically checks if ports (8000, 5000, 8888) are busy (e.g. macOS AirPlay Receiver on port 5000) and smoothly shifts to a free port without crashing.
- 🛡️ **One-Command CORS (`hython cors`):** Configures CORS middleware for Django, FastAPI, or Flask in one command.
- 👤 **Instant Dev Superuser (`hython superuser`):** Provisions `admin`/`admin` development credentials with zero prompts.
- 🧪 **Universal Test Runner (`hython test`):** Routes Django to `manage.py test` and non-Django to `pytest` (auto-installs if missing).
- 🐳 **Production Docker Generator (`hython docker`):** Generates optimized, security-hardened `Dockerfile` and `.dockerignore`.
- 🎨 **Automated Code Formatting (`hython fmt`):** Cleans, formats, and sorts imports according to PEP 8 and framework rules using ultra-fast Ruff.

---

## Quick Command Reference

```bash
# Project Creation & Initialization
hython new django my_store     # Scaffolds Django with .venv, .env, and VS Code configs
hython new fastapi my_api      # Scaffolds FastAPI with Uvicorn and Pydantic
hython new flask my_web        # Scaffolds Flask microservice
hython init                    # Initializes project in current directory

# Live Auto-Importing & IDE Assistance
hython watch                   # Real-time watcher: injects missing imports on save
hython fix                     # One-command project-wide auto-import healing

# Running & Self-Healing Execution
hython                         # Auto-detects framework and runs dev server
hython script.py               # Runs script with automatic dependency resolution
hython test                    # Runs test suite (manage.py test or pytest)

# Developer Tools
hython add <package>           # Adds dependency to manifest and installs
hython remove <package>        # Removes dependency and uninstalls cleanly
hython cors                    # Enables CORS for frontend integration
hython superuser               # Creates dev superuser (admin/admin)
hython rollback <app>          # Reverts latest migration and deletes file
hython export                  # Exports dependencies to requirements.txt
hython docker                  # Generates production Dockerfile & .dockerignore
hython doctor                  # Runs full project & environment health audit
hython fmt                     # Formats code to PEP 8 standards
hython sync                    # Synchronizes virtual environment with manifest
hython status                  # Shows detected project and runtime status
```

---

## Complete Documentation & Walkthroughs

For in-depth guides with real-world examples:
- [Django with Hython Workflow](DOCUMENTATION.md#3-workflow-1-django-with-hython)
- [FastAPI with Hython Workflow](DOCUMENTATION.md#4-workflow-2-fastapi-with-hython)
- [Flask with Hython Workflow](DOCUMENTATION.md#5-workflow-3-flask-with-hython)
- [Python Scripts Workflow](DOCUMENTATION.md#6-workflow-4-pure-python-scripts-with-hython)
- [IDE IntelliSense & Live Auto-Import Engine](DOCUMENTATION.md#7-the-live-ide-intellisense--auto-import-engine)
- [Production & Tooling](DOCUMENTATION.md#8-production--tooling-workflows)
- [Traditional Python vs. Hython Comparison Matrix](DOCUMENTATION.md#9-developer-comparison-traditional-python-vs-hython)

---

## License

MIT License — Hython Labs

