Skip to content

[CI] black in pre-commit broken #444

Description

@orbeckst

Describe the bug

The pre-commit hook fails with an issue with black that seems unrelated to the commit itself.

See https://github.com/MDAnalysis/UserGuide/actions/runs/33778483285/job/100726038569?pr=443

Expected behavior
pre-commit runs all tools

Actual behavior

pre-commit run --show-diff-on-failure --color=always --all-files
...

black....................................................................Failed
  - hook id: black
  - exit code: 1
  
  Traceback (most recent call last):
    File "/home/runner/.cache/pre-commit/repouhkhhhr9/py_env-python3.14/bin/black", line 6, in <module>
      sys.exit(patched_main())
               ~~~~~~~~~~~~^^
    File "/home/runner/.cache/pre-commit/repouhkhhhr9/py_env-python3.14/lib/python3.14/site-packages/black/__init__.py", line 1455, in patched_main
      main()
      ~~~~^^
    File "/home/runner/.cache/pre-commit/repouhkhhhr9/py_env-python3.14/lib/python3.14/site-packages/click/core.py", line 1631, in __call__
      return self.main(*args, **kwargs)
             ~~~~~~~~~^^^^^^^^^^^^^^^^^
    File "/home/runner/.cache/pre-commit/repouhkhhhr9/py_env-python3.14/lib/python3.14/site-packages/click/core.py", line 1552, in main
      rv = self.invoke(ctx)
    File "/home/runner/.cache/pre-commit/repouhkhhhr9/py_env-python3.14/lib/python3.14/site-packages/click/core.py", line 1415, in invoke
      return ctx.invoke(self.callback, **ctx.params)
             ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/runner/.cache/pre-commit/repouhkhhhr9/py_env-python3.14/lib/python3.14/site-packages/click/core.py", line 910, in invoke
      return callback(*args, **kwargs)
    File "/home/runner/.cache/pre-commit/repouhkhhhr9/py_env-python3.14/lib/python3.14/site-packages/click/decorators.py", line 34, in new_func
      return f(get_current_context(), *args, **kwargs)
    File "/home/runner/.cache/pre-commit/repouhkhhhr9/py_env-python3.14/lib/python3.14/site-packages/black/__init__.py", line 570, in main
      reformat_many(
      ~~~~~~~~~~~~~^
          sources=sources,
          ^^^^^^^^^^^^^^^^
      ...<4 lines>...
          workers=workers,
          ^^^^^^^^^^^^^^^^
      )
      ^
    File "/home/runner/.cache/pre-commit/repouhkhhhr9/py_env-python3.14/lib/python3.14/site-packages/black/__init__.py", line 767, in reformat_many
      loop = asyncio.get_event_loop()
    File "/opt/hostedtoolcache/Python/3.14.7/x64/lib/python3.14/asyncio/events.py", line 718, in get_event_loop
      raise RuntimeError('There is no current event loop in thread %r.'
                         % threading.current_thread().name)
  RuntimeError: There is no current event loop in thread 'MainThread'.
  
  mypy.....................................................................Passed
  flake8...................................................................Passed
  Error: Process completed with exit code 1.

Additional context
see #443

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions