Metadata-Version: 2.4
Name: po-lang-engine
Version: 4.0.0
Summary: Po-Lang Engine — A high-performance, GPU-free programming language with native AI (BigLLM, FractalImage, BitEngine)
Home-page: https://github.com/po-lang/po-lang-engine
Author: Po-Lang
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Interpreters
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary


# Po-Lang Engine v4.0.0 — 100% Complete Runtime

Po-Lang is a **100% open, stateless, boundary-free** programming language with native AI.
v4.0.0 is the **100% Complete** release — every module a production Python project needs.

## What's New in v4.0.0

### `use pay` — Payment Processing
- `pay.Card(number, exp, cvv)` — Luhn validation, Visa/Mastercard/Amex/Discover detection
- `pay.charge(card, amount, currency, desc)` — instant transaction with receipt
- `pay.Invoice()` — line-item invoices with tax, subtotal, formatted receipt
- `pay.stripe_connect(api_key)` — live Stripe API gateway
- `pay.paypal_connect(client_id, secret)` — live PayPal sandbox/production
- `pay.txn_id()` — unique transaction ID generator

### `use db` — SQLite Database
- `db.connect("myapp.db")` — open any SQLite file or in-memory DB
- Full CRUD: `create`, `insert`, `select`, `update`, `delete`
- `query(sql, params)` — raw SQL execution
- `count`, `tables`, `drop`, `begin/commit/rollback` — complete control

### `use crypto` — Cryptography
- `crypto.hash(data, "sha256/sha512/md5")` — hashing
- `crypto.encrypt(data, key)` / `crypto.decrypt(data, key)` — symmetric encryption
- `crypto.sign(payload, secret)` — JWT-like signed tokens
- `crypto.verify(token, secret)` — token verification
- `crypto.hash_password(pw)` / `crypto.verify_password(pw, hash)` — PBKDF2
- `crypto.token(32)` — secure random token, `crypto.uuid()` — UUID v4
- `crypto.b64encode` / `crypto.b64decode` — Base64

### `use regex` — Pattern Matching
- `regex.match`, `regex.search`, `regex.findall`, `regex.finditer`
- `regex.replace(pattern, repl, text)` — substitution
- `regex.split`, `regex.test`, `regex.escape`
- `regex.compile(pattern)` — reusable compiled patterns with flags (i, m, s)

### `use thread` — Concurrency
- `thread.run(fn, args)` — background thread with `.join()`, `.result()`
- `thread.pool(n)` — thread pool with `.map(fn, items)` and `.results()`
- `thread.lock()` — mutex for shared state
- `thread.channel()` — message-passing between threads
- `thread.barrier(n)` — synchronisation point
- `thread.sleep(ms)` — millisecond sleep

### `use ai` — BigLLM `merge()` (New)
- `llm["merge"](other_llm)` — bitwise OR fusion of two trained models into one brain

## Complete Module List (v4.0.0)

| Module | Description |
|---|---|
| `use ai` | BigLLM, FractalImage, Trainer, Tokenizer, AutoML |
| `use pay` | Card, charge, Invoice, Stripe, PayPal |
| `use db` | SQLite CRUD, raw SQL, transactions |
| `use crypto` | Hash, encrypt, sign/verify, PBKDF2, UUID |
| `use regex` | match, search, findall, replace, split, compile |
| `use thread` | run, pool, lock, channel, barrier |
| `use net` | HTTP server/client, BPP binary protocol, SSC security |
| `use io` | File read/write/append, CSV, binary |
| `use json` | parse, stringify, pretty-print |
| `use math` | trig, log, statistics, matrix ops |
| `use time` | now, sleep, format, clock |
| `use random` | int, float, choice, shuffle, sample |
| `use os` | cwd, listdir, mkdir, env, path ops |
| `use sys` | argv, exit, stdout, version |
| `use ffi` | Call native C/Python libraries |

## Full Example

```po
use ai
use pay
use db
use crypto

# AI — train and save a 1-billion-param model
keep llm = ai.BigLLM()
llm["set_context"](4096)
llm["train"](["Enterprise 2026 knowledge base"], 3)
llm["save"]("enterprise.po_pack")

# Payment — process a Visa card
keep card = pay.Card("4111111111111111", "12/27", "123")
keep txn = pay.charge(card, 99.99, "USD", "Po-Lang Enterprise License")
show txn["id"]

# Invoice — generate receipt
keep inv = pay.Invoice()
inv["add"]("Enterprise License", 99.99, 1)
inv["add"]("Support Pack", 19.99, 12)
show inv["receipt"]("USD", 10)

# Database — store transaction
keep conn = db.connect("transactions.db")
conn["create"]("txns", {"id": "TEXT", "amount": "REAL", "status": "TEXT"})
conn["insert"]("txns", {"id": txn["id"], "amount": 99.99, "status": "approved"})

# Crypto — sign a token
keep tok = crypto.sign({"user": "alice", "role": "admin"}, "my_secret")
keep data = crypto.verify(tok, "my_secret")
show data["user"]
```

## Install
```bash
pip install --upgrade po-lang-engine
pop run myfile.po
pop repl
```

## Core Complete Manifesto (v3.2.0)

### 1. Pure Dynamic Runtime (Python-style Freedom)
- Dynamic typing: variables change type anytime, anywhere
- Unrestricted control flow: nested loops, custom conditionals, dynamic functions
- Stateless execution: no background cache, no data locks — every step developer-controlled

### 2. No-Boundary File System
- **Any extension, any path:** `.po_pack`, `.brain`, `.weights`, `.dat`, or none
- **Multi-model generation:** loop in one script → hundreds of named model files
- Developer owns all state — engine writes exactly what developer commands

### 3. Infinite Context Window
- `llm["set_context"](n)` — from 8 tokens to unlimited (no upper cap)
- Modes: SHORT (<512), LONG-RANGE (≥512), INFINITE (≥1,000,000)
- 50% overlapping windows for maximum long-range dependency learning

### 4. Incremental Fine-Tune (1-bit XOR Adjustment)
- Base vocab intact — existing knowledge never erased
- New tokens appended, old patterns preserved
- Zero float math, zero GPU — pure bitwise XOR co-occurrence

## Full API

```po
use ai
use net

keep llm = ai.BigLLM()

# Infinite context — no upper limit
llm["set_context"](8192)

# Load enterprise base model (any filename/path)
llm["load"]("/var/models/global_base.weights")

# Fine-tune with new domain data
keep custom_data = ["Enterprise documentation 2026...", "New system rules..."]
llm["fine_tune"](custom_data, 5)

# Save to any custom path/name
llm["save"]("/var/models/my_custom_brain.weights")

# Generate & stream
keep reply = llm["generate"]("Po-Lang is", 128)
show reply

fn on_token(word, idx, done) { show word }
llm["stream"]("GPU-free AI", on_token, 64, 30)

# Fractal image synthesis
keep img = ai.FractalImage()
img["generate"]("sunset over mountains", 80, 24)
img["ascii"]()
img["save"]("output.ppm")
```

## Complete BigLLM API

| Method | Description |
|---|---|
| `llm["set_context"](n)` | Context window 8 → unlimited |
| `llm["train"](data, epochs)` | 1-bit streaming backprop, no GPU |
| `llm["fine_tune"](data, epochs)` | Incremental XOR adjustment, base intact |
| `llm["generate"](prompt, tokens)` | Text generation |
| `llm["stream"](prompt, fn, tokens, ms)` | Word-by-word streaming |
| `llm["save"]("any/path.ext")` | Binary save, any name/path/ext |
| `llm["load"]("any/path.ext")` | CRC32-verified load |
| `llm["info"]()` | Stats: vocab, ctx, params, version |

## Features
- Native AI/ML: Regression, Classification, KNN, Tokenizer, BigLLM, FractalImage
- Infinite context window (8 → unlimited tokens)
- Fine-tune: incremental 1-bit XOR, base model always preserved
- 1-bit XNOR+Popcount BitEngine (30× faster than Python float ops)
- Any filename/extension/path for save & load
- HTTP server with optional BPP binary encoding and SSC security
- REPL, bytecode compiler, and `pop` CLI
- Zero heavy dependencies — only standard Python

## Install
```bash
pip install --upgrade po-lang-engine
pop run myfile.po
pop repl
```
