The toml module dependency is used to optionally read the line-length and skip-string-normalization options from pyproject.toml. However, reading and applying those optins is contingent on the toml module being installed into the elpy RPV venv, or they are silently skipped.
This can lead to quite confusing behaviour, where two computers which, to elpy-config, appear to have equivalent configs, will have differing behaviour in the wrapping they create when they run black.
We should either make toml a requirement when installing black, or document that the behaviour of elpy-black-fix-code depends on if toml is installed in the venv.
Steps to reproduce
Clean out the RPV venv (rm -rf ~/.emacs.d/elpy/rpc-venv
Install black into the fresh venv
Create a pyproject.toml with:
[tool.black]
line-length = 50
Run elpy-black-fix-code on some code, see it use the default 88-character limit
Install toml into the venv
Re-run elpy-black-fix-code, and watch the line-lengths change to pick up the 50-character limit
Summary
The
toml
module dependency is used to optionally read theline-length
andskip-string-normalization
options frompyproject.toml
. However, reading and applying those optins is contingent on thetoml
module being installed into theelpy
RPV venv, or they are silently skipped.This can lead to quite confusing behaviour, where two computers which, to
elpy-config
, appear to have equivalent configs, will have differing behaviour in the wrapping they create when they runblack
.We should either make
toml
a requirement when installingblack
, or document that the behaviour ofelpy-black-fix-code
depends on iftoml
is installed in the venv.Steps to reproduce
rm -rf ~/.emacs.d/elpy/rpc-venv
black
into the fresh venvpyproject.toml
with:elpy-black-fix-code
on some code, see it use the default 88-character limittoml
into the venvelpy-black-fix-code
, and watch the line-lengths change to pick up the 50-character limit