Skip to content

Dependencies, testing, and logging improvements#16

Merged
advaitpatel merged 2 commits into
mainfrom
adding-unit-test-cases
Nov 1, 2025
Merged

Dependencies, testing, and logging improvements#16
advaitpatel merged 2 commits into
mainfrom
adding-unit-test-cases

Conversation

@advaitpatel

Copy link
Copy Markdown
Collaborator

This PR is adding dependency management, comprehensive test coverage, improved error handling, and structured logging. These changes enhance production readiness, maintainability, and developer experience.


  • Pinned all dependencies with version constraints in both requirements.txt and setup.py
  • Used semantic versioning ranges (e.g., pydantic>=2.0.0,<3.0.0)
  • Added comments to organize dependency groups
  • Aligned Python version requirements to 3.12 across all configuration files
  • Added _get_tool_installation_instructions() method with platform-specific installation steps
  • Integrated installation instructions into error messages
  • Provides clear guidance for Docker, Trivy, and Hadolint on Linux, macOS, and Windows

Advait Patel added 2 commits October 31, 2025 23:16
## feat: Dependencies, Testing, and Logging Improvements (Items #11-16)

**Related to:** Items #11-16 from CODE_REVIEW_AND_IMPROVEMENTS.md

### Overview
This PR completes Priority 1 improvements by adding dependency management, comprehensive test coverage, improved error handling, and structured logging. These changes enhance production readiness, maintainability, and developer experience.

---

### Dependencies & Configuration

#### Item #11: Pin dependency versions in requirements.txt
- **Problem**: No version pins - breaking changes in dependencies could break the tool unpredictably
- **Solution**:
  - Pinned all dependencies with version constraints in both `requirements.txt` and `setup.py`
  - Used semantic versioning ranges (e.g., `pydantic>=2.0.0,<3.0.0`)
  - Added comments to organize dependency groups
- **Files**: `requirements.txt`, `setup.py`
- **Impact**: Prevents unexpected breaking changes from dependency updates

**Example:**
```python
# Before
langchain
pydantic

# After
pydantic>=2.0.0,<3.0.0
langchain-core>=0.3.0,<2.0.0
langchain>=0.3.0,<2.0.0
```

#### Item #12: Fix Python version requirement mismatch
- **Problem**: `setup.py` requires Python 3.12, but `pyproject.toml` targeted Python 3.8
- **Solution**: Aligned Python version requirements to 3.12 across all configuration files
- **Files**: `setup.py`, `pyproject.toml`
- **Impact**: Prevents installation confusion and ensures consistency

**Changes:**
- `setup.py`: `python_requires=">=3.12"` (already correct)
- `pyproject.toml`: `target-version = ['py312']` (updated from `py38`)

---

### Error Handling & User Experience

#### Item #13: Improved error handling for missing external tools
- **Problem**: Tool checks existed but errors were not user-friendly - no installation guidance
- **Solution**:
  - Added `_get_tool_installation_instructions()` method with platform-specific installation steps
  - Integrated installation instructions into error messages
  - Provides clear guidance for Docker, Trivy, and Hadolint on Linux, macOS, and Windows
- **Files**: `docker_scanner.py`
- **Impact**: Significantly improved user experience when tools are missing

**Example Error Message (Before):**
@advaitpatel
advaitpatel merged commit 3306e39 into main Nov 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant