Skip to content

Declare imported dependencies and drop the redundant metrix setup.py - #160

Open
mawad-amd wants to merge 3 commits into
mainfrom
muhaawad/declare-missing-deps
Open

mawad-amd wants to merge 3 commits into
mainfrom
muhaawad/declare-missing-deps

Conversation

@mawad-amd

@mawad-amd mawad-amd commented Aug 21, 2026

Copy link
Copy Markdown
Member

This change fixes nothing currently observable. It removes an accident.
Verified twice, independently, on two different base images: unpatched main and the patched tree are observationally identical — every import, both console scripts, and the packaged gpu_query.hip behave the same before and after.

Three packages import modules they never declare, and metrix carries a dead setup.py.

Undeclared dependencies

package imports declared? arrives via
metrix yamlprofiler/rocprof_wrapper.py:12, backends/base.py no fastmcp → jsonschema-path
rocm_mcp pydanticfrom pydantic import Field ×4 modules no fastmcp
uprof_mcp pydantic — ×1 module no fastmcp

All three resolve transitively today. Each works only by accident of another package's dependency tree, and breaks if fastmcp ever drops or vendors them. Declaring what you import costs three lines and removes the coupling.

Removing metrix/setup.py

metrix was the only package with both a setup.py and a pyproject.toml; the other six are pyproject-only.

Modern pip uses the PEP 517 backend for both regular and editable installs, so setup.py is never executed:

$ pip install -v ./metrix          # pip 26.2.1
  Preparing metadata (pyproject.toml)      <- not "Running setup.py"
$ pip show metrix
  Requires: fastmcp, pandas                <- pyproject's list

Older pip/setuptools does take the legacy path — reproduced with a container's system pip via pip install -e, which prints Running setup.py develop for metrix. On that path setup.py is authoritative, and it is missing four things pyproject declares:

  • the fastmcp dependency
  • the metrix-mcp console script (it declares only metrix)
  • [tool.setuptools.package-data] "metrix.backends" = ["*.hip"], so gpu_query.hip would not ship and device_info._find_hip_source() would return None
  • pyyaml, once added

So the file is dead on current pip and wrong on old pip. Keeping the two configs in sync buys nothing, which is why this deletes rather than patches.

Its comment claims it exists "for legacy metadata fields that don't map directly from pyproject.toml's modern PEP 621 format," but every field it sets is already in pyproject, and nothing in the repo references the file (grep across *.sh, *.yml, *.toml, *.cfg, *.md → no hits).

Test plan

Unpatched main was run first in every case, as a control — so the check is known to be capable of showing a difference before any conclusion is drawn from it.

Declared metadata, bare python:3.14, fresh venv per arm, cd / before probing, pip exit codes asserted rather than grepped:

package before (main) after
metrix fastmcp, pandas fastmcp, pandas, pyyaml
rocm-mcp amdsmi, beautifulsoup4, fastmcp, httpx … + pydantic
uprof-mcp fastmcp … + pydantic

Runtime behaviour, independently on rocm/dev-ubuntu-22.04:7.0.2-complete: imports of metrix.backends.base, metrix.mcp.server, rocm_mcp.*, uprof_mcp.*, both console scripts, and packaged gpu_query.hip — all OK before, all OK after, identical line for line.

All three packages install with exit 0 after the change, metrix/setup.py is confirmed absent from the built tree, and ruff check is clean.

Note: [self-hosted, mi3xx] jobs will queue — that runner is offline.

🤖 Generated with Claude Code

mawad-amd and others added 3 commits August 20, 2026 21:47
Three packages import modules they never declare. All three resolve
transitively today, so nothing is broken right now, but each works only
by accident of what another dependency happens to pull in:

  - metrix imports yaml (profiler/rocprof_wrapper.py, backends/base.py);
    PyYAML arrives via fastmcp -> jsonschema-path
  - rocm_mcp imports pydantic in four modules, via fastmcp
  - uprof_mcp imports pydantic in one module, via fastmcp

Any of these breaks if fastmcp changes its dependency tree.

metrix also carried both a setup.py and a pyproject.toml. Modern pip uses
the PEP 517 backend for regular and editable installs alike, so setup.py is
never executed and the file is simply dead. Older pip and setuptools do run
setup.py develop, and that copy declares neither fastmcp nor pyyaml, omits
the metrix-mcp console script, and sets no package-data, so gpu_query.hip
would not ship and device_info._find_hip_source() would return None.

setup.py sets no field that pyproject does not already set, despite its
comment claiming otherwise, and nothing in the repo references it. Removing
it leaves one source of truth and matches the other six packages.

Co-Authored-By: Claude <noreply@anthropic.com>
Removing it drops the legacy Author field from the installed metadata:

  with setup.py     Author: Muhammad Awad
  without           Author:

Everything else is unchanged -- Summary, Home-page, Author-email, License and
Requires are identical, and editable, non-editable and wheel installs all
import, expose both console scripts and resolve dependencies either way.

PEP 621 authors entries that carry both a name and an email map to
Author-email, not Author, so pyproject.toml alone cannot populate it. The
dependency declarations this PR adds are unaffected and stay.

Co-Authored-By: Claude <noreply@anthropic.com>
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