Skip to main content

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 ✓
  1. You call nirmal.make() with a plain-English description.
  2. The package sends a POST request to the PHP backend.
  3. The backend forwards the prompt to Groq with streaming enabled.
  4. Each token is forwarded back to Python as it arrives.
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nirmal-1.0.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nirmal-1.0.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file nirmal-1.0.0.tar.gz.

File metadata

  • Download URL: nirmal-1.0.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for nirmal-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e37752e3068dd48892fce377e50320d7234a06eda35214e878f9e09553b5c35b
MD5 3dc4c69cb4bcb72b2ef8debd18677057
BLAKE2b-256 8a996585eb71ad0db3864714c47742b9217c7bca432281d373b538dbda8cdcae

See more details on using hashes here.

File details

Details for the file nirmal-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: nirmal-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for nirmal-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad26f639a05b5e99fe8fb919f7f8149dedbb1c97eceacc9279ced7d6cfbfaf3e
MD5 129f1980a0c895c00c30bb3c57492b47
BLAKE2b-256 0245995bc5bb0b2631e75e47c8b2d30f730098e503c46f9c0d77c7208d11dc7a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page