Skip to main content

JIT Implementation: Just-in-Time Code Generation

You've heard of Just-in-Time Compilation. Now, get ready for Just-in-Time Implementation!

Tired of writing code? Let your programs write themselves with JIT Implementation!

Quick Start

from jit_implementation import implement

@implement
class Snake:
    """Snake game in pygame. Initializing launches the game."""

if __name__ == "__main__":
    Snake()

# You've just created a fully functional Snake game in just a few lines of code!

Yes, it actually works! Who needs hundreds of lines of code when you have JIT Implementation?

What is JIT Implementation?

JIT Implementation is a groundbreaking Python library that generates your functions and classes on the fly using Large Language Models (LLMs). Simply decorate your function or class with @implement, and watch the magic unfold!

Key Features

  • Lazy Implementation: Code is dynamically created when needed.
  • Context-Aware: Analyzes your codebase to understand custom types and project structure.
  • Test-Driven Development: Provide test cases, and JIT Implementation ensures they pass.
  • Smart Caching: Stores generated implementations for reuse.

Installation

pip install jit-implementation

Advanced Usage

from typing import List
from jit_implementation import implement

@implement(
    test_functions=[
        lambda f: (f(100) == [2, 2, 5, 5], "Prime factors of 100"),
    ]
)
def prime_factors(n: int) -> List[int]:
    """Return the prime factors of n"""

assert prime_factors(100) == [2, 2, 5, 5]
assert prime_factors(69420) == [2, 2, 3, 5, 13, 89]

In-Place Code Generation

For the brave souls who trust AI completely, JIT Implementation offers an in_place=True option that rewrites the source code in the file where the function was declared:

@implement(in_place=True)
def fib(n: int) -> int:
    """Return the nth Fibonacci number"""

# After calling fib(), your source file will be updated with the implementation!

Warning: Use in_place=True with extreme caution. It will modify your source code!

How It Works

  1. Define: Provide a function or class signature with a docstring.
  2. Generate: JIT Implementation uses an LLM to create the implementation.
  3. Validate: Tests are run (if provided) and iterations are made if necessary.
  4. Cache: Generated code is stored for future use.

Warning

While powerful, use JIT Implementation responsibly:

  • Always review generated code before production use.
  • Be aware of potential security vulnerabilities.
  • Don't let it hinder your learning and problem-solving skills.

Disclaimer

This project is for educational and experimental purposes. Do not rely on it for critical systems without thorough review.

Support the Project

If you find JIT Implementation helpful or amusing, consider buying me a coffee!

Buy Me A Coffee


Note: JIT Implementation was created as a joke. While it demonstrates interesting possibilities, it's not intended for serious development use.

"The best code is the code you didn't have to write." - Anonymous JIT Implementation User

Metadata

Release files for jit-implementation 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jit-implementation 0.1.5
File Size Uploaded Provenance
jit_implementation-0.1.5.tar.gz 10.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for jit-implementation 0.1.5
File Interpreter ABI Platform
jit_implementation-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 20.1 kB

Release files / jit_implementation-0.1.5.tar.gz

Download URL jit_implementation-0.1.5.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c9edc2c51d6a7b44e6d479e99f66f5f6732cccc6d3ce03a9d58b28686e5dc538
BLAKE2b-256 checksum
How to use checksums
50ee94acfdfc5bf49d33151a715370309513f0f9e5d1bf730345021255ff22a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.5 Linux/6.11.0

Release files / jit_implementation-0.1.5-py3-none-any.whl

Download URL jit_implementation-0.1.5-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d35bb0280a0c8e6b4a6497a7a32b216d3d153d8b6217b94e84604fb6703a2d48
BLAKE2b-256 checksum
How to use checksums
f554c76c57b8df2506f9dc6cf5612ac36d5c8ff6b409709664804ecf2fcd57d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.5 Linux/6.11.0

Security for jit-implementation 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page