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.4.tar.gz (18.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.4-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: transformative-0.0.4.tar.gz
  • Upload date:
  • Size: 18.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.4.tar.gz
Algorithm Hash digest
SHA256 d55482026c954943e178ccbb711ea10858f2525b4d24a654a2e99de700220bda
MD5 7b55341b844471a233f84ed792467f5c
BLAKE2b-256 66834cef33540a32dd3d02d81c11ba0def1c4548a34fa6c06a5cd5cf77b38004

See more details on using hashes here.

File details

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

File metadata

  • Download URL: transformative-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 22.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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 91063bf4cacc39309a1a6ebf0522ca95f3b323e7c3b32042c7c3e3d3e7513b1d
MD5 aaf752c01327b76758fb99d397946750
BLAKE2b-256 4c951005de48e7c60280e28ae9770ca515f690b23fd6d695e82c1b05c4f55741

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