Questions tagged [autopep8]

autopep8 automatically formats Python code to conform to the PEP 8 style guide.

99 questions
1
vote
0 answers

Autopep8 and pre-commit not honoring --global-config

I'm trying to use pre-commit with autopep8 running the command pre-commit run --all-files. My tree and files are as follows: . ├── project │   ├── ... ├── docs │   ├── ... │   └── conf.py ├── .flake8 ├── .pre-commit-config.yaml ├── setup.cfg ├──…
ZaxR
  • 4,896
  • 4
  • 23
  • 42
1
vote
2 answers

vscode autopep8 don't run

I just ran autopep8 in vscode, system reports two errors: Error: Command failed: autopep8 c:\Users\Administrator\Desktop\Python\从入门到实践\have a try\5-10.py usage: autopep8 [-h] [--version] [-v] [-d] [-i] [--global-config filename]…
midas
  • 11
  • 1
  • 2
1
vote
1 answer

how to use autoPep8 extension with ipython notebook

I'm new to python extensions and after installing autopep8 and ran: jupyter nbextension enable jupyter-autopep8-master/jupyter-autopep8 It returned: Enabling notebook extension jupyter-autopep8-master/jupyter-autopep8... - Validating:…
santoku
  • 3,297
  • 7
  • 48
  • 76
1
vote
0 answers

Is it possible to customise autopep8 formatting?

For example, dictionaries are currently formatted from this: return { 'v2': {'type': 'some_type', 'path_definitions': path.to.some.Module}, 'raw': {'type': 'raw'}, } to this: return { 'v2: { 'type': 'some_type', …
Georgi
  • 11
  • 2
1
vote
1 answer

PEP8 E203 error occurs in list slice

buffer[start_index : start_index + nbytes] path[1 + path.rfind('#') :] In this case, an error occurs in pep8 library But, In PEP8 Documentation ( https://www.python.org/dev/peps/pep-0008/#other-recommendations ) Yes: > ham[1:9], ham[1:9:3],…
DW Ahn
  • 141
  • 2
  • 10
1
vote
1 answer

Using AutoPep8 in pydev

I'm trying to use autopep8.py as the code formatter for pydev but I don't seem to be able to supply the parameters correctly as the output isn't as I would expect. I need to be able to supply two parameters -a --max-line-length 100 but for some…
Richard B
  • 895
  • 13
  • 39
1
vote
1 answer

autopep8 error --indent-size

Recently installed atom-beautify package in Atom. I'm using Linux as OS. i've installed the missing autopep8 python package and i'm still getting this unexpected error. autopep8: error: no such option: --indent-size Anyone knows why? Below is the…
Rambou
  • 968
  • 9
  • 22
1
vote
1 answer

pep8, autopep8 and imports at the end of file

I'm using Eclipse with plugged autopep8 and I found it it very helpful. It's saving a lot of my time from fixing code style by hands. But for some coding patterns I don't know how to avoid pep8 rules I don't want to use. For example using Django…
ramusus
  • 7,789
  • 5
  • 38
  • 45
0
votes
0 answers

Can't lint python files with autopep8

I have the following error Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/bin/autopep8", line 8, in sys.exit(main()) ^^^^^^ File…
Andrei Lupuleasa
  • 2,677
  • 3
  • 14
  • 32
0
votes
1 answer

ValueError when running autopep8

I'm trying to run autopep8 recursively in a directory named "tests" with following command: autopep8 --in-place --recursive tests But I'm facing an odd error when running the command: .pyenv/versions/3.11.4/lib/python3.11/configparser.py", line…
Andressa Cabistani
  • 463
  • 1
  • 5
  • 14
0
votes
0 answers

jupyterlab_code_formatter: multi-line list in code, specify items/characters per line?

jupyterlab_code_formatter installed for Jupyter lab Black, isort, YAPF, Autopep8 added for jupyterlab_code_formatter Question: which config should I twist if I want the auto-formatted list to not be one item per line. # what it is doing now…
0
votes
0 answers

how to ignore the assignment intendation in any python formatter (black, yapf, autopep8)

i would like my code to look like following: short = value long_name = value very_long_name = value instead all python formatter give the following result: short = value long_name = value very_long_name = value the latter is harder…
0
votes
0 answers

Is it possible to have the values in default tuple/list parameters at same line, but have every parameter at newline?

I have an autogenerated file on which I run: autopep8 --in-place --aggressive --aggressive The problem is that for default tuples, they are separated to multiple lines, and I want each tuple on their own line. For instance: def function( …
Sombrero
  • 25
  • 5
0
votes
2 answers

How can I format my Python code with autopep8 using VS Code's format on save feature?

I am trying to format my Python code automatically using the format on save feature in vs Code. I have installed the autopep8 package and added the following configuration to my pyproject.toml file: [tool.autopep8] in-place = true aggressive =…
Davood
  • 353
  • 4
  • 14
0
votes
0 answers

How to instruct autopep8 to remove line breaks?

How to instruct autopep8 python formatter to remove line breaks if the resulting line after removing the line breaks does not exceed the maximum allowed line length? For example, I have the following code that was previously formatted with…
g00dds
  • 195
  • 8