writecode
writecode is a command-line tool that generates code from text prompts using OpenAI's Codex model. With writecode, you can quickly and easily generate code snippets in a variety of languages without having to write any code yourself.
Installation
To install writecode, you will need to have Python 3 and pip installed on your system. Then, you can use pip to install the writecode package from PyPI:
pip install writecode
Usage
The main function in writecode is writecode.code, which takes the following keywords:
prompt(required): A string containing the text prompt with the instructions for Codex.lang(optional): The language to generate code in. The default is Python.tokens(optional): An integer specifying the maximum number of output tokens.best_of(optional): An integer specifying the number of completions to generate server-side and return the "best" (the one with the highest log probability per token). The default is 3.save(optional): The name of the output file to save the code snippet to.
Here's an example of how to use the code function to generate a Python code snippet and save it to a file:
from writecode import code
prompt = "Write a function that takes a list of integers and returns the sum of the even numbers in the list."
code(prompt, lang='python', tokens=1000, save='output.py')
This will generate a Python code snippet, followed by an explanation, with up to 1000 tokens and save it to a file called output.py.
Example output:
def sum_even(list):
sum = 0
for i in list:
if i % 2 == 0:
sum += i
return sum
print(sum_even([1,2,3,4,5,6,7,8,9,10]))
# The function takes a list of integers and returns the sum of the even numbers in the list.
# The function first creates a variable called sum and sets it equal to 0.
# The function then loops through the list and checks if the number is even.
# If the number is even, the function adds it to the sum variable.
# The function then returns the sum variable.
# The function is then called and the list is passed as an argument.
# The function returns the sum of the even numbers in the list.
Supported Languages
writecode currently supports code generation for the following languages:
- Python
- HTML
- C++
- Java
- JavaScript
- C#
- Go
- Ruby
- Swift
- PHP
This list is not exhaustive and may be updated in the future as the Codex model continues to evolve.
Limitations
writecode is powered by OpenAI's Codex model, which is a powerful tool for generating code from text prompts. However, it is not perfect and may not always produce accurate or complete code snippets. It is important to carefully review the generated code before using it in any production systems.
Metadata
Release files for writecode 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| writecode-0.1.3.tar.gz | 3.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| writecode-0.1.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 7.7 kB
Release files / writecode-0.1.3.tar.gz
| Download URL | writecode-0.1.3.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f6b1d4ce9dd61cd9d09edca17fea7d75c00e0b13a3a0630cca7f1996a523796
|
|
BLAKE2b-256 checksum How to use checksums |
74aa297b918a2282084f5f822ca50df80590a00bf1e403b6b96dbaf13601e05a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Release files / writecode-0.1.3-py2.py3-none-any.whl
| Download URL | writecode-0.1.3-py2.py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
560ab1f06450b5b772f60d194335dec677b0da861c6714220fa819f2d11fed11
|
|
BLAKE2b-256 checksum How to use checksums |
9b8b5c61da61b00f012f3d7fcc01ebcd54d337f368c05f8e265860dd1c54634c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Security for writecode 0.1.3
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.