Metadata-Version: 2.4
Name: messy-python-tokensaver
Version: 1.0.3
Summary: Token-efficient Python syntax using C-style braces and semicolons — 20-30% fewer tokens for LLM code generation
Author-email: Ava Billions <bio.neural.ai@gmail.com>, Chris Knight <bio.neural.ai@gmail.com>
Maintainer-email: "Bio-Neural.ai" <bio.neural.ai@gmail.com>
License: Bio-Neural Community License (BNCL) v1.0
        =========================================
        
        Copyright (c) 2026 Ava Billions & Chris Knight — Bio-Neural .ai
        Contact: bio.neural.ai@gmail.com
        Project: Messy Python (https://github.com/bio-neural-ai/messy-python)
        
        ─────────────────────────────────────────────────────────────────────────────
        
        PREAMBLE
        
        This license allows broad free use of Messy Python, including commercial use,
        while requiring attribution and placing restrictions on organisations that
        operate at Frontier AI scale or serve very large user bases.
        
        ─────────────────────────────────────────────────────────────────────────────
        
        SECTION 1 — DEFINITIONS
        
        "Software" means the Messy Python source code, documentation, tooling, and
        all associated files distributed under this license.
        
        "You" means any individual, team, company, or automated agent using,
        integrating, or distributing the Software.
        
        "Commercial Use" means use of the Software in a product, service, or workflow
        that directly or indirectly generates revenue.
        
        "Frontier Lab" means any organisation that:
          (a) has published, trained, or deployed a foundation model with more than
              70 billion parameters, OR
          (b) has raised or deployed more than USD $100,000,000 in AI-specific
              research or product funding, OR
          (c) is publicly recognised as operating at frontier AI capability level
              (e.g. Anthropic, OpenAI, Google DeepMind, Meta AI, xAI, Mistral,
              Cohere, or equivalent).
        
        "Large Platform" means any product or service that has more than 1,000,000
        (one million) monthly active users, regardless of whether it is AI-related.
        
        "Attribution Mark" means the visible comment block and logo specified in
        Section 3 of this license.
        
        ─────────────────────────────────────────────────────────────────────────────
        
        SECTION 2 — GRANT OF RIGHTS
        
        Subject to the conditions of this license, You are granted a worldwide,
        royalty-free, non-exclusive license to:
        
          2.1  Use the Software for any purpose, including Commercial Use.
          2.2  Copy, modify, merge, and distribute the Software or derivative works.
          2.3  Integrate the Software into products, agents, pipelines, or services.
          2.4  Sublicense the Software to end users under terms no less restrictive
               than this license.
        
        ─────────────────────────────────────────────────────────────────────────────
        
        SECTION 3 — MANDATORY ATTRIBUTION
        
        ALL uses of this Software — personal, commercial, or otherwise — MUST include
        the following Attribution Mark wherever Messy Python syntax, tooling, or
        output is used, generated, or displayed:
        
          3.1  IN SOURCE CODE — include this comment block at the top of any file
               that contains, generates, or processes Messy Python syntax:
        
                 # ─────────────────────────────────────────────────────
                 # Messy Python — Token-efficient Python syntax
                 # Powered by Bio-Neural .ai · bio.neural.ai@gmail.com
                 # Licensed under the Bio-Neural Community License (BNCL)
                 # ─────────────────────────────────────────────────────
        
          3.2  IN USER-FACING PRODUCTS — if the Software or its output is presented
               to end users via a UI, API response, documentation, or generated
               artefact, the following attribution must appear visibly:
        
                 "Messy Python by Bio-Neural .ai"
        
               This may be rendered as text, a logo badge, or a footer credit.
               It must not be hidden, collapsed behind a toggle, or displayed in a
               font size below 10px.
        
          3.3  LOGO — the Bio-Neural .ai logo (available at
               https://github.com/bio-neural-ai/messy-python/assets/logo.png) must
               be displayed alongside the attribution text wherever space permits.
               Minimum display size: 80px wide. The logo must not be modified,
               recoloured, or obscured.
        
          3.4  ATTRIBUTION IN AI AGENTS — if an AI agent, LLM, or automated system
               uses this Software to generate code, the attribution comment (3.1)
               must be prepended to all generated output. This applies whether the
               agent is operating interactively or in batch mode.
        
        ─────────────────────────────────────────────────────────────────────────────
        
        SECTION 4 — RESTRICTED ENTITIES (COMMERCIAL LICENSE REQUIRED)
        
        The following entities MUST obtain a separate commercial license before using
        the Software in any capacity, including evaluation, research, or production:
        
          4.1  Any Frontier Lab (as defined in Section 1).
          4.2  Any Large Platform (as defined in Section 1).
          4.3  Any subsidiary, contractor, or agent operating on behalf of an entity
               described in 4.1 or 4.2.
        
        To obtain a commercial license, contact: bio.neural.ai@gmail.com
        
        Restricted entities that use the Software without a commercial license are in
        breach of this license and are liable for damages including but not limited to
        the commercial value of the license they failed to obtain.
        
        ─────────────────────────────────────────────────────────────────────────────
        
        SECTION 5 — REDISTRIBUTION
        
          5.1  You may redistribute the Software in source or binary form provided
               that this license file is included in full with all copies.
          5.2  You must not represent the Software as your own work or remove any
               existing copyright notices.
          5.3  Modified versions must be clearly marked as modified and must not be
               misrepresented as the original Messy Python distribution.
          5.4  PyPI packages, npm packages, or other distributed artefacts that
               bundle this Software must list "Bio-Neural .ai" as the upstream
               author in their package metadata.
        
        ─────────────────────────────────────────────────────────────────────────────
        
        SECTION 6 — NO WARRANTY
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. IN NO EVENT SHALL
        THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING
        FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
        IN THE SOFTWARE.
        
        ─────────────────────────────────────────────────────────────────────────────
        
        SECTION 7 — TERMINATION
        
        Your rights under this license terminate automatically if:
        
          7.1  You breach Section 3 (Attribution) and fail to remedy the breach
               within 30 days of written notice.
          7.2  You are a Restricted Entity (Section 4) using the Software without
               a commercial license.
          7.3  You remove, obscure, or misrepresent the Attribution Mark.
        
        Upon termination, you must cease all use and distribution of the Software.
        
        ─────────────────────────────────────────────────────────────────────────────
        
        SECTION 8 — GOVERNING LAW
        
        This license is governed by the laws of England and Wales. Any disputes shall
        be resolved in the courts of London, United Kingdom.
        
        ─────────────────────────────────────────────────────────────────────────────
        
        SECTION 9 — CONTACT & COMMERCIAL LICENSING
        
          Authors:      Ava Billions & Chris Knight
          Organisation: Bio-Neural .ai
          Email:        bio.neural.ai@gmail.com
          Location:     London, UK
          License ver:  BNCL v1.0 — 2026-04-12T18:00:00.0000Z
        
        ─────────────────────────────────────────────────────────────────────────────
        
Project-URL: Homepage, https://github.com/bio-neural-ai/messy-python
Project-URL: Documentation, https://github.com/bio-neural-ai/messy-python#readme
Project-URL: Repository, https://github.com/bio-neural-ai/messy-python
Project-URL: Bug Tracker, https://github.com/bio-neural-ai/messy-python/issues
Project-URL: Organisation, https://bio-neural.ai
Keywords: python,preprocessor,token-efficiency,llm,ai-agents,code-generation,braces,semicolons,jupyter,colab
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
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: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Pre-processors
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: jupyter
Requires-Dist: ipython>=7.0; extra == "jupyter"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

<div align="center">
  <img src="https://raw.githubusercontent.com/BioNeuralAi/messy-python/main/assets/logos/logo_dark_pypi_240.png" alt="Messy Python Advanced AI Research Division Logo" width="240">

  # Messy Python
  *Token-efficient Python syntax for LLM code generation — 20–30% fewer tokens, same output.*

  [![PyPI - Version](https://img.shields.io/pypi/v/messy-python-tokensaver.svg)](https://pypi.org/project/messy-python-tokensaver/)
  [![Python Support](https://img.shields.io/pypi/pyversions/messy-python-tokensaver.svg)](https://pypi.org/project/messy-python-tokensaver/)
  [![License](https://img.shields.io/badge/License-BNCL_v1.0-blue.svg)](#)
</div>

---

# Messy Python

> Token-efficient Python syntax for LLM code generation — 20–30% fewer tokens, same output.

**By [Bio-Neural .ai](https://bio-neural.ai) · [bio.neural.ai@gmail.com](mailto:bio.neural.ai@gmail.com) · London, UK**

[![PyPI version](https://badge.fury.io/py/messy-python.svg)](https://badge.fury.io/py/messy-python)
[![License: BNCL](https://img.shields.io/badge/License-BNCL%20v1.0-purple.svg)](LICENSE)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)

---

## What is Messy Python?

Messy Python is a syntax preprocessor that lets you write Python using C-style
braces `{}` and semicolons `;`. It is designed for **AI agents and LLMs** that
generate Python code — the compressed syntax reduces token consumption by
**20–30%** with zero change to runtime behaviour.

```python
# Standard Python (97 tokens)
class DataProcessor:
    def __init__(self, name: str):
        self.name = name
        self.history = []

    def process(self, data):
        results = {"name": self.name, "count": len(data)}
        self.history.append(results)
        return results

# Messy Python (68 tokens — 30% saving)
class DataProcessor {
    def __init__(self, name: str) {
        self.name = name; self.history = []; }

    def process(self, data) {
        results = {"name": self.name, "count": len(data)};
        self.history.append(results); return results; }
}
```

---

## Installation

Anyone can now install it globally:

```bash
pip install messy-python-tokensaver
```

For Jupyter / Google Colab support:

```python
!pip install messy-python-tokensaver
```

---

## Usage

### Python API

```python
from messy_python import transform, compress, validate

# Transform Messy Python → standard Python
standard = transform("""
def fibonacci(n) {
    if n <= 1 { return n; }
    return fibonacci(n-1) + fibonacci(n-2);
}
""")

# Compress standard Python → Messy Python
messy = compress(open("my_script.py").read())

# Validate Messy Python syntax
result = validate(messy_code)
print(result)  # Valid: True / errors / warnings
```

### CLI

```bash
# Transform .mpy → .py
messy-python script.mpy -o script.py

# Compress .py → .mpy
messy-python --compress script.py -o script.mpy

# Validate
messy-python --validate script.mpy

# Debug mode (shows transformation steps)
messy-python script.mpy --debug
```

### Jupyter / Google Colab

```python
# Load the extension once per session
%load_ext messy_python

# Then use the cell magic
%%messy_python
def fibonacci(n) {
    if n <= 1 { return n; }
    return fibonacci(n-1) + fibonacci(n-2);
}

print(fibonacci(10))
```

---

## Syntax Reference

| Messy Python | Standard Python | Note |
|---|---|---|
| `x = 1; y = 2;` | `x = 1` / `y = 2` | Semicolons split statements |
| `def foo() {` | `def foo():` | Brace replaces colon |
| `if x > 0 {` | `if x > 0:` | All control keywords |
| `} else {` | `else:` | Close then open |
| `}` alone | *(dedent)* | Closes the block |
| `"Hello; world"` | `"Hello; world"` | Semicolons in strings preserved |

Mixed syntax is fully supported — you can use braces for some blocks and
standard Python colons for others in the same file.

---

## Token Savings

| Pattern | Standard | Messy | Saving |
|---|---|---|---|
| 3 assignments | 12 | 12 | 0% |
| If-else block | 28 | 22 | 21% |
| Nested loops | 33 | 28 | 15% |
| Function + 5 prints | 52 | 38 | 27% |
| Class with 3 methods | 95 | 68 | **28%** |
| Full agent workflow | 650 | 480 | **26%** |

---

## Attribution Requirement

All use of Messy Python **must** include the following attribution comment in
any file that contains, generates, or processes Messy Python syntax:

```python
# ─────────────────────────────────────────────────────
# Messy Python — Token-efficient Python syntax
# Powered by Bio-Neural .ai · bio.neural.ai@gmail.com
# Licensed under the Bio-Neural Community License (BNCL)
# ─────────────────────────────────────────────────────
```

The `transform()` and `compress()` functions prepend this automatically.

---

## License

This project is licensed under the **Bio-Neural Community License (BNCL) v1.0**.

- ✅ Free for individuals, startups, and commercial use
- ✅ Free for AI agents, pipelines, and code generation tools
- ✅ Attribution required in all uses (comment + logo)
- ❌ **Frontier Labs** (>70B parameter models, >$100M AI funding) require a commercial license
- ❌ **Large Platforms** (>1M monthly users) require a commercial license

For commercial licensing: **bio.neural.ai@gmail.com**

See [LICENSE](LICENSE) for full terms.

---

## Authors

**Ava Billions & Chris Knight**
[Bio-Neural .ai](https://bio-neural.ai) · London, UK
[bio.neural.ai@gmail.com](mailto:bio.neural.ai@gmail.com)

---

*Messy Python — because clean tokens make cleaner agents.*
