hatch-mypyc icon indicating copy to clipboard operation
hatch-mypyc copied to clipboard

Cannot use mypy configuration in `pyproject.toml`

Open francis-clairicia opened this issue 1 year ago • 5 comments

Bug description

The mypy configuration is stored in pyproject.toml

I tried to do the following:

[tool.hatch.build.targets.wheel.hooks.mypyc]
dependencies = ["hatch-mypyc~=0.16.0"]
mypy-args = ["--config-file=pyproject.toml"]

But I ended up with

Exception: Error while invoking Mypyc:
usage: mypy [-h] [-v] [-V] [more options; see below]
            [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
mypy: error: Cannot find config file 'pyproject.toml'

francis-clairicia avatar Jun 23 '24 10:06 francis-clairicia

I was running into this issue as well. This seems to be the cause:

https://github.com/ofek/hatch-mypyc/blob/95613d56cf6cb73b72b71690da948743c629f941/hatch_mypyc/plugin.py#L269-L281

b0o avatar Jul 18 '24 18:07 b0o

definitely a bug, can you please check if it supports PEP 639 now?

ofek avatar Jul 18 '24 18:07 ofek

PEP 639 is still a draft, and I'm not sure if setuptools supports it. There are a few issues mentioning PEP 639, but nothing conclusive, e.g. https://github.com/pypa/setuptools/issues/3596 and https://github.com/pypa/setuptools/issues/4033.

b0o avatar Jul 18 '24 19:07 b0o

setuptools has support for PEP 639 as of 77.0.0: https://github.com/pypa/setuptools/pull/4904 / https://setuptools.pypa.io/en/stable/history.html#v77-0-0. I ran into the same issue, would be wonderful if this was fixed!

Liam-DeVoe avatar Sep 21 '25 01:09 Liam-DeVoe

Same issue still here, maybe it is time to remove hide_project_file...

ddaanet avatar Oct 23 '25 10:10 ddaanet