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

Pre-commit hook fails due to import error #1146

Closed
chadmarchand opened this issue Jun 26, 2022 · 1 comment · Fixed by #1150
Closed

Pre-commit hook fails due to import error #1146

chadmarchand opened this issue Jun 26, 2022 · 1 comment · Fixed by #1150
Assignees
Labels
CI About continious integration

Comments

@chadmarchand
Copy link
Contributor

chadmarchand commented Jun 26, 2022

Description

When following the contribution guidelines, I installed all dependencies and ran the pre-commit hook when working on my PR (#1145). The pre-commit hook failed when committing due to an import error. I manually moved an older version of the click package in order to get the hook to work.

Steps/Code to Reproduce

Follow the contribution guidelines (pip install -e .[test], pre-commit install). Then commit a change.

Expected Results

No import error is thrown when running the pre-commit hook.

Actual Results

An import error is thrown when running the pre-commit hook.

[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /home/chad/.cache/pre-commit/patch1656209125-53395.
black....................................................................Failed
- hook id: black
- exit code: 1

Traceback (most recent call last):
  File "/home/chad/.cache/pre-commit/repo9hzu_n53/py_env-python3/bin/black", line 8, in <module>
    sys.exit(patched_main())
  File "/home/chad/.cache/pre-commit/repo9hzu_n53/py_env-python3/lib/python3.8/site-packages/black.py", line 4134, in patched_main
    patch_click()
  File "/home/chad/.cache/pre-commit/repo9hzu_n53/py_env-python3/lib/python3.8/site-packages/black.py", line 4123, in patch_click
    from click import _unicodefun  # type: ignore
ImportError: cannot import name '_unicodefun' from 'click' (/home/chad/.cache/pre-commit/repo9hzu_n53/py_env-python3/lib/python3.8/site-packages/click/__init__.py)

mypy openml..............................................................Passed
mypy tests...........................................(no files to check)Skipped
flake8 openml............................................................Passed
flake8 tests.........................................(no files to check)Skipped
[INFO] Restored changes from /home/chad/.cache/pre-commit/patch1656209125-53395.

Versions

Python 3.8.10 (default, Mar 15 2022, 12:22:08)
NumPy 1.20.1
SciPy 1.6.1
Scikit-Learn 1.1.1
OpenML 0.12.2

Comments

This appears to be the issue: https://stackoverflow.com/questions/71673404/importerror-cannot-import-name-unicodefun-from-click So it seems updating black in the pre-commit hook would fix the issue.

@PGijsbers
Copy link
Collaborator

Thanks for the report. I agree to the suggested change. I will look at bumping the black version myself to ensure there are no undesired changes in formatting.

@PGijsbers PGijsbers self-assigned this Jun 27, 2022
@PGijsbers PGijsbers added bug CI About continious integration and removed bug labels Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI About continious integration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants