Skip to content

fix: relax python-dotenv pin from ==1.0.1 to >=1.0.1 - #25231

Closed
rudra717 wants to merge 1 commit into
BerriAI:mainfrom
rudra717:fix/relax-python-dotenv-pin
Closed

fix: relax python-dotenv pin from ==1.0.1 to >=1.0.1#25231
rudra717 wants to merge 1 commit into
BerriAI:mainfrom
rudra717:fix/relax-python-dotenv-pin

Conversation

@rudra717

@rudra717 rudra717 commented Apr 6, 2026

Copy link
Copy Markdown

Summary

Relaxes the python-dotenv dependency pin in pyproject.toml from exact ==1.0.1 to lower-bounded >=1.0.1.

Motivation

The exact pin introduced in v1.83.1 makes litellm uninstallable alongside any package requiring python-dotenv>=1.1.0 (e.g. fastmcp[tasks]==3.2.0):

× No solution found when resolving dependencies:
╰─▶ Because fastmcp==3.2.0 depends on python-dotenv>=1.1.0 and
    litellm==1.83.3 depends on python-dotenv==1.0.1, we can conclude that
    litellm==1.83.3 and fastmcp[tasks]==3.2.0 are incompatible.

Exact pins in published package metadata propagate to every consumer's resolver. Reproducible builds should use lockfiles (poetry.lock), not exact pins in pyproject.toml.

Changes

  • pyproject.toml: Changed python-dotenv = "1.0.1" to python-dotenv = ">=1.0.1"

Testing

No behavioral change — this only affects dependency resolution. Existing tests are unaffected.

Disclaimer

AI agents (Claude Code) assisted with this contribution.

Fixes #25210

The exact pin makes litellm uninstallable alongside any library that
requires python-dotenv>=1.1.0 (e.g. fastmcp[tasks]==3.2.0). Exact
pins in published package metadata propagate to every consumer's
resolver. Reproducible builds should use lockfiles, not exact pins
in pyproject.toml.

Fixes BerriAI#25210

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Apr 6, 2026 5:04pm

Request Review

@codspeed-hq

codspeed-hq Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing rudra717:fix/relax-python-dotenv-pin (644ef4e) with main (39c1042)

Open in CodSpeed

@greptile-apps

greptile-apps Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR relaxes the python-dotenv dependency pin in pyproject.toml from an exact ==1.0.1 to a lower-bounded >=1.0.1, fixing a real-world incompatibility with packages like fastmcp[tasks]==3.2.0 that require python-dotenv>=1.1.0.

  • Change: python-dotenv = \"1.0.1\"python-dotenv = \">=1.0.1\" in pyproject.toml
  • Motivation is valid: Exact pins in published library metadata propagate constraints to all downstream consumers; lockfiles (poetry.lock) are the right tool for reproducible builds, not pyproject.toml exact pins
  • Minor concern: No upper bound is specified — a <2.0.0 cap would be consistent with the project's pinning intent while still unblocking the reported conflict (no python-dotenv 2.x exists today, but it's good defensive practice)
  • No behavioral change: This is a pure dependency metadata update with no impact on runtime behavior or test coverage

Confidence Score: 5/5

Safe to merge — this is a pure dependency metadata change with no behavioral impact

The only finding is a P2 style suggestion to add a major-version upper bound. The change itself is correct, well-motivated by a real and reproducible incompatibility, and consistent with library packaging best practices. No 2.x python-dotenv release exists today. All remaining concerns are speculative future-proofing.

No files require special attention

Important Files Changed

Filename Overview
pyproject.toml Relaxes python-dotenv pin from ==1.0.1 to >=1.0.1; consistent with library packaging best practices but lacks an upper bound unlike all surrounding exact pins

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Consumer installs litellm + fastmcp] --> B{Dependency resolver}
    B -->|Before PR: litellm==1.83.3 requires python-dotenv==1.0.1| C[❌ Conflict with fastmcp requiring python-dotenv>=1.1.0]
    B -->|After PR: litellm>=1.83.4 requires python-dotenv>=1.0.1| E[✅ Resolver picks compatible version]
    E --> F[python-dotenv 1.1.0 installed successfully]
Loading

Reviews (1): Last reviewed commit: "fix: relax python-dotenv pin from ==1.0...." | Re-trigger Greptile

Comment thread pyproject.toml
httpx = "0.28.1"
openai = "2.30.0"
python-dotenv = "1.0.1"
python-dotenv = ">=1.0.1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 No upper bound on the relaxed pin

All other core (non-optional) dependencies in this file are exact-pinned (e.g. httpx = "0.28.1", openai = "2.30.0"), and the comment at line 21 explicitly states these were derived from a known-good PyPI resolution. Relaxing python-dotenv to >=1.0.1 with no upper bound means a future python-dotenv 2.x with breaking changes could silently be pulled in by consumers.

As of now there is no 2.x release, but adding a major-version cap is inexpensive insurance and aligns with the project's cautious pinning intent:

Suggested change
python-dotenv = ">=1.0.1"
python-dotenv = ">=1.0.1,<2.0.0"

@techgeniuswang

Copy link
Copy Markdown

similar issue: #25210 #26333
similar PR #26188

pjdoland added a commit to pjdoland/notebook-intelligence that referenced this pull request May 19, 2026
NBI's pyproject was un-installable on a fresh Python 3.14 because
`litellm>=1.83.7` (the floor that picks up CVE-2026-42203 /
CVE-2026-42208 / CVE-2026-42271 fixes) hard-pins
`python-dotenv==1.0.1`, and every `fastmcp>=2.11.2` release requires
`python-dotenv>=1.1.0`. Mutually unsatisfiable; pip reports
`ResolutionImpossible`. Upstream litellm has closed a CVE-fix bump
(BerriAI/litellm#26435) and stalled on a pin-relaxation PR
(BerriAI/litellm#25231) for ~7 weeks with no signal of movement.

This commit drops the `fastmcp` dep entirely and routes
`mcp_manager.py` through a thin local shim
(`notebook_intelligence/mcp_client.py`) implemented against the
official `mcp` Python SDK. The SDK lists `python-dotenv` only as an
optional `cli` extra, so it can coexist with litellm's hard
`==1.0.1` and the resolver succeeds. `mcp` was already in NBI's
dep tree (transitively via `claude-agent-sdk`); promoted to a
direct `>=1.27.0` pin so the version is anchored.

The shim exposes the small fastmcp surface NBI used (`Client`,
`StdioTransport`, `StreamableHttpTransport`) with constructor
signatures and method shapes identical to fastmcp's. Return values
are the underlying mcp Pydantic models — the same shapes fastmcp
returned, since fastmcp itself is a thin layer over the SDK.
mcp_manager.py's two imports change; nothing else in the consumer
moves.

Tests (`tests/test_mcp_client_shim.py`, 5 cases):
- Constructor field-name parity for both transports.
- Methods-before-context-entry surface as RuntimeError.
- Unsupported transport types surface as TypeError.
- End-to-end against a real stdio MCP server: ping, list_tools,
  call_tool, list_prompts, get_prompt. Asserts the exact attribute
  paths mcp_manager.py reads (tool.name / tool.inputSchema /
  prompt.arguments[i].required / get_prompt_result.messages[i].
  content.text). A future SDK refactor that returns an envelope
  where a list was expected (or vice versa) flunks the test rather
  than silently breaking the consumer.
- Context cleanup on initialize failure: the stdio subprocess
  unwinds cleanly when the server exits before the handshake.

Verification: fresh `python -m venv && pip install -e .` on
Python 3.14 succeeds (previously failed with ResolutionImpossible).
Full pytest suite: 1012 passed. TS gates clean. The shim's
end-to-end test runs the real stdio handshake in <1s.

Temporary in spirit: once BerriAI/litellm#25231 lands and the
fastmcp clients NBI used become installable alongside it again,
this shim can revert to a direct `fastmcp` import and the local
file can be deleted. Both the new module's docstring and the
pyproject comment point at that upstream PR.
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions Bot added the stale label Jul 26, 2026
@github-actions github-actions Bot closed this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: python-dotenv pinned to ==1.0.1 since v1.83.1 causes dependency conflicts for library consumers

2 participants