DiamondLightSource / python-copier-template

Replacing Diamond Light Source's python3-pip-skeleton using Copier
Apache License 2.0
4 stars 2 forks source link

Ruff errors in `.github/pages/make_switcher.py` #139

Closed GDYendell closed 3 months ago

GDYendell commented 4 months ago

I have just adopted the template into FastCS and on running tox, ruff produced errors:

lint with ruff...........................................................Failed
- hook id: ruff
- exit code: 1

.github/pages/make_switcher.py:6:1: UP035 `typing.List` is deprecated, use `list` instead
.github/pages/make_switcher.py:9:49: UP006 [*] Use `list` instead of `List` for type annotation
.github/pages/make_switcher.py:15:38: UP006 [*] Use `list` instead of `List` for type annotation
.github/pages/make_switcher.py:21:31: UP006 [*] Use `list` instead of `List` for type annotation
.github/pages/make_switcher.py:27:33: UP007 [*] Use `X | Y` for type annotations
.github/pages/make_switcher.py:27:51: UP006 [*] Use `list` instead of `List` for type annotation
.github/pages/make_switcher.py:44:15: UP006 [*] Use `list` instead of `List` for type annotation

but neither the template project itself or the example seem to have the same problem. And ruff --fix and ruff format on the file don't change anything.

I am pretty sure these are issues that should be fixed and I can make a PR for it, but I am confused what the difference is here.

coretl commented 3 months ago

The UP errors are for old python syntax that has a better modern equivalent. It uses the minimum python from pyproject.toml to work this out. You can also set the minimum python separately in [tool.ruff] to silence these until copier ditches older pythons following the numpy python deprecation scheme...

coretl commented 3 months ago

https://docs.astral.sh/ruff/settings/#target-version

GDYendell commented 3 months ago

Ahh OK, I did change the minimum version.