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

Command line args for logging level #66

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mikegehard
Copy link

@mikegehard mikegehard commented Nov 25, 2024

User description

This makes it easier for folks learning how the flow works to see what is happening.

Dependent on #64 getting merged first.


PR Type

enhancement, dependencies


Description

  • Added command line argument --log-level to set the logging level in solve_dataset.py, solve_my_problem.py, and solve_problem.py.
  • Updated the logger setup to use the specified logging level from the command line.
  • Updated requirements.txt to fix dependencies for Python 3.13, including updates to fastapi, tiktoken, uvicorn, and duckdb.
  • Enhanced the README with a pre-requisites section for installation.

Changes walkthrough 📝

Relevant files
Enhancement
solve_dataset.py
Add logging level argument to CLI                                               

alpha_codium/solve_dataset.py

  • Added command line argument for logging level.
  • Updated logger setup to use the specified logging level.
  • +4/-1     
    solve_my_problem.py
    Add logging level argument to CLI                                               

    alpha_codium/solve_my_problem.py

  • Added command line argument for logging level.
  • Updated logger setup to use the specified logging level.
  • +4/-1     
    solve_problem.py
    Add logging level argument to CLI                                               

    alpha_codium/solve_problem.py

  • Added command line argument for logging level.
  • Updated logger setup to use the specified logging level.
  • +3/-1     
    Documentation
    README.md
    Update installation instructions with pre-requisites         

    README.md

    • Added pre-requisites section for installation.
    +5/-0     
    Dependencies
    requirements.txt
    Update dependencies for compatibility with Python 3.13     

    requirements.txt

  • Updated fastapi, tiktoken, uvicorn, and duckdb dependencies.
  • +4/-4     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    I tried to follow the installation instructions but kept getting errors.
    
    I updated the dependencies to get things working.
    
    I updated duckdb to just 1.0.0 because I figured that it would be safer
    to do the minimal update possible to get things working.
    
    I was able to get a successful solution after these upgrades using:
    
    python -m alpha_codium.solve_problem \
    --dataset_name /Users/mikegehard/workspace/aiAssistedAgile/AlphaCodium/valid_and_test_processed \
    --split_name test \
    --problem_number 0
    This makes it easier for someone learning the code to see what is
    happening in the bowels of the codebase.
    Copy link

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Code Consistency
    The log level argument is defined slightly differently across files - some use hyphen (--log-level) while maintaining consistent choices. Ensure consistent naming convention.

    Dependency Compatibility
    Major version updates for several dependencies (fastapi, tiktoken, uvicorn, duckdb) - verify backward compatibility and test functionality with new versions

    Copy link

    qodo-merge-pro bot commented Nov 25, 2024

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Qodo best practice
    ✅ Extract repeated string literals into a named constant for better maintainability
    Suggestion Impact:The commit implemented the suggestion by replacing the duplicated log level choices with a constant, LOG_LEVEL_CHOICES, imported from a module.

    code diff:

    +from alpha_codium.constants import LOG_LEVEL_CHOICES
     
     logger = get_logger(__name__)
     
    @@ -10,7 +11,7 @@
     parser.add_argument("--split_name", type=str, default="valid")
     parser.add_argument("--database_solution_path", type=str, default="")
     parser.add_argument('--log-level', type=str, default='INFO',
    -                    choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'])
    +                    choices=LOG_LEVEL_CHOICES)

    Define the log level choices as a constant at the module level to avoid duplicating
    the list and make it easier to maintain across the codebase.

    alpha_codium/solve_dataset.py [12-13]

    +LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
     parser.add_argument('--log-level', type=str, default='INFO',
    -                choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'])
    +                choices=LOG_LEVELS)
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: The suggestion improves code maintainability by avoiding duplication of log level choices across multiple files, making it easier to update these values consistently. However, since this is primarily a code organization improvement rather than a critical fix, it receives a moderate score.

    6

    💡 Need additional feedback ? start a PR chat

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant