Skip to main content

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

Project description

Codegpt

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

Getting Started

pip install codegpt

Then find a file you hate (Back it up! Don't do it live!) and give it a shot.

codegpt refactor .\helper.py "Break this up into smaller functions where you can. Add google style docstrings. Feel free to rewrite any code doesn't make sense."

You'll see something like:

This prompt is 254 tokens, are you sure you want to continue?
The most GPT-3 can return in response is 3843. [y/N]: y

(and after a short wait...)

Explanation: The code has been refactored into smaller functions to improve readability, and Google style docstrings have been added.

Other things to try:

  • codegpt edit - For editing markdown files, including code blocks. Hello, blog editor!
  • codegpt varnames - Changes variable names (and supposed to only be variable names...) to be readable
  • codegpt comment - Automatically add comments to a file.

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

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

Just remember this is paid - 2 cents per 1k tokens is a lot when you're working on files with a few hundred lines.

And remember to break up what you're working on - Results will be better with less moving parts and things to do.

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.0.6.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

codegpt-0.0.6-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codegpt-0.0.6.tar.gz
  • Upload date:
  • Size: 16.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.0.6.tar.gz
Algorithm Hash digest
SHA256 f3f288e3603f11373de86dfb8e2a31ffea0fb34acd24552d2e990f6e6397be5b
MD5 0b260db42217184553cef9a3df483a28
BLAKE2b-256 53088d409b968d332f9720242d8e654338fae7b592f614ddcea8e95171647d9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codegpt-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 16.6 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.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4769756a59fb44a464e83f41f069aa830fd000d12aee94eded79784d8f448910
MD5 b3e73c93a625b959136a23abd21b78f6
BLAKE2b-256 d64b0a06247903717e5ad9452c1923056593e706021b01311dd7762cb8a03ffc

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