adjustments to pypi

This commit is contained in:
mrT23
2024-03-23 09:55:08 +02:00
parent 2fccadc469
commit 9a46690121
6 changed files with 117 additions and 33 deletions

View File

@ -1,3 +1,46 @@
## Using Pip package
1. Install the package:
```
pip install pr-agent
```
2. Run the relevant tool. Make sure to fill in the required parameters (`user_token`, `openai_key`, `pr_url`, `command`):
```python
from pr_agent import cli
from pr_agent.config_loader import get_settings
from pr_agent.log import setup_logger
setup_logger()
def main():
# Fill in the following values
provider = "github" # GitHub provider
user_token = "..." # GitHub user token
openai_key = "..." # OpenAI key
pr_url = "..." # PR URL, for example 'https://github.com/Codium-ai/pr-agent/pull/809'
command = "/review" # Command to run (e.g. '/review', '/describe', '/ask="What is the purpose of this PR?"', ...)
# Setting the configurations
get_settings().set("CONFIG.git_provider", provider)
get_settings().set("openai.key", openai_key)
get_settings().set("github.user_token", user_token)
# Preparing the command
run_command = f"--pr_url={pr_url} {command.lstrip('/')}"
args = cli.set_parser().parse_args(run_command.split())
# Run the command. Feedback will appear in GitHub PR comments
cli.run(args=args)
if __name__ == '__main__':
main()
```
## Use Docker image (no installation required)
A list of the relevant tools can be found in the [tools guide](../tools/ask.md).

View File

@ -1,5 +1,5 @@
## Local repo (CLI)
When running from your local repo (CLI), your local configuration file will be used.
When running from your locally cloned PR-Agent repo (CLI), your local configuration file will be used.
Examples of invoking the different tools via the CLI:
- **Review**: `python -m pr_agent.cli --pr_url=<pr_url> review`