`tomli` not found in 3.10
I ran a pre-commit autoupdate on my project and now pre-commit won't run. The log is below:
auto-walrus..............................................................Failed
- hook id: auto-walrus
- exit code: 1
Traceback (most recent call last):
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/bin/auto-walrus", line 5, in <module>
from auto_walrus import main
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/lib/python3.10/site-packages/auto_walrus.py", line 17, in <module>
import tomli as tomllib
ModuleNotFoundError: No module named 'tomli'
Traceback (most recent call last):
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/bin/auto-walrus", line 5, in <module>
from auto_walrus import main
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/lib/python3.10/site-packages/auto_walrus.py", line 17, in <module>
import tomli as tomllib
ModuleNotFoundError: No module named 'tomli'
Traceback (most recent call last):
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/bin/auto-walrus", line 5, in <module>
from auto_walrus import main
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/lib/python3.10/site-packages/auto_walrus.py", line 17, in <module>
import tomli as tomllib
ModuleNotFoundError: No module named 'tomli'
Traceback (most recent call last):
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/bin/auto-walrus", line 5, in <module>
from auto_walrus import main
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/lib/python3.10/site-packages/auto_walrus.py", line 17, in <module>
import tomli as tomllib
ModuleNotFoundError: No module named 'tomli'
Traceback (most recent call last):
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/bin/auto-walrus", line 5, in <module>
from auto_walrus import main
File "/home/karlwooster/.cache/pre-commit/repo1ulum2zu/py_env-python3.10/lib/python3.10/site-packages/auto_walrus.py", line 17, in <module>
import tomli as tomllib
ModuleNotFoundError: No module named 'tomli'
I'm not really sure how to debug this in a pre-commit environment.
I'm using poetry and my python version is 3.10.12.
thanks @WoosterInitiative for the report
@cclauss do you know how to fix this? https://github.com/MarcoGorelli/auto-walrus/pull/36/files
@MarcoGorelli Please create a new release to PyPI that contains the changes in
- #36
That pull request was merged AFTER the last release.
Perhaps a test in CI for different versions of Python? Would have caught this before release.
@WoosterInitiative Are you able to create a pull request that would add Python 3.8 and 3.10 to our GitHub Actions?
ah thanks, looks like I merged the PR but forgot to cut a release 🤦
There's a new release now, could you try it out please? thanks!
(I'm still amazed that people are actually using auto-walrus 😄 I'm tempted to try rewriting it in Rust and call it auto-wal.rs 🦀 Then it'll be just as silly as before, but blazingly fast)
i presume it works now, so closing, but lmk if there's still an issue pls
@WoosterInitiative Can you please run pipx run --python 3.10 auto-walrus -h and tell us what the result is?
- https://pipx.pypa.io