Elpy: Autopep8 - Don't replace Tabs with spaces

Created on 6 Oct 2015  Â·  6Comments  Â·  Source: jorgenschaefer/elpy

Hi,
Is there a way to keep the tabs when using C-c C-r p (elpy-autopep8-fix-code). My company standard is tabs over spaces but pep8 everything else.
I tried configuring autopep8 using the .config/pep8 also modifying auto_pep8.py but to not avail. Any hints?

Bug More Info Needed

All 6 comments

Hello, and thanks for the report!

This seems like the same issue as #671 – apparently, Elpy's autopep8 feature does not read configuration options.

@ChillarAnand, any idea about this? Can we make the autopep8 code read the same configuration options as the command line tool?

If we pass --ignore=W191,E101,E111 to autopep8, it wont mess with tabs & spaces.

Yes we can make it

>>> autopep8.fix_code('print( 123 )\n',
...                   options={'ignore': ['E']})
'print( 123 )\n'

But I guess, elpy has to find setup.cfg & parse it.

Or we can run autopep8 via shell command which automatically picks up config?

A quick look at the code says that fix_code also takes a apply_config keyword argument that defaults to False – does it do the right thing if this is True?

:+1: yes, setting it to True reads config.

PR merged, thank you!

@mfcabrera, can you check with the current git master whether this solves your problem?

Lacking updates, I assume this was fixed indeed. Thanks again to everyone for the report and the quick fix!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

twangnh picture twangnh  Â·  6Comments

mikeiwi picture mikeiwi  Â·  5Comments

dschrempf picture dschrempf  Â·  6Comments

rakanalh picture rakanalh  Â·  5Comments

IvanMalison picture IvanMalison  Â·  6Comments