Skip to content

Conversation

@jonpspri
Copy link
Contributor

Summary

This PR resolves issue #1230 by addressing dependency resolution conflicts between semgrep and OpenTelemetry observability exporter packages. The root cause was that semgrep and various opentelemetry-exporter-* packages had incompatible dependency versions that prevented uv from successfully resolving the dependency tree.

Root Cause

The semgrep package and OpenTelemetry exporter packages (opentelemetry-exporter-jaeger, opentelemetry-exporter-zipkin, opentelemetry-exporter-otlp-proto-grpc) had conflicting dependencies that created an unresolvable dependency graph in uv.lock.

Solution

This PR restructures dependency management to eliminate the conflicts:

1. Makefile improvements

  • Updated venv target to check if uv is already installed system-wide before installing it
  • Modified test target to use uv run pytest instead of installing pytest separately
  • Fixed semgrep target to use uvx semgrep to run semgrep in an isolated environment, avoiding dependency conflicts
  • Removed syntax error in lint-smart target (extra fi statement)

2. pyproject.toml restructuring

  • Moved development dependencies from [project.optional-dependencies] to [dependency-groups] (uv's preferred format)
  • Removed semgrep from dev dependencies - now run via uvx which isolates its dependencies
  • Simplified observability extras to only include core OpenTelemetry packages (opentelemetry-api, opentelemetry-sdk)
  • Removed conflicting exporter extras: observability-jaeger, observability-zipkin, and observability-all
  • Users now install specific exporter backends separately as needed
  • Removed dev-all extras group

3. Documentation updates (observability.md)

  • Expanded backend options with detailed descriptions of Arize Phoenix, Jaeger, and Grafana Tempo
  • Added clear guidance on exporter backend installation per platform
  • Clarified that only one exporter backend should be installed at a time to avoid conflicts
  • Improved formatting and structure for better readability

4. uv.lock regeneration

  • Updated lock file to reflect new dependency structure
  • Successfully resolved all dependency conflicts

Test Plan

  • Run uv lock to verify dependency resolution succeeds
  • Run make venv to verify virtual environment creation works
  • Run make test to verify tests run with uv run pytest
  • Run make semgrep to verify semgrep runs via uvx in isolation
  • Verify observability features still work with core OpenTelemetry packages
  • Verify no dependency conflicts in uv.lock

Impact

This change transitions towards using uv/uvx for dependency management while maintaining backward compatibility with existing workflows. By running semgrep via uvx and simplifying observability extras, users can now install the gateway and its optional features without encountering dependency conflicts.

Closes #1230

Copilot AI review requested due to automatic review settings October 13, 2025 09:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR resolves dependency conflicts between semgrep and OpenTelemetry observability packages by restructuring dependency management and adopting uv/uvx for isolated execution.

  • Restructured pyproject.toml to use uv's [dependency-groups] format and removed conflicting observability exporter extras
  • Updated Makefile to use uvx semgrep for isolated execution and uv run pytest for testing
  • Enhanced observability documentation with detailed backend descriptions and installation guidance

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
pyproject.toml Restructured dependency management, moved dev dependencies to [dependency-groups], removed conflicting observability exporters, commented out semgrep dependency
docs/docs/manage/observability/observability.md Expanded backend descriptions, added installation instructions per backend, clarified mutual exclusivity of exporters
Makefile Updated to use uvx semgrep for isolated execution, uv run pytest for testing, and conditional uv installation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jonpspri
Copy link
Contributor Author

Looking at what's changing the pytest configuration -- it has to do with removing the "dev" packaging from the optional packages. There's a good reason for that -- the list of dev dependencies doesn't ship with the production package. The down side is the pytest environment needs a different approach to installing dev/test dependencies.

@jonpspri jonpspri force-pushed the fix/uv-lock-reports-conflicting-dependencies branch from 8340309 to 26e7971 Compare October 13, 2025 13:07
@jonpspri
Copy link
Contributor Author

@crivetimihai Are you able to trigger a re-run of the one failed job? It looks like the failure was from resource contention to me.

jonpspri and others added 2 commits October 14, 2025 07:08
This commit addresses dependency resolution conflicts between semgrep and OpenTelemetry packages by:

1. **Makefile improvements**:
   - Updated venv target to check if uv is already installed system-wide
   - Modified test target to use `uv run pytest` instead of installing pytest separately
   - Fixed semgrep target to use `uvx semgrep` to avoid dependency conflicts
   - Removed syntax error in lint-smart target (extra `fi` statement)

2. **pyproject.toml restructuring**:
   - Moved development dependencies from [project.optional-dependencies] to [dependency-groups]
   - Removed semgrep from dev dependencies (now run via uvx to avoid conflicts)
   - Simplified observability extras to only include core OpenTelemetry packages
   - Removed observability-jaeger, observability-zipkin, and observability-all extras
   - Removed dev-all extras group

3. **Documentation updates** (docs/docs/manage/observability/observability.md):
   - Expanded backend options with detailed descriptions of Arize Phoenix, Jaeger, and Grafana Tempo
   - Added clear guidance on exporter backend installation per platform
   - Clarified that only one exporter backend should be installed at a time
   - Improved formatting and structure for better readability

4. **uv.lock regeneration**:
   - Updated lock file to reflect new dependency structure
   - Resolved conflicts between semgrep and opentelemetry-sdk packages

The changes transition towards using uv/uvx for dependency management while maintaining backward compatibility with existing workflows.

Signed-off-by: Jon Pspri <[email protected]>
Signed-off-by: Jonathan Springer <[email protected]>
Signed-off-by: Jonathan Springer <[email protected]>
- Update .github/workflows/pytest.yml to use uv instead of pip
- Fix Makefile venv target shell syntax for uv installation
- Update type hints for keep_alive parameter (int -> float)
- Improve test_translate_echo.py with proper type annotations
- Add hypothesis to dev dependencies for property-based testing
- Use unused_tcp_port fixture to prevent port conflicts

Resolves conflicting dependencies in uv.lock and improves type safety.

Signed-off-by: Jonathan Springer <[email protected]>
@jonpspri
Copy link
Contributor Author

Yep... All reviews passed.

@jonpspri jonpspri force-pushed the fix/uv-lock-reports-conflicting-dependencies branch from 7a33f11 to 6ddabaa Compare October 14, 2025 06:28
@jonpspri
Copy link
Contributor Author

Rebase and push with a tweak to get that '|| true' that Copilot so loves back into the codebase.

Signed-off-by: Jonathan Springer <[email protected]>
@jonpspri jonpspri force-pushed the fix/uv-lock-reports-conflicting-dependencies branch from 6ddabaa to 2491595 Compare October 14, 2025 06:50
@jonpspri
Copy link
Contributor Author

Sorry for all the pushes... my branch got polluted with some other things I was working on.

@crivetimihai
Copy link
Member

@jonpspri is this rebased and ready to merge, or does it have other files that should be a separate PR?

@jonpspri
Copy link
Contributor Author

@crivetimihai It should be GTG. Everything in it now is related to resolving the semgrep/observability version conflicts.

@crivetimihai crivetimihai merged commit fe0fb49 into IBM:main Oct 14, 2025
35 checks passed
@jonpspri jonpspri deleted the fix/uv-lock-reports-conflicting-dependencies branch October 15, 2025 08:24
p4yl04d3r pushed a commit to p4yl04d3r/mcp-context-forge that referenced this pull request Nov 19, 2025
* fix: Resolve uv.lock conflicting dependencies with semgrep

This commit addresses dependency resolution conflicts between semgrep and OpenTelemetry packages by:

1. **Makefile improvements**:
   - Updated venv target to check if uv is already installed system-wide
   - Modified test target to use `uv run pytest` instead of installing pytest separately
   - Fixed semgrep target to use `uvx semgrep` to avoid dependency conflicts
   - Removed syntax error in lint-smart target (extra `fi` statement)

2. **pyproject.toml restructuring**:
   - Moved development dependencies from [project.optional-dependencies] to [dependency-groups]
   - Removed semgrep from dev dependencies (now run via uvx to avoid conflicts)
   - Simplified observability extras to only include core OpenTelemetry packages
   - Removed observability-jaeger, observability-zipkin, and observability-all extras
   - Removed dev-all extras group

3. **Documentation updates** (docs/docs/manage/observability/observability.md):
   - Expanded backend options with detailed descriptions of Arize Phoenix, Jaeger, and Grafana Tempo
   - Added clear guidance on exporter backend installation per platform
   - Clarified that only one exporter backend should be installed at a time
   - Improved formatting and structure for better readability

4. **uv.lock regeneration**:
   - Updated lock file to reflect new dependency structure
   - Resolved conflicts between semgrep and opentelemetry-sdk packages

The changes transition towards using uv/uvx for dependency management while maintaining backward compatibility with existing workflows.

Signed-off-by: Jon Pspri <[email protected]>
Signed-off-by: Jonathan Springer <[email protected]>
Signed-off-by: Jonathan Springer <[email protected]>

* fix: Migrate pytest workflow to uv and resolve type hints

- Update .github/workflows/pytest.yml to use uv instead of pip
- Fix Makefile venv target shell syntax for uv installation
- Update type hints for keep_alive parameter (int -> float)
- Improve test_translate_echo.py with proper type annotations
- Add hypothesis to dev dependencies for property-based testing
- Use unused_tcp_port fixture to prevent port conflicts

Resolves conflicting dependencies in uv.lock and improves type safety.

Signed-off-by: Jonathan Springer <[email protected]>

* fix: Use || true instead of ||:

Signed-off-by: Jonathan Springer <[email protected]>

---------

Signed-off-by: Jon Pspri <[email protected]>
Signed-off-by: Jonathan Springer <[email protected]>
Signed-off-by: Jonathan Springer <[email protected]>
Signed-off-by: p4yl04d3r <[email protected]>
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.

[Bug]: Current pyproject.toml configuration of optional project components contains conflicting components that need to be resolved for uv.

2 participants