Skip to content

Latest commit

Β 

History

History
88 lines (63 loc) Β· 2.4 KB

File metadata and controls

88 lines (63 loc) Β· 2.4 KB

Production Code Checker LLM/AI Workflow πŸ•΅οΈβ€β™‚οΈ

An AI-powered CLI tool that reviews Python code for production readiness. It acts as a Production ML Engineering Assistant, analyzing your code for reliability, maintainability, and scalability gaps.

πŸš€ Features

The agent reviews code through the lens of a Senior ML Engineer, checking for:

  1. Error Handling & Resilience: Try-catch blocks, OOM protection, timeouts.
  2. Observability & Monitoring: Logging standards, metrics tracking.
  3. Configuration Management: No hardcoded credentials/hyperparams.
  4. Resource Management: GPU memory cleanup, connection pooling.
  5. Testing & Validation: Unit tests, input validation.
  6. Code Quality: Type hints, docstrings, DRY validation.
  7. Security: Input sanitization, secrets management.

πŸ› οΈ Installation

  1. Clone the repository:

    git clone git@github.com:shahjui2000/ProductionCodeChecker.git
    cd ProductionCodeChecker
  2. Set up a virtual environment (recommended):

    python3 -m venv venv
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt

βš™οΈ Configuration

  1. Get a free Hugging Face Token from here.
  2. Create a .env file in the root directory:
    cp .env.example .env
  3. Add your token to .env:
    HF_TOKEN=hf_YourTokenHere

πŸ“– Usage

Run the agent on any Python file:

python3 main.py path/to/your/script.py

Options

Flag Description Default
--model Hugging Face Model ID to use Qwen/Qwen2.5-Coder-32B-Instruct
--api-key Pass HF Token directly (overrides .env) None

πŸ“Š Example

Analyze the included test file:

python3 main.py test_bad_code.py

Output Snippet:

### 7. Security
- **Issue**: Hardcoded AWS credentials.
- **Severity**: Critical
- **Suggested Fix**: Use environment variables for AWS credentials.

🌍 Real-World Verification

The agent has been verified against production-grade codebases, including:

  • OpenAI Python SDK (_base_client.py): Identified subtle improvement opportunities in error handling specificity and configuration validation, demonstrating value even for mature codebases.

πŸ“„ License

MIT