Hey python users of `pants` :wave: Could someone h...
# welcome
l
Hey python users of
pants
šŸ‘‹ Could someone help me debug that
pants test
passes correctly but
pants check
(with
mypy
) doesn't, because of an
import
not found. I'm puzzled that imports are found in the
test
task, but not with
check
. My code structure is as follows:
Copy code
ā”œā”€ā”€ BUILD
ā”œā”€ā”€ kaiko
ā”‚   ā””ā”€ā”€ geometry
ā”‚       ā”œā”€ā”€ *.py
ā”œā”€ā”€ pyproject.toml
ā”œā”€ā”€ requirements.txt
ā”œā”€ā”€ tests
    ā”œā”€ā”€ BUILD
    ā”œā”€ā”€ test_*.py
The top-level BUILD file is:
Copy code
python_requirements(name="kaiko-geometry-reqs")

poetry_requirements(name="kaiko-geometry-poetry-reqs")

python_sources(
    name="kaiko-geometry",
    sources=["kaiko/geometry/**/*.py"],
    dependencies=[
        ":kaiko-geometry-reqs#numpy",
    ],
)
The BUILD file in
tests
is:
Copy code
python_tests(
    name="kaiko-geometry-tests",
    dependencies=[
        "//:dev-reqs",  # Top-level repo deps: pytest for example
        "libs/geometry:kaiko-geometry-reqs",
        "libs/geometry:kaiko-geometry",
    ],
)

python_test_utils(
    name="kaiko-geometry-test-utils",
    dependencies=[
        "//:dev-reqs",  # Top-level repo deps: pytest for example
        "libs/geometry:kaiko-geometry-reqs",
        "libs/geometry:kaiko-geometry",
    ],
)
The
libs/geometry
paths in the second BUILD file come from the fact that all this stuff is at
libs/geometry
in the enclosing repo.