Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use mypy configuration in pyproject.toml #37

Open
francis-clairicia opened this issue Jun 23, 2024 · 3 comments
Open

Cannot use mypy configuration in pyproject.toml #37

francis-clairicia opened this issue Jun 23, 2024 · 3 comments

Comments

@francis-clairicia
Copy link

francis-clairicia commented Jun 23, 2024

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 francis-clairicia changed the title Add support of context formatting Cannot use mypy configuration in pyproject.toml Jun 23, 2024
@b0o
Copy link

b0o commented Jul 18, 2024

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

@contextmanager
def hide_project_file(self):
# TODO: remove this and bump setuptools when it supports PEP 639
project_file = os.path.join(self.root, 'pyproject.toml')
project_file_backup = os.path.join(self.root, 'pyproject.toml.bak')
os.replace(project_file, project_file_backup)
try:
yield
finally:
os.replace(project_file_backup, project_file)

@ofek
Copy link
Owner

ofek commented Jul 18, 2024

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

@b0o
Copy link

b0o commented Jul 18, 2024

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. pypa/setuptools#3596 and pypa/setuptools#4033.

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

No branches or pull requests

3 participants