Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tr/pypi #814

Merged
merged 6 commits into from
Mar 23, 2024
Merged

Tr/pypi #814

merged 6 commits into from
Mar 23, 2024

Conversation

mrT23
Copy link
Collaborator

@mrT23 mrT23 commented Mar 22, 2024

see https://test.pypi.org/project/pr-agent/

Type

enhancement, documentation


Description

  • Updated MANIFEST.in to include necessary files for PyPI distribution.
  • Enhanced README.md with updated project aims, improved visuals, and revised supported commands section.
  • Prepared pyproject.toml for PyPI packaging with updated project information, dependencies, and packaging configurations.
  • Updated dependencies in requirements.txt for better compatibility and stability.

Changes walkthrough

Relevant files
Configuration changes
MANIFEST.in
Update Package Manifest for PyPI Distribution                       

MANIFEST.in

  • Include all .toml files in the pr_agent package.
  • Exclude .secrets.toml files from the pr_agent package.
  • +2/-0     
    pyproject.toml
    Prepare `pyproject.toml` for Enhanced PyPI Packaging         

    pyproject.toml

  • Changed the project name to pr-agent and updated version to 0.2.0.
  • Updated the authors and maintainers list.
  • Revised the project description to align with the README changes.
  • Updated the package keywords and license information.
  • Enabled include-package-data for better package data management.
  • Updated dependencies and project URLs.
  • +14/-14 
    Documentation
    README.md
    Enhance README with Updated Information and Visuals           

    README.md

  • Updated the logo image to be visible in both light and dark modes.
  • Revised the project's aim for clarity and added AI feedbacks and
    suggestions.
  • Updated the supported commands and tools section with new icons.
  • +33/-32 
    Dependencies
    requirements.txt
    Update Dependencies for Better Compatibility                         

    requirements.txt

  • Updated pinecone-client to version 3.2.0.
  • Updated pinecone-datasets to version 0.6.1.
  • +2/-2     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Copy link
    Contributor

    codiumai-pr-agent-pro bot commented Mar 22, 2024

    CI Failure Feedback

    (Checks updated until commit dab033c)

    Action: build-and-test

    Failed stage: Build dev docker [❌]

    Failure summary:

    The action failed due to a dependency conflict between two packages, lancedb and pr-agent, which
    indirectly caused by conflicting version requirements for pyarrow by pinecone-datasets and pylance.
    Specifically:

  • pinecone-datasets 0.6.1 requires pyarrow version to be between 11.0.0 and 12.0.0 (inclusive on the
    lower bound, exclusive on the upper bound).
  • pylance 0.9.7 requires pyarrow version 12 or newer.
    This conflict makes it impossible for pip to
    resolve a set of package versions that satisfies all dependencies, leading to a ResolutionImpossible
    error during the package installation process in the Docker build step.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    1144:  #11 15.52 INFO: pip is looking at multiple versions of dynaconf to determine which version is compatible with other requirements. This could take a while.
    1145:  #11 15.52 INFO: pip is looking at multiple versions of boto3 to determine which version is compatible with other requirements. This could take a while.
    1146:  #11 15.52 INFO: pip is looking at multiple versions of azure-identity to determine which version is compatible with other requirements. This could take a while.
    1147:  #11 15.52 INFO: pip is looking at multiple versions of azure-devops to determine which version is compatible with other requirements. This could take a while.
    1148:  #11 15.52 INFO: pip is looking at multiple versions of atlassian-python-api to determine which version is compatible with other requirements. This could take a while.
    1149:  #11 15.52 INFO: pip is looking at multiple versions of aiohttp to determine which version is compatible with other requirements. This could take a while.
    1150:  #11 15.52 INFO: pip is looking at multiple versions of <Python from Requires-Python> to determine which version is compatible with other requirements. This could take a while.
    1151:  #11 15.52 INFO: pip is looking at multiple versions of pr-agent to determine which version is compatible with other requirements. This could take a while.
    1152:  #11 15.52 ERROR: Cannot install lancedb and pr-agent because these package versions have conflicting dependencies.
    ...
    
    1154:  #11 15.52 The conflict is caused by:
    1155:  #11 15.52     pinecone-datasets 0.6.1 depends on pyarrow<12.0.0 and >=11.0.0
    1156:  #11 15.52     pylance 0.9.7 depends on pyarrow>=12
    1157:  #11 15.52 
    1158:  #11 15.52 To fix this you could try to:
    1159:  #11 15.52 1. loosen the range of package versions you've specified
    1160:  #11 15.52 2. remove package versions to allow pip attempt to solve the dependency conflict
    1161:  #11 15.52 
    1162:  #11 15.52 ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
    1163:  #11 15.53 
    1164:  #11 15.53 [notice] A new release of pip is available: 23.0.1 -> 24.0
    1165:  #11 15.53 [notice] To update, run: pip install --upgrade pip
    1166:  #11 ERROR: process "/bin/sh -c pip install . && rm pyproject.toml requirements.txt" did not complete successfully: exit code: 1
    1167:  ------
    1168:  > [base 5/5] RUN pip install . && rm pyproject.toml requirements.txt:
    1169:  15.52     pylance 0.9.7 depends on pyarrow>=12
    1170:  15.52 
    1171:  15.52 To fix this you could try to:
    1172:  15.52 1. loosen the range of package versions you've specified
    1173:  15.52 2. remove package versions to allow pip attempt to solve the dependency conflict
    1174:  15.52 
    1175:  15.52 ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
    ...
    
    1180:  Dockerfile:6
    1181:  --------------------
    1182:  4 |     ADD pyproject.toml .
    1183:  5 |     ADD requirements.txt .
    1184:  6 | >>> RUN pip install . && rm pyproject.toml requirements.txt
    1185:  7 |     ENV PYTHONPATH=/app
    1186:  8 |     
    1187:  --------------------
    1188:  ERROR: failed to solve: process "/bin/sh -c pip install . && rm pyproject.toml requirements.txt" did not complete successfully: exit code: 1
    1189:  ##[error]buildx failed with: ERROR: failed to solve: process "/bin/sh -c pip install . && rm pyproject.toml requirements.txt" did not complete successfully: exit code: 1
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    @codiumai-pr-agent-pro codiumai-pr-agent-pro bot added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 22, 2024
    Copy link
    Contributor

    PR Description updated to latest commit (d1fc6c6)

    Copy link
    Contributor

    PR Review

    ⏱️ Estimated effort to review [1-5]

    2, because the changes are mostly configuration and documentation updates, which are straightforward to review. The complexity is low, and the changes are well-documented and structured.

    🏅 Score

    85

    🧪 Relevant tests

    No

    🔍 Possible issues

    Dependency Version Locking: The explicit version locking in requirements.txt for pinecone-client and pinecone-datasets might lead to compatibility issues in the future if not regularly updated.

    🔒 Security concerns

    No

    🔀 Multiple PR themes
    Sub-PR theme: Update project packaging configuration for PyPI
    Relevant files:
    • MANIFEST.in
    • pyproject.toml
    Sub-PR theme: Enhance README with updated project information and visuals
    Relevant files:
    • README.md
    Sub-PR theme: Update dependencies for better compatibility and stability
    Relevant files:
    • requirements.txt

    ✨ Review tool usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
    When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:

    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    

    With a configuration file, use the following template:

    [pr_reviewer]
    some_config1=...
    some_config2=...
    
    Utilizing extra instructions

    The review tool can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-tool, and the relevant aspects of the PR that you want to emphasize.

    Examples for extra instructions:

    [pr_reviewer] # /review #
    extra_instructions="""
    In the 'possible issues' section, emphasize the following:
    - Does the code logic cover relevant edge cases?
    - Is the code logic clear and easy to understand?
    - Is the code logic efficient?
    ...
    """
    

    Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

    How to enable\disable automation
    • When you first install PR-Agent app, the default mode for the review tool is:
    pr_commands = ["/review", ...]
    

    meaning the review tool will run automatically on every PR, with the default configuration.
    Edit this field to enable/disable the tool, or to change the used configurations

    Auto-labels

    The review tool can auto-generate two specific types of labels for a PR:

    • a possible security issue label, that detects possible security issues (enable_review_labels_security flag)
    • a Review effort [1-5]: x label, where x is the estimated effort to review the PR (enable_review_labels_effort flag)
    Extra sub-tools

    The review tool provides a collection of possible feedbacks about a PR.
    It is recommended to review the possible options, and choose the ones relevant for your use case.
    Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example:
    require_score_review, require_soc2_ticket, require_can_be_split_review, and more.

    Auto-approve PRs

    By invoking:

    /review auto_approve
    

    The tool will automatically approve the PR, and add a comment with the approval.

    To ensure safety, the auto-approval feature is disabled by default. To enable auto-approval, you need to actively set in a pre-defined configuration file the following:

    [pr_reviewer]
    enable_auto_approval = true
    

    (this specific flag cannot be set with a command line argument, only in the configuration file, committed to the repository)

    You can also enable auto-approval only if the PR meets certain requirements, such as that the estimated_review_effort is equal or below a certain threshold, by adjusting the flag:

    [pr_reviewer]
    maximal_review_effort = 5
    
    More PR-Agent commands

    To invoke the PR-Agent, add a comment using one of the following commands:

    • /review: Request a review of your Pull Request.
    • /describe: Update the PR title and description based on the contents of the PR.
    • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    • /ask <QUESTION>: Ask a question about the PR.
    • /update_changelog: Update the changelog based on the PR's contents.
    • /add_docs 💎: Generate docstring for new components introduced in the PR.
    • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
    • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

    See the tools guide for more details.
    To list the possible configuration parameters, add a /config comment.

    See the review usage page for a comprehensive guide on using this tool.

    Copy link
    Contributor

    codiumai-pr-agent-pro bot commented Mar 22, 2024

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Best practice
    Use more specific patterns for including .toml files.

    Consider using a more specific pattern for including .toml files to avoid accidentally
    including unnecessary .toml files in your package. If there are specific .toml files that
    are needed, list them explicitly or use a more restrictive pattern.

    MANIFEST.in [1]

    -recursive-include pr_agent *.toml
    +include pr_agent/pyproject.toml
    +include pr_agent/another_needed_file.toml
     
    Specify the minimum Python version more precisely.

    It's recommended to specify the minimum Python version more precisely if your package uses
    features introduced in a minor version. For example, if you're using features introduced
    in Python 3.10.2, specify it to avoid compatibility issues.

    pyproject.toml [19]

    -requires-python = ">=3.10"
    +requires-python = ">=3.10.2"
     
    Pin the versions of new dependencies for reproducibility.

    Pin the versions of pinecone-client and pinecone-datasets to ensure reproducible builds
    and avoid potential incompatibilities with future versions. Use the == operator to specify
    exact versions.

    requirements.txt [16-17]

    -pinecone-client==3.2.0
    -pinecone-datasets==0.6.1
    +pinecone-client==3.2.0  # Pin to the current working version
    +pinecone-datasets==0.6.1  # Pin to the current working version
     
    Enhancement
    Add a width attribute to the tag for layout stability.

    Ensure that the tag includes a width attribute to maintain consistency with the tags
    above it, and to improve the layout stability during image loading.

    README.md [9]

    -<img src="https://codium.ai/images/pr_agent/logo-light.png" alt="logo">
    +<img src="https://codium.ai/images/pr_agent/logo-light.png" alt="logo" width="330">
     
    Add more classifiers to better categorize your package.

    Consider adding more classifiers to pyproject.toml to better categorize your package on
    PyPI. For example, adding a License classifier and Operating System classifiers can make
    it easier for users to find your package based on their requirements.

    pyproject.toml [23-26]

     classifiers = [
       "Intended Audience :: Developers",
       "Programming Language :: Python :: 3",
    +  "License :: OSI Approved :: Apache Software License",
    +  "Operating System :: OS Independent",
     ]
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
    When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:

    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    

    With a configuration file, use the following template:

    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    
    Enabling\disabling automation

    When you first install the app, the default mode for the improve tool is:

    pr_commands = ["/improve --pr_code_suggestions.summarize=true", ...]
    

    meaning the improve tool will run automatically on every PR, with summarization enabled. Delete this line to disable the tool from running automatically.

    Utilizing extra instructions

    Extra instructions are very important for the improve tool, since they enable to guide the model to suggestions that are more relevant to the specific needs of the project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify relevant aspects that you want the model to focus on.

    Examples for extra instructions:

    [pr_code_suggestions] # /improve #
    extra_instructions="""
    Emphasize the following aspects:
    - Does the code logic cover relevant edge cases?
    - Is the code logic clear and easy to understand?
    - Is the code logic efficient?
    ...
    """
    

    Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

    A note on code suggestions quality
    • While the current AI for code is getting better and better (GPT-4), it's not flawless. Not all the suggestions will be perfect, and a user should not accept all of them automatically.
    • Suggestions are not meant to be simplistic. Instead, they aim to give deep feedback and raise questions, ideas and thoughts to the user, who can then use his judgment, experience, and understanding of the code base.
    • Recommended to use the 'extra_instructions' field to guide the model to suggestions that are more relevant to the specific needs of the project, or use the custom suggestions 💎 tool
    • With large PRs, best quality will be obtained by using 'improve --extended' mode.
    More PR-Agent commands

    To invoke the PR-Agent, add a comment using one of the following commands:

    • /review: Request a review of your Pull Request.
    • /describe: Update the PR title and description based on the contents of the PR.
    • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    • /ask <QUESTION>: Ask a question about the PR.
    • /update_changelog: Update the changelog based on the PR's contents.
    • /add_docs 💎: Generate docstring for new components introduced in the PR.
    • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
    • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

    See the tools guide for more details.
    To list the possible configuration parameters, add a /config comment.

    See the improve usage page for a more comprehensive guide on using this tool.

    @Codium-ai Codium-ai deleted a comment from codiumai-pr-agent-pro bot Mar 23, 2024
    @mrT23
    Copy link
    Collaborator Author

    mrT23 commented Mar 23, 2024

    /improve

    Copy link
    Contributor

    codiumai-pr-agent-pro bot commented Mar 23, 2024

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Best practice
    Use consistent argument naming conventions.

    It's recommended to use consistent argument naming conventions. In the usage examples, you
    have mixed --pr_url and --pr-url. Choose one format and stick with it to avoid confusion.

    pr_agent/cli.py [17-22]

    -- cli.py --pr_url=... review
    -- cli.py --pr_url=... describe
    -- cli.py --pr_url=... improve
    -- cli.py --pr_url=... ask "write me a poem about this PR"
    -- cli.py --pr_url=... reflect
    -- cli.py --issue_url=... similar_issue
    +- cli.py --pr-url=... review
    +- cli.py --pr-url=... describe
    +- cli.py --pr-url=... improve
    +- cli.py --pr-url=... ask "write me a poem about this PR"
    +- cli.py --pr-url=... reflect
    +- cli.py --issue-url=... similar_issue
     
    Use specific exceptions for clearer error handling.

    Instead of raising a generic Exception when required packages are not installed, raise a
    more specific exception like ImportError to provide clearer error handling.

    pr_agent/tools/pr_similar_issue.py [41]

    -except:
    -    raise Exception("Please install 'pinecone' and 'pinecone_datasets' to use pinecone as vectordb")
    +except ImportError:
    +    raise ImportError("Please install 'pinecone' and 'pinecone_datasets' to use pinecone as vectordb")
     
    Use environment variables for sensitive information.

    It's recommended to avoid hardcoding sensitive information such as user_token and
    openai_key directly in the script. Instead, consider using environment variables or a
    secure vault service to handle sensitive data securely.

    docs/docs/installation/locally.md [19-21]

    -user_token = "..."  # GitHub user token
    -openai_key = "..."  # OpenAI key
    +import os
    +user_token = os.getenv("GITHUB_USER_TOKEN")  # GitHub user token
    +openai_key = os.getenv("OPENAI_KEY")  # OpenAI key
     
    Use consistent quote styles in TOML files.

    Ensure consistency in the use of quotes for strings in the TOML file. It's recommended to
    stick to one style (either single or double quotes) throughout the file for better
    readability.

    pyproject.toml [6-43]

    -name = "pr-agent"
    -version = "0.2.0"
    +name = 'pr-agent'
    +version = '0.2.0'
     ...
    -include = ["pr_agent*"] # include pr_agent and any sub-packages it finds under it.
    +include = ['pr_agent*'] # include pr_agent and any sub-packages it finds under it.
     
    Pin versions of commented dependencies for reproducibility.

    Consider pinning the versions of the newly commented dependencies (pinecone-client,
    pinecone-datasets, lancedb, langchain) to ensure reproducibility and to avoid potential
    incompatibilities with future versions.

    requirements.txt [26-31]

     # Uncomment the following lines to enable the 'similar issue' tool
    -# pinecone-client
    -# pinecone-datasets @ git+https://github.com/mrT23/pinecone-datasets.git@main
    +# pinecone-client==<version>
    +# pinecone-datasets @ git+https://github.com/mrT23/pinecone-datasets.git@<commit_hash>
     # lancedb==0.5.1
     # uncomment this to support language LangChainOpenAIHandler
     # langchain==0.0.349
     
    Pin versions of development dependencies.

    For poetry and twine, it's a good practice to specify the versions to avoid potential
    future compatibility issues or unexpected behavior due to updates.

    requirements-dev.txt [2-3]

    -poetry
    -twine
    +poetry==<version>
    +twine==<version>
     
    Security
    Avoid hardcoding sensitive information in the code.

    For security and maintainability, avoid hardcoding sensitive information like tokens
    directly in the code. Consider using environment variables or a secure vault service.

    pr_agent/cli_pip.py [10-13]

    +import os
     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'
    +user_token = os.getenv("GITHUB_USER_TOKEN")  # GitHub user token
    +openai_key = os.getenv("OPENAI_KEY")  # OpenAI key
    +pr_url = os.getenv("PR_URL")  # PR URL, for example 'https://github.com/Codium-ai/pr-agent/pull/809'
     
    Maintainability
    Move dynamic import logic to a separate function for better maintainability.

    To improve code readability and maintainability, consider moving the dynamic import logic
    to a separate function or module. This approach centralizes the handling of optional
    dependencies.

    pr_agent/tools/pr_similar_issue.py [36-41]

    -try:
    -    import pinecone
    -    from pinecone_datasets import Dataset, DatasetMetadata
    -    import pandas as pd
    -except:
    -    raise Exception("Please install 'pinecone' and 'pinecone_datasets' to use pinecone as vectordb")
    +def try_import_pinecone():
    +    try:
    +        import pinecone
    +        from pinecone_datasets import Dataset, DatasetMetadata
    +        import pandas as pd
    +        return pinecone, Dataset, DatasetMetadata, pd
    +    except ImportError:
    +        raise ImportError("Please install 'pinecone' and 'pinecone_datasets' to use pinecone as vectordb")
     
    Break down the main function for better readability.

    For better maintainability and readability, consider breaking down the main function into
    smaller functions, each handling a specific part of the setup and execution process.

    docs/docs/installation/locally.md [17-35]

    +def setup_configuration(provider, user_token, openai_key):
    +    # Setting the configurations
    +    ...
    +
    +def prepare_and_run_command(pr_url, command):
    +    # Preparing the command and running it
    +    ...
    +
     def main():
    -    # Fill in the following values
         ...
    -    # Run the command. Feedback will appear in GitHub PR comments
    -    cli.run(args=args)
    +    setup_configuration(provider, user_token, openai_key)
    +    prepare_and_run_command(pr_url, command)
     
    Enhancement
    Add detailed help messages for CLI arguments.

    To enhance the CLI user experience, consider adding more detailed help messages for each
    command argument, explaining their purpose and usage more clearly.

    pr_agent/cli.py [47-50]

    -parser.add_argument('--pr_url', type=str, help='The URL of the PR to review', default=None)
    -parser.add_argument('--issue_url', type=str, help='The URL of the Issue to review', default=None)
    -parser.add_argument('command', type=str, help='The', choices=commands, default='review')
    -parser.add_argument('rest', nargs=argparse.REMAINDER, default=[])
    +parser.add_argument('--pr-url', type=str, help='The URL of the Pull Request to review. Example: https://github.com/user/repo/pull/123', default=None)
    +parser.add_argument('--issue-url', type=str, help='The URL of the Issue to analyze. Example: https://github.com/user/repo/issues/456', default=None)
    +parser.add_argument('command', type=str, help='The command to execute on the PR or Issue.', choices=commands, default='review')
    +parser.add_argument('rest', nargs=argparse.REMAINDER, help='Additional arguments for the command, if any.', default=[])
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
    When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:

    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    

    With a configuration file, use the following template:

    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    
    Enabling\disabling automation

    When you first install the app, the default mode for the improve tool is:

    pr_commands = ["/improve --pr_code_suggestions.summarize=true", ...]
    

    meaning the improve tool will run automatically on every PR, with summarization enabled. Delete this line to disable the tool from running automatically.

    Utilizing extra instructions

    Extra instructions are very important for the improve tool, since they enable to guide the model to suggestions that are more relevant to the specific needs of the project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify relevant aspects that you want the model to focus on.

    Examples for extra instructions:

    [pr_code_suggestions] # /improve #
    extra_instructions="""
    Emphasize the following aspects:
    - Does the code logic cover relevant edge cases?
    - Is the code logic clear and easy to understand?
    - Is the code logic efficient?
    ...
    """
    

    Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

    A note on code suggestions quality
    • While the current AI for code is getting better and better (GPT-4), it's not flawless. Not all the suggestions will be perfect, and a user should not accept all of them automatically.
    • Suggestions are not meant to be simplistic. Instead, they aim to give deep feedback and raise questions, ideas and thoughts to the user, who can then use his judgment, experience, and understanding of the code base.
    • Recommended to use the 'extra_instructions' field to guide the model to suggestions that are more relevant to the specific needs of the project, or use the custom suggestions 💎 tool
    • With large PRs, best quality will be obtained by using 'improve --extended' mode.
    More PR-Agent commands

    To invoke the PR-Agent, add a comment using one of the following commands:

    • /review: Request a review of your Pull Request.
    • /describe: Update the PR title and description based on the contents of the PR.
    • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    • /ask <QUESTION>: Ask a question about the PR.
    • /update_changelog: Update the changelog based on the PR's contents.
    • /add_docs 💎: Generate docstring for new components introduced in the PR.
    • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
    • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

    See the tools guide for more details.
    To list the possible configuration parameters, add a /config comment.

    See the improve usage page for a more comprehensive guide on using this tool.

    @mrT23 mrT23 merged commit a355fb5 into main Mar 23, 2024
    1 check passed
    @mrT23 mrT23 deleted the tr/pypi branch March 23, 2024 09:20
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    documentation Improvements or additions to documentation enhancement New feature or request Review effort [1-5]: 2
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant