Ruff as linter, pyproject.toml for setuptools, uv.lock
This PR does four things.
- Use Ruff instead of Pylint and configure it in pyproject.toml
- Configure setuptools with pyproject.toml
- Defines dependencies in pyproject.toml in a standards compliant manner (but with
uvin mind) - Adds a
uv.lockfile
Ideally a PR should only do one thing. I can break that out into multiple PRs or undo some of this if you want.
My motivation for Ruff is speed. I kept making changes and having to wait a few seconds for the red squiggles in VSCode to disappear (or appear) with pylint.
I tried to keep the rules the same, but I wasn't entirely successful at that, so there's a few linter fixes in here too.
(Ruff can also act as a formatter, but I didn't enable or configure that.)
For setuptools, I don't recall why I started doing that. I think I was just reading about how build backends work and thought it would be nice to use the newer way of configuring it.
For uv, I was already using uv as pip replacement, and thought it would be cleaner to use it in project mode. Besides the lock file (which isn't strictly required), I didn't end up using any uv specific configuration, so it ought to work with poetry too, though I didn't test that.
I switched around how version_tuple and __version__ were defined. That was because setuptools has to import the module, which requires all of it's dependencies to be installed at build time, if it's defined how it was. But if __version__ is a literal, it doesn't need to do that, and my understanding is that is preferred.
- Only tested locally, so the github workflow change is untested, and I also didn't test publishing, but the setuptools config changes might have accidentally messed with that
- I wasn't sure how to set up extras. I went with one extra per each cryptolib. There didn't seem to be a way to specify "at least one of these is required" though, so it's a little awkward
- In pyproject.toml, authors is a list, wasn't sure if anyone else should be added or not.
- If you use
uv, you have touv sync --extra cryptographyor one of the other extras, if you want the project to actually run
I set the minimum Python version to 3.8, because that's what I saw in pylint.yml, but I see the others go down to 3.6, so perhaps I should change it to that?
Thanks @tringenbach ! I'll take a look...
Use Ruff instead of Pylint and configure it in pyproject.toml
I understand the speed. I'll give it a good test.
@tringenbach Can we break this apart. I would like to cherry pick the Ruff and UV support. A new PR may be easier? We may need to revisit the setuptools later. There are some compatibility issues with some platforms we need to work through before we commit to a switch.