python / python/mypy

(🐞) `dmypy` doesn't report any errors when passed an absolute file if the project is installed with a `.pth` file

Open
#18,117 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

given

- test/
|-src/__init__.py
|-pyproject.toml
[project]
name = "test"
version = "1"
requires-python = ">=3.13, <3.14"
build-backend = "hatchling.build"
dependencies = [
    "mypy>=1.13.0",
]

[build-system]
requires = ["hatchling==1.25.0"]
build-backend = "hatchling.build"
> uv sync
...
> echo a > test.py
> dmypy run test.py
Daemon started
test.py:1: error: Name "a" is not defined  [name-defined]
Found 1 error in 1 file (checked 1 source file)
> echo b > test.py
> dmypy run absolute/path/to/test.py
Success: no issues found in 1 source file

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided project layout and the two dmypy run commands, comparing a relative path with an absolute path after installation through a .pth file. Trace dmypy's handling of absolute file arguments and confirm that the absolute-path invocation reports the same undefined-name error as the relative one.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.