-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Incompatible with click 8.1.0 (ImportError: cannot import name '_unicodefun' from 'click') #2964
Incompatible with click 8.1.0 (ImportError: cannot import name '_unicodefun' from 'click') #2964
Comments
@stumpylog |
I just came here to open a very similar issue. The issue is caused by the release of click 8.1.0. Install |
+1: We have a failure in ( |
|
Works around psf/black#2964
For those that are running - repo: https://github.com/psf/black
rev: 22.1.0
hooks:
- id: black
additional_dependencies: ['click==8.0.4'] Update - new version is available- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black |
We should probably pin to <8.1.0 for now. I can help get a release out later today to do that. |
Why was black importing an internal module? I was not expecting this to be the change that caused issues. Sorry about that. |
Looks like this is why: def patch_click() -> None:
"""Make Click not crash on Python 3.6 with LANG=C.
On certain misconfigured environments, Python 3 selects the ASCII encoding as the
default which restricts paths that it can access during the lifetime of the
application. Click refuses to work in this scenario by raising a RuntimeError.
In case of Black the likelihood that non-ASCII characters are going to be used in
file paths is minimal since it's Python source code. Moreover, this crash was
spurious on Python 3.7 thanks to PEP 538 and PEP 540.
"""
try:
from click import core
from click import _unicodefun
except ModuleNotFoundError:
return
for module in (core, _unicodefun):
if hasattr(module, "_verify_python3_env"):
module._verify_python3_env = lambda: None # type: ignore
if hasattr(module, "_verify_python_env"):
module._verify_python_env = lambda: None # type: ignore So funnily enough, this should still work, it's just catching the wrong exception. |
) * pip_audit/dependency_source: match candidate names against project See: pypa/packaging#527. Fixes #248. * pip_audit/dependency_source: remove redundant `is_satisfied_by` test * test: add tests for vexing sdist parses * test: update comment * CHANGELOG: record fixes * setup: pin `click` Works around psf/black#2964 * setup: add note about pinned click
The import doesn't raise The code would need to be changed to |
Well good news at least, that whole patch isn't needed anymore, since Click itself is now at the same point of not raising locale encoding errors. 😄 |
Move to the stable release and pin click, as black used the wrong exception to work around a click interaction causing issues. See psf/black#2964
This causing black to fail when run on Google Colab right now as well. |
Move to the stable release and pin click, as black used the wrong exception to work around a click interaction causing issues. See psf/black#2964
Move to the stable release and pin click, as black used the wrong exception to work around a click interaction causing issues. See psf/black#2964
Before this commit The black pre-commit step is broken due to an incompatibility with a new version of one of its dependencies (click 8.1+). See: psf/black#2964 (comment) After this commit The new version does not have this incompatibility. This commit bumps the black version to 22.3.0. Part of odoo/upgrade#3391 Signed-off-by: Christophe Simonis <[email protected]>
The CI error was fixed in: psf/black#2964 Thus, we need black >22.3.0
* Add missing test dependency * pre-commit * Add pre-commit workflow * Add CLI test to make sure the package has been properly installed * Remove ament hooks * Add missing apt-python dependency Not sure if it's necessary ... * Fix CI pre-commit The CI error was fixed in: psf/black#2964 Thus, we need black >22.3.0
Refer to psf/black#2964, this error can be fixed by picking `click` to 8.0.4. Signed-off-by: TatWai Chong <[email protected]> Change-Id: If3970e0cd31f2190cacb741530cb38a31c943938
- fixes error in CI - see psf/black#2964
A new version of Click broke Black. The new version of Black fixes the issue. See also psf/black#2964
Solves psf/black#2964
* update black according to psf/black#2964 * new black rules do a change on existing files
Pre-commit won't allow its yaml file in a separate commit, so the upgrade to black 22.3.0 is included as well. This is to address bug 2964 [0] where black fails locally with pre-commit. [0] psf/black#2964
Update black from 19.10b0 to 24.4.2. black had been broken due to an ImportError (see psf/black#2964).
* Update black Update black from 19.10b0 to 24.4.2. black had been broken due to an ImportError (see psf/black#2964). * Add black to pre-commit * Add black to GitHub Actions * Add flake8 to pre-commit * Update requirements.txt using Pipfile Ran `pipenv requirements --exclude-markers > requirements.txt` to update requirements.txt with correct dependencies and versions from Pipfile. I did this primarily to update the black version (because the previous version was broken with an ImportError), and I might as well update the rest of the dependencies as well. * Add flags to black for GitHub Actions Add the --check and --diff flags to black within GitHub Actions workflows so that the workflows fail if files need formatting. Without these flags, black will "format" the files and exit without error, which doesn't actually write to the files during workflows. * Add flags to flake8 and black for pre-commit Add flags to flake8 and black for pre-commit based on existing flags in GitHub Actions workflows. This includes selecting for specific flake8 errors and adjusting the max line length. These existing configs are extremely limited, so they should be broadened to more errors and/or a more widely accepted max line length. Also ran black on the entire codebase to satisfy the GitHub workflows. * Fix typo in black option flag * Fix formatting errors
Solves psf/black#2964
…t with `click`; see psf/black#2964.
…249) * pip_audit/dependency_source: match candidate names against project See: pypa/packaging#527. Fixes #248. * pip_audit/dependency_source: remove redundant `is_satisfied_by` test * test: add tests for vexing sdist parses * test: update comment * CHANGELOG: record fixes * setup: pin `click` Works around psf/black#2964 * setup: add note about pinned click
…249) * pip_audit/dependency_source: match candidate names against project See: pypa/packaging#527. Fixes #248. * pip_audit/dependency_source: remove redundant `is_satisfied_by` test * test: add tests for vexing sdist parses * test: update comment * CHANGELOG: record fixes * setup: pin `click` Works around psf/black#2964 * setup: add note about pinned click
Mentioned fix on Black repo: psf/black#2964
This picks up the fix for psf/black#2964
This picks up the fix for psf/black#2964
Please use Black 22.3.0 (or newer) which was just released to fix this issue or pin Click to 8.0.0, 8.0.1, 8.0.2, 8.0.3, or 8.0.4.
~ @ichard26 at March 28 3:15 PM EST
So hey y'all, CI is broken eh?
Anyway, we are aware the most recent release of Click, 8.1.0, is breaking Black. This is because Black imports an internal module so Python 3.6 users with misconfigured LANG continues to work mostly properly. The code that patches click was supposed to be resilient to the module disappearing but the code was catching the wrong exception.
To unbreak your CI, please pin Click to 8.0.0, 8.0.1, 8.0.2, 8.0.3, or 8.0.4. We are working on a more longterm fix (probably fixing the patching code or getting rid of it entirely) and will try to get a release out soon.
~ @ichard26 at March 28 2:29 PM EST
Describe the bug
The Github Action step:
fails with the following trackeback:
To Reproduce
Run the
black
action on a Github runner, configured as above.Expected behavior
The action should only fail if files are not formatted.
Environment
OS:
runs-on: ubuntu-20.04
Version:
22.1.0
Action:
@stable
Python version:
3.8
I believeAdditional context
The text was updated successfully, but these errors were encountered: