-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Latest docker images fail to run blackd with an ImportError #4163
Comments
Howdy We've on purpose never built the docker image with the [d] extra dependencies to keep the images as small as possible. We could add this in - But I want to see what people prefer:
Thoughts all? |
Actually, I am wrong, we do try to do the extra install: https://github.com/psf/black/blob/main/Dockerfile#L13 I will look into it - But if anyone has time, PR welcoming fixing getting aiohttp into the container.
|
I haven't delved into the history, but might be worth looking at what we changed in 23.10. Could be a Hatch bug; this reminds me of #4107 which is sort of the opposite. |
Confirmed that 23.10.0 is the last working version. The error occurs on 23.10.1 and onwards. |
I thought I'd try this to see if anything has changed and I was able to use the latest build + 24.4.2 from Docker hub and it works:
Was surprised a formatting change happened too FWIW it was cooper@home1:~/repos/black$ git diff
diff --git a/src/black/handle_ipynb_magics.py b/src/black/handle_ipynb_magics.py
index 5b2847c..55ef226 100644
--- a/src/black/handle_ipynb_magics.py
+++ b/src/black/handle_ipynb_magics.py
@@ -17,30 +17,36 @@ else:
from black.output import out
from black.report import NothingChanged
-TRANSFORMED_MAGICS = frozenset((
- "get_ipython().run_cell_magic",
- "get_ipython().system",
- "get_ipython().getoutput",
- "get_ipython().run_line_magic",
-))
-TOKENS_TO_IGNORE = frozenset((
- "ENDMARKER",
- "NL",
- "NEWLINE",
- "COMMENT",
- "DEDENT",
- "UNIMPORTANT_WS",
- "ESCAPED_NL",
-))
-PYTHON_CELL_MAGICS = frozenset((
- "capture",
- "prun",
- "pypy",
- "python",
- "python3",
- "time",
- "timeit",
-))
+TRANSFORMED_MAGICS = frozenset(
+ (
+ "get_ipython().run_cell_magic",
+ "get_ipython().system",
+ "get_ipython().getoutput",
+ "get_ipython().run_line_magic",
+ )
+)
+TOKENS_TO_IGNORE = frozenset(
+ (
+ "ENDMARKER",
+ "NL",
+ "NEWLINE",
+ "COMMENT",
+ "DEDENT",
+ "UNIMPORTANT_WS",
+ "ESCAPED_NL",
+ )
+)
+PYTHON_CELL_MAGICS = frozenset(
+ (
+ "capture",
+ "prun",
+ "pypy",
+ "python",
+ "python3",
+ "time",
+ "timeit",
+ )
+)
TOKEN_HEX = secrets.token_hex
Can some other people check but I think we're working?
|
Just tried
@cooperlees, maybe you're getting different results because you're mounting the source folder? |
Doh - I'm not testing blackd ... Silly me. |
- Lets install black, then ask to install black with extrasC - pip sees black is installed and just installs extra dependencies Test: - Build local container - `docker build -t black_local .` - Run blackd in container - `docker run -p 45484:45484 --rm black_local blackd --bind-host 0.0.0.0` ``` cooper@home1:~/repos/black$ docker run -p 45484:45484 --rm black_local blackd --bind-host 0.0.0.0 blackd version 24.4.3.dev11+gad60e62 listening on 0.0.0.0 port 45484 INFO:aiohttp.access:10.255.255.1 [10/May/2024:14:40:36 +0000] "GET / HTTP/1.1" 405 204 "-" "curl/8.5.0" cooper@home1:~/repos/black$ curl http://10.6.9.2:45484 405: Method Not Allowed ``` - Test version is compiled ``` cooper@home1:~/repos/black$ docker run --rm black_local black --version black, 24.4.3.dev11+gad60e62 (compiled: yes) Python (CPython) 3.12.3 ``` Fixes #4163
…4357) - Lets install black, then ask to install black with extrasC - pip sees black is installed and just installs extra dependencies Test: - Build local container - `docker build -t black_local .` - Run blackd in container - `docker run -p 45484:45484 --rm black_local blackd --bind-host 0.0.0.0` ``` cooper@home1:~/repos/black$ docker run -p 45484:45484 --rm black_local blackd --bind-host 0.0.0.0 blackd version 24.4.3.dev11+gad60e62 listening on 0.0.0.0 port 45484 INFO:aiohttp.access:10.255.255.1 [10/May/2024:14:40:36 +0000] "GET / HTTP/1.1" 405 204 "-" "curl/8.5.0" cooper@home1:~/repos/black$ curl http://10.6.9.2:45484 405: Method Not Allowed ``` - Test version is compiled ``` cooper@home1:~/repos/black$ docker run --rm black_local black --version black, 24.4.3.dev11+gad60e62 (compiled: yes) Python (CPython) 3.12.3 ``` Fixes #4163
FWIW - |
Describe the bug
I'm on MacOS. I try to run Black through Docker, but the container promptly stops with an ImportError related to the missing aiohttp dep.
To Reproduce
pyfound/black:23.10.0
The text was updated successfully, but these errors were encountered: