omnilib / ufmt

Safe, atomic formatting with black and µsort
https://ufmt.omnilib.dev
MIT License
98 stars 11 forks source link

`flit==3.7.0` breaks `pre-commit` hook #56

Closed pmeier closed 2 years ago

pmeier commented 2 years ago

flit==3.7.0 was released ~3 hours ago and with that version, usort errors during installation from source. This happens for example if it is installed through a pre-commit hook. See for example this CI run.

Quick fix would be to pin

https://github.com/omnilib/ufmt/blob/0e05a95cc8700812b15c3eb71fe3f43c36d2806f/pyproject.toml#L2

to

requires = ["flit_core >=3,<3.7"] 
pmeier commented 2 years ago

Digging deeper, this is not a fix. The problem is that flit and flit-core are not in sync. Although we pin

https://github.com/omnilib/ufmt/blob/0e05a95cc8700812b15c3eb71fe3f43c36d2806f/requirements-dev.txt#L5

pip install flit==3.6.0 installs flit-core==3.7.0. Thus, we should add a pin for flit-core==3.6.0 into requirements-dev.txt.

amyreese commented 2 years ago

Turns out, this is actually pypa/flit#530 because µfmt uses a dynamic __version__ imported from a relative module in ufmt.__init__. It looks like there's a fix for this upcoming in flit 3.7.1. I've just updated the PEP518 spec to just disallow 3.7.0, which should be sufficient, and I'll cut a point release for use with pre-commit configs.

amyreese commented 2 years ago

v1.3.2 is released now.