CCprompt
Code Context Prompt
The Problem
When working with AI prompts, it is often necessary to provide code context to the model to generate useful responses. This can be a time-consuming task, especially when working with large codebases. CCprompt is a tool designed to extract code context for AI prompts based on provided function or class names. It supports both Python and JavaScript/TypeScript codebases. Providing such context can help AI models generate more accurate and relevant responses.
Features
- Supports Python languages, JavaScript/TypeScript support coming soon.
- Extracts functions or classes and their inheritance chains.
- Configurable via a JSON configuration file or command-line arguments.
- Excludes virtual environment directories if needed.
- zero dependencies if you are using it for python.
Installation
pip install ccprompt
Usage
first time usage
run ccprompt it will create a configuration file ccprompt_config.json in the current directory.
fill in the configuration file with the required information. Alternatively, you can pass the required information as command-line arguments.
ccprompt --config CONFIG. The configuration file should be in the following format:
{
"target_name": ["YourClassName", "your_function_name"],
"project_path": "/full/path/to/project",
"venv_site_packages_path": "/full/path/to/venv/lib/python3.x/site-packages",
"exclude_venv": false,
"output_file": "extracted_code.txt",
"language": "python"
}
then run ccprompt, it will extract the code context based on the configuration file. and create extracted_code.txt that include extracted code context.
the extracted code will include file path, functions or classes and their inheritance chains.
Star and share the repository if you find it useful.
# Update your configuration file then run
ccprompt
# Also possible to pass the configuration file as arguments
ccprompt --target_names YourClassName your_function_name
# See all available options
ccprompt --help
Development
pip install -e .["dev"]
Commands
# installs development dependencies specified in setup.py
make install
# Runs tests
make test
# Check linting issues
make lint-check
# Runs linting and fixes issues
make lint-fix
# Formats code using Ruff
make format
Metadata
Release files for ccprompt 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ccprompt-0.3.0.tar.gz | 9.8 kB | Without provenance | Details for ccprompt-0.3.0.tar.gz |
Release files / ccprompt-0.3.0.tar.gz
| Download URL | ccprompt-0.3.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
860c33912db43d66ddc14e1d836ebe72317fb177329aa240520ae83cb6be4164
|
|
BLAKE2b-256 checksum How to use checksums |
fa578f59107800f37826dca1be755054ecb1698356d2a3fc73f75c44617bd085
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for ccprompt 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.