You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The codebase imports its modules under the literal top-level name src (e.g. from src.dataset_tools.cli import cli), and the packaging entry points follow suit (ami-dataset = "src.dataset_tools.cli:cli"). After the Poetry→uv migration (#68), the wheel ships src/ and this works for editable installs and even for a non-editable pip install (verified by building the wheel and importing src.dataset_tools.cli from outside the repo).
It works, but src is not a good distribution package name:
src is a generic name. In a shared environment it can collide or merge (implicit namespace packages) with any other project that also ships a top-level src.
src/ is conventionally a layout container, not the package itself. The standard src-layout puts a single importable package one level down (src/<package>/) and imports it by name (<package>.…), never src.….
pip install ami-ml currently exposes a package called src, which is surprising for any downstream consumer.
This aligns the repo with the standard src-layout used elsewhere in the lab.
Goal
Rename the package so the project installs cleanly and is imported as ami_ml:
Move the modules under a single package: src/ami_ml/{dataset_tools,classification,localization}/
from src.dataset_tools import … → from ami_ml.dataset_tools import …
git mv is preferable to a Hatchling sources path remap: with the directory actually named ami_ml, both editable and wheel installs resolve ami_ml for free, and there's no dev/wheel import-name mismatch. (A build-time remap was tested and is fragile — it still forces the same import rewrite, so it buys nothing.)
Sequencing
This rewrites nearly every import line, so it should land after the in-flight PRs that heavily touch src/ (#74, #69) to avoid rebase conflicts.
Verify after: uv build --wheel, install the wheel non-editable in a clean venv, ami-dataset --help + import ami_ml.dataset_tools, and uv run pytest tests/.
Background
The codebase imports its modules under the literal top-level name
src(e.g.from src.dataset_tools.cli import cli), and the packaging entry points follow suit (ami-dataset = "src.dataset_tools.cli:cli"). After the Poetry→uv migration (#68), the wheel shipssrc/and this works for editable installs and even for a non-editablepip install(verified by building the wheel and importingsrc.dataset_tools.clifrom outside the repo).It works, but
srcis not a good distribution package name:srcis a generic name. In a shared environment it can collide or merge (implicit namespace packages) with any other project that also ships a top-levelsrc.src/is conventionally a layout container, not the package itself. The standard src-layout puts a single importable package one level down (src/<package>/) and imports it by name (<package>.…), neversrc.….pip install ami-mlcurrently exposes a package calledsrc, which is surprising for any downstream consumer.This aligns the repo with the standard src-layout used elsewhere in the lab.
Goal
Rename the package so the project installs cleanly and is imported as
ami_ml:src/ami_ml/{dataset_tools,classification,localization}/from src.dataset_tools import …→from ami_ml.dataset_tools import …[tool.hatch.build.targets.wheel] packages = ["src/ami_ml"]ami-dataset,ami-classification), the tests (tests/imports), and the flake8per-file-ignorespaths.Sketch
git mvis preferable to a Hatchlingsourcespath remap: with the directory actually namedami_ml, both editable and wheel installs resolveami_mlfor free, and there's no dev/wheel import-name mismatch. (A build-time remap was tested and is fragile — it still forces the same import rewrite, so it buys nothing.)Sequencing
This rewrites nearly every import line, so it should land after the in-flight PRs that heavily touch
src/(#74, #69) to avoid rebase conflicts.Notes
srcpackaging is verified working; this is a correctness/cleanliness follow-up.uv build --wheel, install the wheel non-editable in a clean venv,ami-dataset --help+import ami_ml.dataset_tools, anduv run pytest tests/.