code-prompt-builder
A lightweight Python library to construct plain-text code prompts from your code bases, designed for use with Large Language Models (LLMs) in code analysis and assistance tasks.
Description
code-prompt-builder simplifies the process of feeding code to your LLM. It reads files from your project, optionally filtering by file types and directories, and structures them into a single string suitable for LLM input.
This makes it easy to ask LLMs to analyze your code, identify potential issues, or even generate code suggestions.
Installation
pip install code-prompt-builder
Usage
Here's a simple example of using code-prompt-builder:
from code_prompt_builder.utils import build_code_prompt
# Specify directories containing your code
repo_dir_paths = ["path/to/your/code/directory"]
# Create the code prompt
code_prompt = build_code_prompt(repo_dir_paths=repo_dir_paths)
# Now you can use 'code_prompt' as input to your LLM
print(code_prompt)
Function Parameters
repo_tree_paths: A list of root directory paths to walk through and collect files.repo_dir_paths: A list of directories to read files from directly (no recursive walk).repo_file_paths: A list of specific files to include.include_file_regex: (Optional) A regular expression to include only matching files.exclude_file_regex: (Optional) A regular expression to exclude matching files.
Metadata
Release files for code-prompt-builder 0.0.3
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 | |
|---|---|---|---|---|
| code_prompt_builder-0.0.3.tar.gz | 3.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| code_prompt_builder-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.0 kB
Release files / code_prompt_builder-0.0.3.tar.gz
| Download URL | code_prompt_builder-0.0.3.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b1f6810005cb38927bf60b53dd3f9531d939be923d6022f678f513a7ed089b9
|
|
BLAKE2b-256 checksum How to use checksums |
2553993879cf4db03f42dc7bf229f94b28969c03c1916934076939ed990b60e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.6
|
Release files / code_prompt_builder-0.0.3-py3-none-any.whl
| Download URL | code_prompt_builder-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
778f20816a37b950327811104e6fdde037f5c2b25a1f5f01bc150aee6f160312
|
|
BLAKE2b-256 checksum How to use checksums |
47ee9f4da64d2b19be02984f0df2ff7fc5a5d19f60e57b7baf0f29d80fa4c77d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.6
|
Security for code-prompt-builder 0.0.3
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.