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

Require nodeenv 1.9.0+ to support Python 3.13 #3283

Closed
wants to merge 1 commit into from

Conversation

hugovk
Copy link

@hugovk hugovk commented Aug 24, 2024

Installing a hook that uses language: node on Python 3.13:

[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/Library/Frameworks/Python.framework/Versions/3.13/bin/python3', '-mnodeenv', '--prebuilt', '--clean-src', '/Users/hugo/.cache/pre-commit/repovkr1eg6m/node_env-system', '-n', 'system')
return code: 1
stdout: (none)
stderr:
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/nodeenv.py", line 26, in <module>
        import pipes
    ModuleNotFoundError: No module named 'pipes'
Check the log at /Users/hugo/.cache/pre-commit/pre-commit.log

The log:

pre-commit.log

version information

pre-commit version: 3.8.0
git --version: git version 2.46.0
sys.version:
    3.13.0rc1 (v3.13.0rc1:e4a3e786a5e, Jul 31 2024, 19:49:53) [Clang 15.0.0 (clang-1500.3.9.4)]
sys.executable: /Library/Frameworks/Python.framework/Versions/3.13/bin/python3
os.name: posix
sys.platform: darwin

error information

An unexpected error has occurred: CalledProcessError: command: ('/Library/Frameworks/Python.framework/Versions/3.13/bin/python3', '-mnodeenv', '--prebuilt', '--clean-src', '/Users/hugo/.cache/pre-commit/repovkr1eg6m/node_env-system', '-n', 'system')
return code: 1
stdout: (none)
stderr:
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/nodeenv.py", line 26, in <module>
        import pipes
    ModuleNotFoundError: No module named 'pipes'
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pre_commit/main.py", line 417, in main
    return run(args.config, store, args)
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pre_commit/commands/run.py", line 442, in run
    install_hook_envs(to_install, store)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pre_commit/repository.py", line 238, in install_hook_envs
    _hook_install(hook)
    ~~~~~~~~~~~~~^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pre_commit/repository.py", line 94, in _hook_install
    lang.install_environment(
    ~~~~~~~~~~~~~~~~~~~~~~~~^
        hook.prefix, hook.language_version, hook.additional_dependencies,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pre_commit/languages/node.py", line 89, in install_environment
    cmd_output_b(*cmd)
    ~~~~~~~~~~~~^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pre_commit/util.py", line 111, in cmd_output_b
    raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/Library/Frameworks/Python.framework/Versions/3.13/bin/python3', '-mnodeenv', '--prebuilt', '--clean-src', '/Users/hugo/.cache/pre-commit/repovkr1eg6m/node_env-system', '-n', 'system')
return code: 1
stdout: (none)
stderr:
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/nodeenv.py", line 26, in <module>
        import pipes
    ModuleNotFoundError: No module named 'pipes'

This is because I had nodeenv 1.8.0 installed and the pipes module has been removed from the stdlib in 3.13 as part of PEP 594:

This has been fixed in nodeenv 1.9.0:

@asottile
Copy link
Member

it still works fine with older versions on older pythons (and pip defaults to latest) so no need to unnecessarily raise the lower bound

@asottile asottile closed this Aug 24, 2024
@hugovk
Copy link
Author

hugovk commented Aug 24, 2024

How would you like to support Python 3.13 where someone already has nodeenv 1.8.0 installed?

The lower bound could be raised just for 3.13 if you prefer.

@asottile
Copy link
Member

why would they already have a broken version installed? that's not my problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants