An example of a python package from pre-existing code
Project description
York-Patched automates development gruntwork like PR reviews, bug fixing, security patching, and more using a self-hosted CLI agent and your preferred LLMs. Try the hosted version here.
Key Components
- Steps: Reusable atomic actions like create PR, commit changes or call an LLM.
- Prompt Templates: Customizable LLM prompts optimized for a chore like library updates, code generation, issue analysis or vulnerability remediation.
- Patchflows: LLM-assisted automations such as PR reviews, code fixing, documentation etc. built by combining steps and prompts.
Installation
Using Pip
The following optional dependency groups are available.
security: Installssemgrepanddepscanwithpip York-Patched 'patchwork-cli[security]'and is required for AutoFix and DependencyUpgrade patchflows.rag: Installschromadbwithpip install 'patchwork-cli[rag]'and is required for the ResolveIssue patchflow.notifications: Used by steps sending notifications, e.g. slack messages.all: installs everything.- Not specifying any dependency group (
pip install patchwork-cli) will install a core set of dependencies that are sufficient to run the GenerateDocstring and GenerateREADME patchflows.
Using Poetry
If you'd like to build from source using poetry, please see detailed documentation here .
York-Patched CLI
The CLI runs Patchflows, as follows:
patchwork <PatchFlow> <?Arguments>
Where
- Arguments: Allow for overriding default/optional attributes of the Patchflow in the format of
key=value. Ifkeydoes not have any value, it is considered a booleanTrueflag.
Example
For an GenerateDocstring patchflow which patches vulnerabilities based on a scan using Semgrep:
patchwork GenerateDocstring openai_api_key=<YOUR_OPENAI_API_KEY> gerrit_username=<GERRIT_USERNAME> gerrit_http_password=<GERRIT_PASSWORD>
Patchflows
York-Patched comes with predefined patchflows, with more added over time. Sample patchflows include:
- GenerateDocstring: Generate docstrings for methods in your code.
- GenerateREADME: Create a README markdown file for a given folder, to add documentation to your repository.
Prompt Templates
Prompt templates are used by patchflows and passed as queries to LLMs. Templates contain prompts with placeholder variables enclosed by {{}} which are replaced by the data from the steps or inputs on every run.
Below is a sample prompt template:
{
"id": "diffreview_summary",
"prompts": [
{
"role": "user",
"content": "Summarize the following code change descriptions in 1 paragraph. {{diffreviews}}"
}
]
}
Each patchflow comes with an optimized default prompt template. But you can specify your own using the prompt_template_file=/path/to/prompt/template/file option.
Contributing
Contributions for new patchflows and steps, or to the core framework are welcome. Please look at open issues for details.
- To create a new patchflow, follow these instructions.
- To create a new step, follow these instructions.
Roadmap
Short Term
- Expand patchflow library and integration options
- Patchflow debugger and validation module
- Bug fixing and performance improvements
- Refactor code and documentation
Long Term
- Support large-scale code embeddings in patchflows
- Support parallelization and branching
- Fine-tuned models that can be self-hosted
- Open-source GUI
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 Distributions
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 york_patched-1.0.2-py3-none-any.whl.
File metadata
- Download URL: york_patched-1.0.2-py3-none-any.whl
- Upload date:
- Size: 129.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d7088c80de9fb224356a198366052116c7ecba7f552a9e9c58769990dcae1ca
|
|
| MD5 |
0e336d86378f2b0060ae1d5b307daa7e
|
|
| BLAKE2b-256 |
8a0ec1f2bb306a7f9f287b4b14003f5708a5ca907a01fde7cf571ade1fbcd287
|