-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
More recent versions (>=2.0) of poetry are moving towards a more PEP compliant pyproject.toml. Some of the toml table headers have been updated so references to the table can fail.
One such example is hooks/check_mypy_import_errors.py calling PyprojectFile.package_name() from utils/pyproject_file.py to retrieve the project name, example error below:
Check for mypy import errors.............................................Failed
- hook id: check-mypy-import-errors
- exit code: 1
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/pedwrds/repos/tests/tomltest/.venv/lib/python3.12/site-packages/hooks/check_mypy_import_errors.py", line 103, in <module>
sys.exit(main())
^^^^^^
File "/Users/pedwrds/repos/tests/tomltest/.venv/lib/python3.12/site-packages/hooks/check_mypy_import_errors.py", line 99, in main
return CheckMypyImportErrors().run()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pedwrds/repos/tests/tomltest/.venv/lib/python3.12/site-packages/hooks/check_mypy_import_errors.py", line 65, in run
mypy_stdout, mypy_err, _ = mypy.run([setup_file.package_name])
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pedwrds/repos/tests/tomltest/.venv/lib/python3.12/site-packages/hooks/utils/pyproject_file.py", line 21, in package_name
return str(self.contents["tool"]["poetry"]["name"])
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'name'We should be able to try and except on keyError to handle this...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels