jorgenschaefer/elpy

toml rpv venv dependency is undocumented and causes behaviour change

Closed this issue · 0 comments

Summary

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

  1. Clean out the RPV venv (rm -rf ~/.emacs.d/elpy/rpc-venv
  2. Install black into the fresh venv
  3. Create a pyproject.toml with:
    [tool.black]
    line-length = 50
  4. Run elpy-black-fix-code on some code, see it use the default 88-character limit
  5. Install toml into the venv
  6. Re-run elpy-black-fix-code, and watch the line-lengths change to pick up the 50-character limit