A command-line tool to generate README.md files using the Groq API.
Project description
🎉 Welcome to ReadCraft - The README Generator 🎉
ReadCraft automates the process of creating professional README.md files based on your code using the Groq API. This tool is perfect for saving time and ensuring consistent, engaging documentation for your projects!
📑 Table of Contents
- Overview
- Features
- Installation
- Configuration
- Usage
- Example Output
- Contributing
- Troubleshooting
- License
🌟 Overview
ReadCraft takes in your code and generates a well-structured, user-friendly README file. It also allows you to track token usage, output results in JSON format, and process directories of files at once!
✨ Features
- 🗂 Multiple File Processing: Generate READMEs for individual files or entire directories.
- 🔑 Flexible Configuration: Set up your API key with
.envor pass it via command line. - 🌊 Real-Time Streaming: Stream output as it’s generated with the
--streamflag. - 📄 JSON Output: Save your README as a JSON file with the
--jsonoption.
📥 Installation
Prerequisites
- Python 3.7+ 🐍
- pip for package management
Installing via PyPI
Install ReadCraft directly from PyPI:
pip install readcraft
⚙ Configuration
ReadCraft retrieves configuration details from various sources:
-
Environment Variables: Create a
.envfile and add your API key:GROQ_API_KEY=YOUR_API_KEY
-
Command Line Flag: Use the
--api-keyflag to provide the API key when running the tool:readcraft file.py --api-key YOUR_API_KEY
-
TOML Config File: Store configuration in a TOML file named
.your-toolname-config.tomlin your home directory:api_key = "your_api_key_here" model = "your_model_here"
📈 Usage
After installing readcraft, follow these steps to generate a README.md for your files.
-
Locate the ReadCraft Installation:
- Run:
pip show readcraft
- Find the
Locationfield in the output, which points to where ReadCraft is installed.
- Run:
-
Add the File(s):
-
Place the file(s) you want to generate a README for into an accessible directory or just write:
cd ~ touch file_name.py nano file_name.py #In here you can copy the content of the file you want readme for and to save just press ctrl+O and exit by ctrl+X! readcraft file_name.py --output-dir ./outputdir --api-key Your-API-Key --json --stream
-
Alternatively, provide the full path to the file when running the command.
-
-
Run the Tool:
- Process a single file:
readcraft /path/to/your/file.py --output-dir ./output
- Process an entire directory:
readcraft /path/to/your/directory --output-dir ./output
- Process a single file:
-
Verify the Output:
- The generated
README.mdwill appear in the specified output directory.
- The generated
📝 Example Output
Sample README Output
When you run the script, ReadCraft generates a README.md file based on the contents of your code:
Example README.md:
# Sample Project 🚀
This project is designed to [describe key functionalities of the project here]. It’s structured to make your life easier!
## Features
- **Easy to Use**: Simple commands for quick results.
- **High Performance**: Optimized for performance with real-time streaming.
Sample JSON Output
If you use the --json flag, an output JSON file is also created:
{
"file": "path/to/your/file.py",
"readme_content": "# Sample Project...",
"status": "success"
}
🤝 Contributing
We welcome contributions! Follow these steps to set up your environment:
- Fork the repository and clone it.
- Install dependencies listed in
requirements.txt. - Run Pre-Commit Hooks: Set up pre-commit hooks to automatically format and lint your code:
chmod +x .git/hooks/pre-commit
For more details, see CONTRIBUTING.md.
🛠 Troubleshooting
Common Issues:
- No API Key Provided: Ensure your API key is set in a
.envfile (GROQ_API_KEY=your_api_key) or passed via--api-key. - Installation Errors: Use Python 3.7+ and ensure
pipis up to date. If issues persist, use a virtual environment. - Timeouts or Connection Errors: Check your internet connection or retry after a short delay.
- Missing Output: Verify the input file path and ensure the
--output-dirdirectory exists. - Configuration Conflicts: Command-line arguments override
.envand TOML settings. Use one method consistently. - Outdated Dependencies: Upgrade critical packages (e.g.,
requests) if you encounter compatibility issues with Python 3.12+.
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file readcraft-0.1.6.tar.gz.
File metadata
- Download URL: readcraft-0.1.6.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e60f3182fc226ead591997b1a0b0e4828ae8232cb72f74f15d9329a2ed3292f
|
|
| MD5 |
ce2c0dabc4f06e36ef1e27bdf8e74550
|
|
| BLAKE2b-256 |
ac6b8ac7a088ac25498843d4c5a1dc6234f8667061eba5e1dc1052cdf72105bf
|
File details
Details for the file readcraft-0.1.6-py3-none-any.whl.
File metadata
- Download URL: readcraft-0.1.6-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66dbcac6429c700ea4ddcd6289dc0064970f54915a14fde7ab4b54abd1496348
|
|
| MD5 |
a5b824978c461326b77c0d5532c9e8ca
|
|
| BLAKE2b-256 |
4e4a3bf907ef8bff6b43fc99e23dbff1643cb772743df92a6c4c6087f6501eff
|