🐞 bug report
Affected Rule
pip.parse
Is this a regression?
Not really, it's caused by upgrading fastmcp from v3 to v4
Description
fastmcp==4.0.5 declares fastmcp-slim[client,server]==4.0.5 unconditionally
in its Requires-Dist, and fastmcp-slim gates its client and server
dependencies (httpx2, authlib, mcp, starlette, and others) behind those
extras. When fastmcp is pulled in through pip.parse, rules_python does not
enable the client and server extras on the fastmcp_slim target, so those
gated dependencies are never wired into the dependency graph. Depending on
@pypi//fastmcp therefore produces a different importable environment than
pip install fastmcp: import fastmcp.client fails at runtime with
ModuleNotFoundError: No module named 'httpx2', even though httpx2 and the
other extra dependencies are pinned in the lock and exist as @pypi//… targets.
The cause is in python/private/pypi/pep508_deps.bzl. The
fastmcp-slim[client,server] edge is parsed into a requirement with
.name == "fastmcp-slim" and .extras == ["client", "server"]
(pep508_requirement.bzl), but _resolve_extras() only consults req.extras
for self-edges (if req.name != self_name: continue), and the dependency label
is built from req.name alone, so the [client,server] qualifier is discarded.
Whether a package's extra == '...' dependencies are wired is then decided
solely by the extras passed to that package's own whl_library, which is
populated from how the package appears as a requirement line in the lock.
fastmcp-slim appears only as a plain transitive pin with no extras, so its
whl_library receives extras = [] and the client and server dependencies are
dropped.
🔬 Minimal Reproduction
uv add fastmcp==4.0.5
uv export --format requirements.txt > ./requirements.txt
bazel build //...
🔥 Exception or Error
ImportError: FastMCP client support is not installed. Install `fastmcp` or `fastmcp-slim[client]`.
🌍 Your Environment
Operating System:
ubuntu 24.04
Output of bazel version:
Build label: 8.6.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Thu Feb 26 19:55:20 2026 (1772135720)
Build timestamp: 1772135720
Build timestamp as int: 1772135720
Rules_python version:
1.9.2
Anything else relevant?
🐞 bug report
Affected Rule
pip.parse
Is this a regression?
Not really, it's caused by upgrading
fastmcpfrom v3 to v4Description
fastmcp==4.0.5declaresfastmcp-slim[client,server]==4.0.5unconditionallyin its
Requires-Dist, andfastmcp-slimgates its client and serverdependencies (
httpx2,authlib,mcp,starlette, and others) behind thoseextras. When
fastmcpis pulled in throughpip.parse, rules_python does notenable the
clientandserverextras on thefastmcp_slimtarget, so thosegated dependencies are never wired into the dependency graph. Depending on
@pypi//fastmcptherefore produces a different importable environment thanpip install fastmcp:import fastmcp.clientfails at runtime withModuleNotFoundError: No module named 'httpx2', even thoughhttpx2and theother extra dependencies are pinned in the lock and exist as
@pypi//…targets.The cause is in
python/private/pypi/pep508_deps.bzl. Thefastmcp-slim[client,server]edge is parsed into a requirement with.name == "fastmcp-slim"and.extras == ["client", "server"](
pep508_requirement.bzl), but_resolve_extras()only consultsreq.extrasfor self-edges (
if req.name != self_name: continue), and the dependency labelis built from
req.namealone, so the[client,server]qualifier is discarded.Whether a package's
extra == '...'dependencies are wired is then decidedsolely by the
extraspassed to that package's ownwhl_library, which ispopulated from how the package appears as a requirement line in the lock.
fastmcp-slimappears only as a plain transitive pin with no extras, so itswhl_libraryreceivesextras = []and the client and server dependencies aredropped.
🔬 Minimal Reproduction
🔥 Exception or Error
🌍 Your Environment
Operating System:
ubuntu 24.04
Output of
bazel version:Rules_python version:
1.9.2
Anything else relevant?