Questions tagged [autopep8]

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

99 questions
5
votes
1 answer

vscode python formatting autopep8 disable E266

I'm trying to set Visual Studio Code to format using autopep8 but ignoring E266 (too many leading '#' for block comments) to allow Markdown sub-headings in comments. --ignore setting seems to work for other errors, like E302, but not specifically…
Alex F
  • 756
  • 2
  • 9
  • 24
4
votes
2 answers

Enforce PEP-8 linting and formatting in VS Code (Linux)

I'm under a Linux Mint 20 environment and for Python programming I have been using pyenv, which is the recommended method to install Python under Linux I usually work with VS Code and just recently had the chance to try PyCharm. I was surprised with…
Fabricio
  • 97
  • 2
  • 10
4
votes
1 answer

Visual Studio Code is not recogonizing an Autopep8 installation

I use Visual Studio Code for developing in Django. I did all of the following inside a virtual environment. Whenever I save the Python (.py) files, an alert pops up at the bottom right of the screen telling me: "Formatter autopep8 is not installed.…
Safwan Samsudeen
  • 1,645
  • 1
  • 10
  • 25
4
votes
2 answers

VSCode not autoformatting on save

Vscode is not formatting my code on save. My vscode versions are thus: Vscode 1.37.0 (updated it as part of bug shooting, not sure previous version, but this didn't work either) autopep8 1.4.4 (pycodestyle: 2.5.0) My settings.json look like…
Preston
  • 7,399
  • 8
  • 54
  • 84
4
votes
7 answers

Atom editor : autopep8 is not working and no error message at all

I install autopop8 in Atom. I got NO error message. Console in developer tools is just clean no error or whatsoever. it's just silent and autopep8 is not working (turn on 'format on save' already). At the bottom of the editor , there's small…
andio
  • 1,574
  • 9
  • 26
  • 45
4
votes
0 answers

Indent multi-line strings instead of aligning to end of function name with autopep8

With the following autopep8 command: autopep8 --pep8-passes 2000 --verbose --aggressive --aggressive --ignore=E501,E722 and python code fragment: parser.add_argument('-a', '--auto', help='Activate automatic semi-intelligent inference for…
Jay Taylor
  • 13,185
  • 11
  • 60
  • 85
4
votes
1 answer

autopep8 reformat a region in emacs/spacemacs

I'm a recent convert from vim to emacs (spacemacs). Spacemacs comes with yapf as the standard code reformatter tool for python. I find autopep8 to work better on python code when the code is broken. I can't figure out how to make autopep8…
Meitham
  • 9,178
  • 5
  • 34
  • 45
3
votes
3 answers

Run autopep8 on all python files except migrations doable?

Am wondering is there a way to run autopep8 command on all python files exept the migrations? To fix all pep8 errors. Instead of doing the command autopep8 --in-place --aggressive --aggressive
tobias
  • 69
  • 7
3
votes
0 answers

autopep8 does not fix any indentation

I have a file test.py with the following code class MyClass(): y = 2 def my_func(self): x = 2 return(x) When I run pycodestyle test.py I get test.py:2:1: E112 expected an indented block test.py:2:1: E305 expected 2 blank lines after class or…
Jonathan
  • 1,287
  • 14
  • 17
2
votes
0 answers

Python File not formating in VSCode due to it being skipped by formatter

I am currently working on a python program and am having trouble having VSCode format the python file. As it stands I have a python virtual environment D:/[environment name] and dirrectly within that folder I am storing python files containing code.…
2
votes
1 answer

Why autopep8 don't format on save?

Autopep8 don't working at all. Here's my setting: { "editor.defaultFormatter": "ms-python.autopep8", "editor.formatOnSave": true, "editor.formatOnPaste": true, "editor.formatOnType": true, "autopep8.showNotifications":…
John Doe
  • 95
  • 6
2
votes
0 answers

Autopep8 = Insert whitespace automatically around the "=" in a keyword argument?

I want to automatically insert white space around '=' in a keyword argument, eg. through a config option in "python.formatting.autopep8Args": [......] in settings.json. The goal is to automatically fix the E225:missing whitespace around…
Ajay
  • 61
  • 6
2
votes
1 answer

How to run *BOTH* black and autopep8 *AUTOMATICALLY* upon saving a Python file in Visual Studio Code?

Under the settings.json file in VS Code, I've got black set as the Python formatter: "python.formatting.provider": "black", "python.linting.enabled": true, "python.linting.pylintEnabled": true, "python.linting.mypyEnabled":…
2
votes
1 answer

Autopep8 format "max-line-length" parameter is not working for the imports section

I'm using autopep8 auto-formatter in VSCode (MacOs) but I can't seem to make it work to split lines greater than max-line-length in the imports section. In the rest of the code file, it works well, but not in the imports section. These are my…
MrT77
  • 811
  • 6
  • 25
2
votes
1 answer

Python code style: is there a way to configure linters to split parameters into multiple lines?

Currently I am working on a Python 3.8 project with Django 3.1.4 where I would like the code style to be enforced in the following manner: Split iterables into multiple lines, keeping brackets in separate lines from their contents. For…