Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

installing spyder_autopep8 on spyder 4 and getting it to work

I'm having trouble installing spyder_autopep8 package/plugin to the newly released spyder 4 and getting it to work.

I've tried the these solutions: How to use autopep8 to format code in Spyder / Anaconda , Spyder plugins (spyder-autopep8)

but they seems to work only in spyder 3.3.X. There are some interesting new linting tools in spyder 4 but i couldn't find a tool that does what spyder_autopep8 do, i.e., formats the code as best it can to PEP8.

This really helps the readability of my code. Maybe Spyder developers can shed light on this matter ?

like image 279
Ziskin_Ziv Avatar asked Jan 26 '20 08:01

Ziskin_Ziv


People also ask

How do you use Spyder autopep8?

Press Shift+F8 (default) to run autopep8 on the current file or go to Source > Run autopep8 code autoformatting. If some text is selected, autopep8 will run on this text only. Informations about the execution will be displayed in the statusbar.

How do I get Spyder to work with my existing Python packages environment?

To work with an existing environment in Spyder, you need to change Spyder's default Python interpreter. To do so, click the name of the current environment in the status bar, and then click Change default environment in Preferences. This will open the Preferences dialog in the Python interpreter section.

How do I install Spyder 4?

After activating your environment, to install Spyder and its other dependencies, run pip install spyder . You may need to install a Qt binding (PyQt5) separately with pip if running under Python 2. To launch Spyder after installing, ensure your environment is activated and run the spyder3 command.


2 Answers

(Spyder maintainer here) That plugin is not maintained anymore and it only works with Spyder 3.3.6.

That's because we added support to format code with Autopep8 and Black in Spyder 4.2.0, released in November 2020.

like image 173
Carlos Cordoba Avatar answered Sep 30 '22 14:09

Carlos Cordoba


According to this issue on github https://github.com/spyder-ide/spyder-autopep8/issues/10 autopep8 is supported since spyder 4.2.0

like image 26
onno Avatar answered Sep 30 '22 14:09

onno