Build Python code using natural language as a universal interface
Project description
pycodeless
Warning This project is in a very early stage of development and may not always produce desired results. See the limitations section for more information.
Pycodeless integrates the power of LLMs into the Python programming language and allows you to use natural language as a universal interface for code generation.
Features
- The
@codeless
decorator allows you to define your functions using natural language. All generated code is stored and can be edited or commited to your version control system. - Support for different language models to allow for better customization and offline usage.
- Custom docstring formatting to allow for referencing objects across the whole codebase.
Installation
You can install pycodeless using pip:
pip install pycodeless
Usage
Following is a sample code using pycodeless.
from pycodeless import codeless
codeless.openai_api_key = (
"Paste your OpenAI API key here or set the 'OPENAI_API_KEY' environment"
"variable!"
)
@codeless
def greet(name: str) -> str:
"""
Make greeting for a person with the given name
"""
@codeless
def spongebob_case(text: str) -> str:
"""
Convert the passed text into spongebob case
"""
def main():
print(spongebob_case(greet("Bob")))
if __name__ == "__main__":
main()
Limitations
- The current code generation and parsing features might be buggy, as there's currently no mechanism for telling whether an output from an LLM is actually runnable Python code.
- The
@codeless
decorator may not work in all contexts.
Contribution
If you'd like to report a bug or have an idea for a cool feature, issues and pull requests are highly appreciated.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pycodeless-0.2.1.tar.gz
(6.0 kB
view hashes)
Built Distribution
Close
Hashes for pycodeless-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68323c3423cd001e5425ae4a69c96b5ec972ba765c7e9f7665a36d2b6c64b4fa |
|
MD5 | f5a0faa3502ee2bad49dac6140b97314 |
|
BLAKE2b-256 | a3507bff39318417024b1d3cc345ea535ed850285fb90e8eaa25b3a6d0bac074 |