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.

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

  • Explain file
  • Write tests for file
  • Generate new file
  • Generate documentation from 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.

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

Uploaded Source

Built Distribution

codegpt-0.0.3-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codegpt-0.0.3.tar.gz
  • Upload date:
  • Size: 15.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.3.tar.gz
Algorithm Hash digest
SHA256 945aa85adb14e09df1f8c26e2c9011794bd218bc3cf18f6fc551bd011f00690a
MD5 ffc7912ee62c33d16688e9de43253bde
BLAKE2b-256 71345da3f04b683a7e387273e09ae8ff281349cb6343948e14d28145bc367cc2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codegpt-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 15.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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 051c74c8b52e621ee0a63313d43169f691a2b4efee7dd7db076fa62783adc126
MD5 7b4ca171614313e81a50658847e03422
BLAKE2b-256 a01e49fd94797d543442c73fe4a4dff1dc7a8bf7f6d36df9a0291bcf799fbd3f

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