Skip to main content

A CLI tool for refactoring Python code using OpenAI's text-davinci-003 model

Project description

Codegpt

0.1.5

A tool for using GPT just a little quicker. A nearly truly automated footgun. Learn how to revert with git before trying please.

Posting about progress here:

Twitter Follow

Getting Started

pip install codegpt --upgrade

And set your openapi API key as an environment variable like they recommend: In their docs here

Windows users can also use setx like:

$ setx OPENAI_SECRET_KEY=<YOUR_API_KEY>

from an admin console.

Be careful! But try this:

Usage To try Codegpt, you can run the following command:

codegpt todo do <filename>

This will prompt you for a description of what needs to be done and give you the option to edit the todo list before refactoring the code.

Or use the gen command to generate docs.

codegpt gen docs <filename>

For more advanced users, you can use the codegpt unsafe command, which allows you to:

Change variable names

codegpt unsafe varnames <filename>

Add comments to your code automatically

codegpt unsafe comment <filename>

Edit any file

codegpt unsafe edit <filename> "Break this up into smaller functions where you can. Add google style docstrings. Feel free to rewrite any code doesn't make sense."

Keep in mind that using GPT-3 for code generation is paid, with a cost of 2 cents per 1,000 tokens.

Just like with a Jr Dev, it's best to break up your tasks into smaller pieces to improve the results.

Propose endpoints as issues, I've got a few ideas:

  • Write tests for file
  • Generate SQL query from table spec files
  • Generate new file

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

codegpt-0.1.5.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

codegpt-0.1.5-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file codegpt-0.1.5.tar.gz.

File metadata

  • Download URL: codegpt-0.1.5.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.10.6 Windows/10

File hashes

Hashes for codegpt-0.1.5.tar.gz
Algorithm Hash digest
SHA256 cf15f65cf5c673e1de4d0c43d486c8eeec1c98ceabc5507701188bb5be298327
MD5 3f4296729c1a529447d09635fe926332
BLAKE2b-256 422aa803d56d6c828c84c3aa21f39f3f7212ce644d7cb14d0d0f06c7548f8620

See more details on using hashes here.

File details

Details for the file codegpt-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: codegpt-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.10.6 Windows/10

File hashes

Hashes for codegpt-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 79cb7f4acfd9d0e857e6fcee95b1e5335cc41bbdd15aae3e72d8a0848184cc8b
MD5 e6e51a61f8e668e802cf73929a828320
BLAKE2b-256 a3697d36f7c71a256e773d1dac81913421ace9bd33bb9bea23626552ecdcc9cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page