python-black Questions
7
Solved
I just started using the 'Black' formatter module with Visual Studio Code. Everything was going well till I just noticed that it uses double quotes over single quotes which I already was using in m...
Nasion asked 26/10, 2020 at 0:10
7
Solved
April 2024 UPDATE, Please read:
It appears the answer since late 2023 is the newly accepted answer provided by Mircea, this question is old so older, now incorrect answers, have more upvotes but pl...
Osmund asked 6/6, 2018 at 17:6
7
Solved
I'm trying to use black as a formatter for Python on VS Code on Ubuntu 20.04 but it's not working on auto save.
I've selected black in Python>Formatting:Provider. I'm using prettier as my defaul...
Angwantibo asked 20/3, 2021 at 1:5
3
Solved
I want to use the python black code reformatter in my pre-commit hooks, but in my company they decided to use tabulators in python code instead of spaces.
So I tried to change blacks configuration,...
Adoree asked 2/12, 2019 at 8:35
3
Solved
I'm currently researching Black as our default formatter, but, I'm having some edge cases that don't format well and I want to know if there's a way to get the result I want.
Black's documentation...
Mongolian asked 3/5, 2020 at 17:34
22
Solved
I have started using Python and Django and I am very new in this field.
And, this is my first time to ask a question here...I do apologise in advance if there is a known solution to this issue...
W...
Thermocline asked 2/12, 2020 at 2:39
4
Solved
I would like to ignore a specific multi-line code by black python formatter. Particularly, this is used for np.array or matrix construction which turned ugly when formatted. Below is the example.
...
Semiotics asked 27/10, 2019 at 23:59
3
Solved
Python formatting guidelines, the famous PEP8 recommends no line longer than 79 chars.
I can easily auto-format my code to a max line length with the Black Formatter, but it does not break long str...
Phenosafranine asked 30/7, 2021 at 20:9
6
I have loaded black and flake8 into a poetry virtual environment. I'd like to change the default line length in black or flake8 so they agree. What is the best way to do this?
Chassis asked 19/3, 2020 at 1:35
7
Solved
I'm trying to use pre-commit to manage Black as a Git pre-commit hook, but I must be doing it wrong.
In my pre-commit config file I have:
- repo: https://github.com/psf/black
rev: 19.3b0
hooks:
...
Moldy asked 15/10, 2019 at 16:24
3
Solved
Running python pre-commit with black latest version 23.11.0 leads to a wired InvalidManifestError.
snippet from .pre-commit-config.yaml
repos:
- repo: https://github.com/psf/black
rev: 23.11.0
ho...
Mote asked 17/11, 2023 at 16:15
5
Solved
I need to indent my python file in VS Code. I followed the normal procedure:
On Windows Shift + Alt + F
On Mac Shift + Option + F
On Linux Ctrl + Shift + I
But my question is every time when I t...
Merrymaking asked 17/6, 2020 at 11:23
4
Solved
Say I want to use black as an API, and do something like:
import black
black.format("some python code")
Formatting code by calling the black binary with Popen is an alternative, but that's not ...
Rang asked 26/8, 2019 at 6:41
3
Solved
I know that for jupyter notebooks and jupyter lab, there are available code formatter extensions such as nb_blackor blackcellmagic. However when I installed them, it doesn't seem to work on google ...
Lucas asked 24/7, 2020 at 14:47
6
Solved
When running our lint checks with the Python Black package, an error comes up:
ImportError: cannot import name '_unicodefun' from 'click' (/Users/robot/.cache/pre-commit/repo3u71ccm2/py_env-python...
Hukill asked 30/3, 2022 at 7:46
2
Solved
When I run GitLab CI on this commit
with this gitlab-ci.yml:
stages:
- format
- test
black_formatting:
image: python:3.6
stage: format
before_script:
# Perform an update to make sure the s...
Siftings asked 3/4, 2022 at 10:5
1
Solved
In VSCode, with Python 3.9 and black==22.6.0, I have a project structure like:
--- root
------src
---------module0.py
---------module1.py
------tests
---------test_folder0
------------test_file0.py...
Barbarbarbara asked 5/8, 2022 at 9:1
3
I am using black==20.8b1.
I have a long string like:
return f"{self.name}, a {adjective.to_name()} {kin_string}{self._type.to_name()} who works for the {target.get_relationship_target_string()...
Argol asked 31/8, 2020 at 3:47
2
I want to configure black in pre-commit and exclude precommit from checking any migrations folder.
My pyproject.toml looks like this
[tool.black]
line-length = 79
target-version = ['py37']
includ...
Noble asked 4/4, 2020 at 17:48
1
Solved
I am running the Black code formatter against a Python script however it doesn't reformat the line length for docstrings. For example, given the following code:
def my_func():
"""
...
Fragrant asked 3/2, 2022 at 5:26
2
Solved
I feel Black is doing something not compliant (with my Organisation), so I am trying to ignore certain rules.
Example below and a related link
PEP 8: whitespace before ':'
My Organisation (Codi...
Applaud asked 12/2, 2020 at 13:25
1
Solved
Based on the poetry docs:
Likewise if you have command line tools such as pytest or black you
can run them using poetry run pytest
The suggested way to use black is:
poetry run black myscript.py
...
Evangelical asked 27/10, 2021 at 12:1
2
I use flake8 for linting and black for formatting.
flake8 produces warnings on execution rules and formatting rules:
I only want to see execution rules. I don't care about formatting rules beca...
Samarium asked 8/12, 2019 at 23:56
2
We are sick of linting. So we want to use black in our project. Unfortunately, it changes almost every other line in our project which would make us loose most of our authorship information. We use...
Rhea asked 11/2, 2019 at 12:18
2
Solved
I like to get inspiration from well designed python projects.
The last one that inspired me was the poetry repository.
I copied a lot from that, but the subject of this post are black and isort.
Bo...
Chanson asked 9/8, 2021 at 12:53
1 Next >
© 2022 - 2024 — McMap. All rights reserved.