python-holidays icon indicating copy to clipboard operation
python-holidays copied to clipboard

Keep context based import sorting for `holidays.constants`.

Open arkid15r opened this issue 2 years ago • 1 comments

Resolves #732

As suggested in the issue above the week day and month constants should be kept in their context order (MON, TUE, WED, ...SUN / JAN, FEB, MAR, ... DEC)

This PR adds no_inline_sort = true to the setup.cfg in order to skip isort inline sorting. It means this kind of imports should be enforced manually on code reviews.

arkid15r avatar Oct 10 '22 16:10 arkid15r

Coverage Status

Coverage decreased (-0.0002%) to 99.564% when pulling 525791f81e1ad0d609668abffb121dfda2df8e5f on arkid15r:setup-isort-skip-constants-reordering into ebbfc394cf05ab99cf8f268a48b8a4cf1d2b56ce on dr-prodigy:beta.

coveralls avatar Oct 10 '22 16:10 coveralls

Hi Ark, good job, thank you! A couple of notes:

  • I would have hoped to see cases like this
from holidays.constants import JAN, APR, MAR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
from holidays.constants import FRI, SAT, SUN, WEEKEND

not converted to this

from holidays.constants import (
    JAN,
    APR,
    MAR,
    MAY,
    JUN,
    JUL,
    AUG,
    SEP,
    OCT,
    NOV,
    DEC,
    FRI,
    SAT,
    SUN,
    WEEKEND,
)

but that's fine as a first solution.

  • I had to accordingly review pyproject.toml as well: don't forget that's the one which is used when running local tests through tox command.

About to merge, thank you again! 👍

dr-prodigy avatar Oct 23 '22 10:10 dr-prodigy