py-autopep8.el
py-autopep8.el copied to clipboard
setup.cfg ignored
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).
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.
The same here, I had to disable py-autopep8 :/ Any work around for this issue?
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
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.