auto-walrus icon indicating copy to clipboard operation
auto-walrus copied to clipboard

`tomli` not found in 3.10

Open WoosterInitiative opened this issue 1 year ago • 5 comments

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.

WoosterInitiative avatar Apr 22 '24 21:04 WoosterInitiative

thanks @WoosterInitiative for the report

@cclauss do you know how to fix this? https://github.com/MarcoGorelli/auto-walrus/pull/36/files

MarcoGorelli avatar Apr 22 '24 21:04 MarcoGorelli

@MarcoGorelli Please create a new release to PyPI that contains the changes in

  • #36

That pull request was merged AFTER the last release.

cclauss avatar Apr 22 '24 22:04 cclauss

Perhaps a test in CI for different versions of Python? Would have caught this before release.

WoosterInitiative avatar Apr 23 '24 00:04 WoosterInitiative

@WoosterInitiative Are you able to create a pull request that would add Python 3.8 and 3.10 to our GitHub Actions?

cclauss avatar Apr 23 '24 04:04 cclauss

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)

MarcoGorelli avatar Apr 23 '24 08:04 MarcoGorelli

i presume it works now, so closing, but lmk if there's still an issue pls

MarcoGorelli avatar May 09 '24 11:05 MarcoGorelli

@WoosterInitiative Can you please run pipx run --python 3.10 auto-walrus -h and tell us what the result is?

  • https://pipx.pypa.io

cclauss avatar May 09 '24 12:05 cclauss