Upload Python files in a directory to a GitHub Gist.
Project description
code2gist 📦
code2gist
is a Python package that makes sharing your code projects easier than ever. With a simple command, it lets you upload your code files to GitHub's Gist. code2gist
is available on PyPI.
The package works hand-in-hand with OpenAI's ChatGPT-4's 'Browse with Bing' feature. This compatibility allows you to present substantial code bases to the model in a single instance, eliminating the need to split your code into smaller parts. 🤝
Another key feature of code2gist
is its ability to handle a wide range of text-based file types, not just Python files. 📄
In addition, code2gist
comes with a prune
feature that provides a clean way to remove all the gists created by this tool from your GitHub account. 🪓
Installation ⚙️
You can install the package via pip:
Copy code
pip install code2gist
Adding code2gist Directory to the PATH Environment Variable 👣
Here are step-by-step instructions to add the code2gist directory to your PATH environment variable on Windows:
- Open the Control Panel.
- Navigate to System and Security > System.
- Click on the Advanced system settings link on the left panel.
- Click Environment Variables.
- Under the System Variables section, find and double-click the variable PATH.
- Click New.
- Add the directory where code2gist is installed. For example, if you have Python 3.11 installed, the directory might look like this:
C:\...\Python311\Scripts
- Click OK to close all windows and save the changes.
After following these steps, your system should recognize code2gist commands from any directory in the command line. 👍
GitHub Token 🔑
code2gist
requires a GitHub token to function. You need to create a new token with the gist
scope (which allows it to create gists). Follow this guide to create a new token.
Once you have your token, you should store it in the "GITHUB_TOKEN" environment variable. Here are the steps to set this variable in Windows:
- Open the Control Panel.
- Search for "Environment Variables".
- Click on "Edit the system environment variables".
- In the System Properties window that appears, click the "Environment Variables..." button.
- In the Environment Variables window, click the "New..." button under the "User variables" section.
- Enter "GITHUB_TOKEN" as the variable name and your token as the variable value.
- Click "OK" on all open windows to apply the changes.
Please ensure that you have this variable set before using the package. ✅
Usage 🚀
Uploading Files 📤
To use code2gist
, simply use the following command:
Copy code
code2gist .
This command will upload all Python files in the current directory to a private Gist on your GitHub account. The Gist will be titled with the name of the current directory, followed by "[code2gist]".
If you want to include files with different extensions, you can specify them using the --ext
option:
cssCopy code
code2gist . --ext .txt .md .py
This command will include all text, Markdown, and Python files in the upload.
Deleting Gists 🗑️
The prune
feature allows you to delete all gists created by code2gist
:
cssCopy code
code2gist --prune
Running this command will delete all your gists with "[code2gist]" in the description.
.gitignore Support ✅
code2gist
respects .gitignore
rules. Files that match a rule in the .gitignore
file of the directory being uploaded will be skipped. In addition, by default, code2gist
skips files and directories that start with a dot (.
), although this behavior may change in future versions to strictly adhere to .gitignore
.
Note 📝
The gists created by code2gist
are private by default, providing a safe way for you to share your code without making it publicly available.
Please remember that code2gist
is a tool for sharing code and should not be used to share sensitive information. Always ensure that your files do not contain any confidential data before uploading them.
License ⚖️
code2gist
is licensed under the GNU General Public License v3.0.
We hope code2gist
serves as a valuable tool in your development toolkit. Happy coding! 💻👨💻
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
Built Distribution
File details
Details for the file code2gist-1.1.4.tar.gz
.
File metadata
- Download URL: code2gist-1.1.4.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6cdcc5ba1892b298d0792fe3ecfdf87e2efb98aab448277a0ac189ac0f48980 |
|
MD5 | a0a59debfee34ad8bf434d536ec7d17e |
|
BLAKE2b-256 | ab5b721d6cc8ac07279c779d6a5df219eeb1c84cc7cd85561d2853a0830d3802 |
File details
Details for the file code2gist-1.1.4-py3-none-any.whl
.
File metadata
- Download URL: code2gist-1.1.4-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 672a1df265f5b2a371da4403afe193dcd0fd72e39813622a45f394b0d84ffa09 |
|
MD5 | aca780566c79b8a1fafdd7addb3e9099 |
|
BLAKE2b-256 | 5befda01ed3feb942c61f859a0eec2baea9fa9626852bda104a36bca9e45132d |