py-autopep8.el icon indicating copy to clipboard operation
py-autopep8.el copied to clipboard

setup.cfg ignored

Open henniss opened this issue 7 years ago • 4 comments

I'd like to be able to disable autopep8 by default, and enable on a per-repository basis.

I have the following:

~/.config/pep8:

[pep8]
select=None

$PROJECT/setup.cfg

[pep8]
select=

When I run autopep8 $PROJECT/bad.py, this behaves as I expect, and bad.py is printed with errors corrected. Furthermore, if I remove setup.cfg, autopep8 will respect the user config and will no longer correct errors.

However, if I open up bad.py with emacs, py-autopep8 reports the buffer as already pep8ified, as if setup.cfg wasn't there. (py-autopep8 works fine if I edit the user config, but that's not the behavior I want).

henniss avatar Aug 08 '17 16:08 henniss

I too am having this issue. It causes conflicts with project-specific pep8 settings, which is inhibitory in some use-cases where you want to enforce formatting settings across all dev environments. I'm going with a git precommit hook for now instead of an emacs plugin.

bsima avatar Aug 11 '17 18:08 bsima

The same here, I had to disable py-autopep8 :/ Any work around for this issue?

piojanu avatar Mar 27 '19 09:03 piojanu

This happened because the temporary file caused the local configuration not to be detected.

Resolved in my repo which used stdin/stdout pipes to format, changing the working directory to that of the file causes the configuration to be loaded properly in my tests https://github.com/ideasman42/emacs-py-autopep8/commit/171a69198e7a379622b84a51239f3e621219f9a0

ideasman42 avatar Apr 24 '22 02:04 ideasman42

Melpa now points to a fork of this package maintained here: https://github.com/ideasman42/emacs-py-autopep8

Detecting local configuration is supported, although I've only added support for pyproject.toml which seems to be the recommended configuration these days. Writing checks for other kinds of files is trivial.

ideasman42 avatar May 03 '22 23:05 ideasman42