-
Notifications
You must be signed in to change notification settings - Fork 2
Enhance dependency management and testing framework #20
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
71f2b93
Enhance dependency management and testing framework
bwebs 6aaf4e1
Update tests/test_dependency_resolution.py
bwebs 98e5bcc
Update dependency management and testing framework
bwebs e10da02
Remove development dependencies from `pyproject.toml`
bwebs a356732
Update dependency management and testing configuration
bwebs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: Test Dependency Resolution | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| test-dependencies: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v2 | ||
| with: | ||
| version: latest | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| uv sync --extra all | ||
|
|
||
| - name: Run with pytest | ||
| run: | | ||
| uv run pytest tests/test_dependency_resolution.py -v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| .PHONY: docs | ||
| .PHONY: docs test-deps | ||
|
|
||
| docs: | ||
| typer lkr/main.py utils docs --output lkr.md | ||
| typer lkr/main.py utils docs --output lkr.md | ||
|
|
||
| test-deps: | ||
| python tests/test_dependency_resolution.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| # Testing Dependency Resolution | ||
|
|
||
| This project includes tests to ensure that all dependency combinations resolve to the same lock file, maintaining consistency in the dependency tree. | ||
|
|
||
| ## What the tests verify | ||
|
|
||
| The tests ensure that these two commands produce identical lock files: | ||
|
|
||
| 1. `uv sync --extra all` | ||
| 2. `uv sync --extra [all individual extras]` | ||
|
|
||
| Where "all individual extras" are dynamically discovered from `pyproject.toml` (excluding the `all` extra itself). | ||
|
|
||
| This is important because the `all` extra should be equivalent to installing all individual extras together. | ||
|
|
||
| ## Running the tests | ||
|
|
||
| ### Option 1: Shell script (recommended for quick testing) | ||
|
|
||
| ```bash | ||
| ./tests/test_deps.sh | ||
| ``` | ||
|
|
||
| This script will: | ||
| - Dynamically discover all individual extras from `pyproject.toml` | ||
| - Create temporary directories | ||
| - Run both dependency resolution commands | ||
| - Compare the resulting lock files | ||
| - Clean up automatically | ||
|
|
||
| ### Option 2: Python test (for CI/CD integration) | ||
|
|
||
| ```bash | ||
| # Run directly | ||
| python tests/test_dependency_resolution.py | ||
|
|
||
| # Run with pytest | ||
| uv run pytest tests/test_dependency_resolution.py -v | ||
| ``` | ||
|
|
||
| ### Option 3: Makefile target | ||
|
|
||
| ```bash | ||
| make test-deps | ||
| ``` | ||
|
|
||
| ## What the tests check | ||
|
|
||
| 1. **Dynamic Extra Discovery**: Automatically discovers all individual extras from `pyproject.toml` | ||
| 2. **Dependency Resolution Consistency**: Ensures that `--extra all` and `--extra [individual extras]` resolve to the same set of packages | ||
| 3. **Configuration Validation**: Verifies that all required extras are properly defined in `pyproject.toml` | ||
| 4. **Lock File Integrity**: Compares SHA256 hashes of generated lock files | ||
|
|
||
| ## Expected output | ||
|
|
||
| When the tests pass, you should see: | ||
|
|
||
| ``` | ||
| 🔍 Discovering individual extras... | ||
| 📦 Found individual extras: mcp embed-observability user-attribute-updater | ||
| 🎉 SUCCESS: All dependency combinations resolve to the same lock file! | ||
| ✅ Dependency resolution is consistent | ||
| ``` | ||
|
|
||
| ## Adding new extras | ||
|
|
||
| When you add a new extra to `pyproject.toml`, the tests will automatically: | ||
|
|
||
| 1. Discover the new extra | ||
| 2. Include it in the dependency resolution test | ||
| 3. Verify that `--extra all` still includes all dependencies from the new extra | ||
|
|
||
| No manual test updates are required! | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| If the tests fail, it usually means: | ||
|
|
||
| 1. **Missing dependencies**: The `all` extra doesn't include all the dependencies from individual extras | ||
| 2. **Version conflicts**: Different dependency combinations resolve to different versions | ||
| 3. **Configuration issues**: The `pyproject.toml` file has inconsistencies | ||
|
|
||
| ### Common fixes | ||
|
|
||
| 1. **Update the `all` extra**: Make sure it includes all dependencies from individual extras | ||
| 2. **Check for version conflicts**: Ensure that all extras use compatible versions | ||
| 3. **Verify dependency definitions**: Make sure all extras are properly defined | ||
|
|
||
| ## CI/CD Integration | ||
|
|
||
| The tests are automatically run in GitHub Actions on: | ||
| - Push to `main` or `develop` branches | ||
| - Pull requests to `main` or `develop` branches | ||
| - Manual workflow dispatch | ||
|
|
||
| See `.github/workflows/test-dependencies.yml` for the CI configuration. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that the content of this
TESTING.mdfile is duplicated in the rootTESTING.md. Having two identical documentation files can lead to confusion and make it difficult to keep them synchronized. It's best practice to have a single source of truth for documentation.Given that other test-related files (
test_dependency_resolution.py,test_deps.sh) are located in thetests/directory, it makes sense for this documentation to reside here as well. Please consider removing theTESTING.mdfile from the project root.