Add lint workflow
Closes #600
This PR adds:
Package Manager
https://docs.astral.sh/uv/
Tool to manage project dependencies, with support for pyproject.toml (https://peps.python.org/pep-0621/)
Mypy
https://github.com/python/mypy Static type checker
Ruff
https://docs.astral.sh/ruff/ Linter and formatter
workflows/lint.yaml uses python 3.12, I don't think this should be an issue as long as target versions are configured properly for ruff and mypy.
Latest versions of mypy and ruff only support python 3.8 and 3.7 respectively 🤔
Latest versions of mypy and ruff only support python 3.8 and 3.7 respectively 🤔
Comparing to novnc compatibility you mean ?
What versions of Python does Ruff support? Ruff can lint code for any Python version from 3.7 onwards, including Python 3.13. [...] Ruff is installable under any Python version from 3.7 onwards.
And for mypy it seems to be : Requires: Python >=3.9
https://pypi.org/project/mypy/
Comparing to novnc compatibility you mean ?
Yes, currently latest release of websockify on pypi states it's compatible with 3.4 and on master branch it's 3.6.
As for mypy - it's possible to use slightly older version, I think that's already handled in uv.lock:
[package.dev-dependencies]
dev = [
{ name = "mypy", version = "0.971", ..., marker = "python_full_version < '3.7'" },
{ name = "mypy", version = "1.4.1", ..., marker = "python_full_version == '3.7.*'" },
{ name = "mypy", version = "1.14.1", ..., marker = "python_full_version == '3.8.*'" },
{ name = "mypy", version = "1.15.0", ..., marker = "python_full_version >= '3.9'" },
]
only quite early version of ruff (0.0.17) supports 3.6 though
Also it seems like only ~3% of downloads are for python 3.6 and 3.7 https://pypistats.org/packages/websockify
@ThinLinc-Zeijlon Sorry to ping you, but I'm not quite sure who maintains the repository right now, but I see that the last commit/release was made by you.
Would you have a bit of time to glance over this PR? Last commit (the one that runs ruff format) can probably be rolled back to reduce review time, and one of the maintainers could run it locally.
@ThirVondukr, Thank you for your patience, I'll take a look at your changes :slightly_smiling_face:
@CendioOssman and @samhed, what are your thoughts on adding ruff as a linter for us?
I'd prefer something more traditional, like flake8. It'll be more generally available and familiar to people.
@CendioOssman ruff should include majority of rules from flake8 and it's plugins, you can toggle the rules that you think would be useful: https://docs.astral.sh/ruff/rules/