Skip to main content

Convert any X to any Y automatically using AI-powered code generation

Project description

Transformative

Use AI to write code to convert a type into another type.

Installation

pip install transformative

Then you can use it like this:

from transformative import init, create

init(generated_code_dir="my/path/for/generated/code/")

circle_to_square = create(Circle, Square)

square = circle_to_square(Circle(radius=1))

When the create function is called the first time, the project will use an LLM to generate a converter. First, it will write tests, then it will attempt to write code to pass those tests. If the code passes the tests, it will be saved to the generated_code_dir. Subsequent calls to the create function will use the generated code to convert the types.

Dependencies

This package requires aider-chat to be installed and available on the command line:

pip install aider-chat
# or
python -m pip install aider-install

Aider

The tool uses aider to write the code, calling out to an LLM server based on what API keys are found in your local environment. More information about configuring aider can be found here: https://aider.chat/docs/config/dotenv.html

Quick Start

See src/examples/generate_new_code.py for an example of how to use the tool.

See notes/master_plan.md for plans about future development.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

transformative-0.0.2.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

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

transformative-0.0.2-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file transformative-0.0.2.tar.gz.

File metadata

  • Download URL: transformative-0.0.2.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for transformative-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6e724b461042b393b0fb532aab7cc4df34252c2427834f1d74f1f98347f8c8db
MD5 4792238aa96de73ea1e079fbcdea6cfa
BLAKE2b-256 033100ee3ed921e36ade41c766291d5011923331fce960e7a9a905eaf2a907b1

See more details on using hashes here.

File details

Details for the file transformative-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: transformative-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for transformative-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 536f8455b0b0c11a00addc7a71985dd5e991c5c41b498be937cd1f64943ec4ea
MD5 f84d9c5381f42b80b92e63ba0f460620
BLAKE2b-256 6650e55976baf9ec40871f7c09c74985e975baefbdbd210be53ed59ecef2429c

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