Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elpy-black-fix-code does not use the pytoml config file located in the same folder #2027

Open
okankoc opened this issue Aug 10, 2023 · 0 comments

Comments

@okankoc
Copy link

okankoc commented Aug 10, 2023

Summary

First of all thanks so much for creating and supporting elpy! I use it for many years, and it's beautiful!
As a small issue, I have seen that elpy-black-fix-code does not use the pytoml config file located in the same folder
when it formats a code after autosave. (In particular the line length limit defined there is not respected).

Running black . in the terminal works just fine and uses the config file.

Steps to reproduce

  • Download black in mac
  • Add the snippet in init.el for elpy-black-fix-code (pasted below)
  • Save a python file

My configuration

I'm using macOS 13.4.1, emacs 28.2, black 23.7.0

Result of (elpy-config)

Elpy Configuration

Emacs.............: 28.2
Elpy..............: 1.35.0
Virtualenv........: None
Interactive Python: ipython 8.14.0 (/opt/homebrew/bin/ipython)
RPC virtualenv....: rpc-venv (/Users/okankoc/.emacs.d/elpy/rpc-venv)
 Python...........: python3 3.9.6 (/Users/okankoc/.emacs.d/elpy/rpc-venv/bin/python3)
 Jedi.............: 0.19.0
 Autopep8.........: 2.0.2
 Yapf.............: 0.40.1
 Black............: 23.7.0
Syntax checker....: black (/opt/homebrew/bin/black)

Elpy configuration in my init.el

Elpy related config in my init file:

(elpy-enable)
(custom-set-variables
 '(elpy-syntax-check-command "/opt/homebrew/bin/black"))
(add-hook 'elpy-mode-hook (lambda ()
                             (add-hook 'before-save-hook
                                       'elpy-black-fix-code nil t)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant