jorgenschaefer / elpy

Emacs Python Development Environment
GNU General Public License v3.0
1.89k stars 259 forks source link

autopep8 doesn't find local config #1012

Open Thomasillo opened 7 years ago

Thomasillo commented 7 years ago

Hi, I have a local config file, 'tox.ini' which contains settings for autopep8-ing my code. It is located at the project root. On the command line, running autopep8 ugly_code.py works with the right settings (max-line-length 140 in my case) even using interactive python on the command line import autopep8 autopep8.fix_code(ugly_code, apply_config=True) finds the correct config and formats the code accordingly.

However in elpy, running the command elpy-autopep8-fix-code ignores the local settings in tox.ini It does however find settings in a global settings file ~/.config/pep8. flake8 on the contrast finds and applies settings in the local tox.ini file. Any ideas? Thanks a lot!

ChillarAnand commented 7 years ago

Thanks for detailed bug report.

This was a bug in older version and is fixed in latest version. Can you try upgrading elpy and see if it works?

Thomasillo commented 6 years ago

Hi there, unfortunately this still doesn't work.. I'm on elpy version 1.16.. Any news?

jorgenschaefer commented 6 years ago

Guess we're not passing some argument to the module when it's needed? I don't know, I'm afraid.

Thomasillo commented 6 years ago

Yes, seems so, I tracked down the function in autopep8.py which is responsible for obtaining the configuration (read_config) and saved the arguments (with dill) for its call once when called from command line and once when called from within emacs. However I couldn't spot any difference. (I'd be glad to provide the dilled args somewhere here..)

In the short time I've been spending on the issue, I couldn't grasp completely how this function works. Neither do I know how the mechanism for passing arguments from emacs works. With some hinting on this I could try to spot and fix the issue myself. (A hint on how to attach a pdb to the rpc process and step through the python function call would also greatly be appreciated..)

Thanks anyway.

jorgenschaefer commented 6 years ago

Any help is appreciated, but I am as stumped as you are :-(

mlaves commented 2 years ago

Hi, I have the exact same problem. Running autopep8 ugly_code.py works just fine. However, running it from elpy ignores my settings in setup.cfg.