3 ms·
I would like to give a strong recommendation for https://pre-commit.ci https://pre-commit.ci (no relation, just a happy user). The idea is that you write hooks
by pxeger1 3y ago
I would like to give a strong recommendation for https://pre-commit.ci https://pre-commit.ci (no relation, just a happy user).
The idea is that you write hooks (or use pre-existing ones) that check (and fix, where possible) your code before you commit, and then once you've pushed, the CI will check again, including automatically committing fixes if necessary.
Anyway, it works brilliantly - unbelievably fast thanks to good automatic caching, and using the exact same setup on your local development machine to in CI negates a lot of these debugging problems. It's free for open source.
It only does checks, not things like automatic releases, but it does those them well.
- globular-toast 3y agoThis combined with tox is great for Python projects in particular. Tox automates creating virtualenvs for the right Python versions you want to test with then running your tests in them. It can also run static checks by issuing `skip_install = True` because you want to test the source code itself. You just need to run this in a Python container that has tox installed as a globally available tool and all versions of Python available in it (like https://github.com/georgek/docker-python-multiversion https://github.com/georgek/docker-python-multiversion <-- not maintained but easy to update). Here's some boilerplate to do all that: [tox] envlist = py{310,311} [testenv] passenv = PIP_CACHE_DIR deps = coverage # deps only for tox extras = testing # testing extras include pytest commands = pytest ... [testenv:check] passenv = PIP_CACHE_DIR PRE_COMMIT_HOME skip_install = True deps = pre-commit commands = pre-commit run --all-files --show-diff-on-failure