Having settings located in pyproject.toml doesn't work correctly
See original GitHub issueHi, I have config located in a pyproject.toml file as described here: https://mypy.readthedocs.io/en/stable/config_file.html?highlight=pyproject.toml#using-a-pyproject-toml-file
This does not get automatically detected by this hook, but I can force it to look there by making the hook look as follows:
- repo: https://github.com/pre-commit/mirrors-mypy
# Type checks
rev: "" # Use the sha / tag you want to point at
hooks:
- id: mypy
args: [--config-file=pyproject.toml]
And while this does work with very basic toml files it breaks once one of your tools uses multiline strings… So with the following config pre-commit will fail:
[tool.black]
line-length = 119
target-version = ['py38']
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
# The following are specific to Black, you probably don't want those.
| blib2to3
| tests/data
| profiling
)/
'''
[tool.isort]
known_first_party = ["paperbag", "gels_and_blots"]
profile = "black"
filter_files = true
[mypy]
python_version = 3.8
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
ignore_missing_imports = true
Error message:
mypy.....................................................................Failed
- hook id: mypy
- exit code: 1
pyproject.toml: Source contains parsing errors: 'pyproject.toml'
[line 6]: '/(\n'
[line 21]: ')/\n'
[line 22]: "'''\n"
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
[BUG] unable to do a local install with pyproject.toml in a venv ...
Local installation of the package doesn't work in the venv, created with ... cat -n xxx/pyproject.toml 1 [build-system] 2 requires ...
Read more >What is pyproject.toml file for? - python - Stack Overflow
Yes, pyproject.toml is the specified file format of PEP 518 which contains the build system requirements of Python projects. This solves the build-tool ......
Read more >Understanding setup.py, setup.cfg and pyproject.toml in Python
This blog post is designed to clarify my thinking around installing Python packages and the use of setup.py, setup.cfg and pyproject.toml ...
Read more >Configuring setuptools using pyproject.toml files
The example below illustrates how to write a pyproject. toml file that can be used with setuptools .
Read more >A Practical Guide to Setuptools and Pyproject.toml
An example driven guide to setting up and building a python package using Setuptools together with pyproject.toml.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@asottile im observing this with the most recent mirrors-mypy, i’l tr to debug this week
yep, figured as much!