AI-powered code generation streamed live to your terminal.
Project description
nirmal ⚡
AI-powered code generation, streamed live to your terminal.
import nirmal
nirmal.make("create a snake game in pygame")
Code starts appearing instantly — character by character — as the AI writes it in real time.
Installation
pip install nirmal
Requires Python 3.8+.
Quick Start
import nirmal
# Generate a complete script from a single sentence
nirmal.make("build a REST API with FastAPI that has CRUD routes for a todo list")
That's it. The generated code streams directly into your terminal.
More Examples
import nirmal
# Games
nirmal.make("create a tetris clone using pygame")
# Web
nirmal.make("build a flask web app with user login and a dashboard")
# Scripts
nirmal.make("write a python script that watches a folder and renames files by date")
# Data
nirmal.make("create a pandas script that reads a CSV, cleans missing values, and plots a bar chart")
# Automation
nirmal.make("write a selenium script that logs into a website and scrapes product prices")
How It Works
Your Python code
│
▼
nirmal.make("your prompt")
│
▼ POST /nirmal/generate.php
PHP Backend (Hostinger)
│
▼ Groq API (llama-3.3-70b-versatile)
Streaming AI response
│
▼ Chunk by chunk
Live terminal output ✓
- You call
nirmal.make()with a plain-English description. - The package sends a POST request to the PHP backend.
- The backend forwards the prompt to Groq with streaming enabled.
- Each token is forwarded back to Python as it arrives.
- Python prints each chunk live — no waiting for the full response.
Configuration
If you host your own backend, edit nirmal/config.py:
BACKEND_URL = "https://your-domain.com/nirmal/generate.php"
REQUEST_TIMEOUT = 60 # seconds
Package Structure
nirmal/
├── nirmal/
│ ├── __init__.py ← public API (make)
│ ├── client.py ← streaming HTTP client
│ ├── config.py ← endpoint + timeout settings
│ └── utils.py ← markdown cleanup helper
├── backend/
│ ├── generate.php ← PHP streaming proxy to Groq
│ └── .htaccess ← security rules for Hostinger
├── pyproject.toml ← pip package config
├── README.md
└── LICENSE
Publishing to PyPI
1. Install build tools
pip install build twine
2. Build the distribution
cd nirmal-project
python -m build
This creates dist/nirmal-1.0.0.tar.gz and dist/nirmal-1.0.0-py3-none-any.whl.
3. Upload to PyPI
twine upload dist/*
You'll need a PyPI account and an API token.
4. Install from PyPI
pip install nirmal
Deploying the PHP Backend on Hostinger
1. Connect via FTP or File Manager
Log in to Hostinger → hPanel → File Manager (or use FileZilla).
2. Upload the backend files
Upload backend/generate.php and backend/.htaccess to:
public_html/nirmal/
3. Set your Groq API key
Open generate.php and replace the placeholder:
define('GROQ_API_KEY', 'your-real-groq-api-key-here');
Get your key at console.groq.com.
4. Test the endpoint
curl -X POST https://hub-5.angelthesis.com/nirmal/generate.php \
-d "prompt=print hello world in python"
You should see code stream back in your terminal.
Security Recommendations
| Concern | Recommendation |
|---|---|
| API key exposure | Never commit generate.php with a real key. Use environment variables if possible. |
| Open access | Add a shared secret token validated in generate.php (see code comments). |
| Rate limiting | Hostinger plans support .htaccess rate limiting; see .htaccess comments. |
| HTTPS | Always use HTTPS — Hostinger provides free SSL via Let's Encrypt. |
| Input length | generate.php caps prompt length at 2000 characters server-side. |
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nirmal-1.0.1.tar.gz.
File metadata
- Download URL: nirmal-1.0.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28049727dae849f74f2c6c9c1052baf0edf0cf4f67b7b1dcb3e8abf5fa083520
|
|
| MD5 |
e5f2b226e1929365d8f3ad76c1852a1a
|
|
| BLAKE2b-256 |
5c52717f02eb91b7fefe12d87e3655e6901c62724b427c6568d086d1805ec322
|
File details
Details for the file nirmal-1.0.1-py3-none-any.whl.
File metadata
- Download URL: nirmal-1.0.1-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b89874f9c8a99be3273b2a6f576eecdb086796942cc1f312a077f75515d94fa
|
|
| MD5 |
3b5d4c1a4bf069bfa376c4a0a2eae361
|
|
| BLAKE2b-256 |
a8f753bc3eb22a45c45bb53867f4b6ca80e7816dc597edb69988a56cc32a182b
|