conda / conda-lock

Lightweight lockfile for conda environments
https://conda.github.io/conda-lock/
Other
492 stars 103 forks source link

Update+apply pre-commit, prepare for pre-commit.ci, add badge #327

Closed dbast closed 1 year ago

dbast commented 1 year ago

Description

Update+apply pre-commit hooks (isort requires an update to work again).

This also prepares for the usage of pre-commit.ci:

I am (as member of the @conda/infrastucture team) happy to enable pre-commit.ci for this repo, if the @conda/conda-lock agrees to the idea of using pre-commit.ci. That said, I am also fine with descoping the PR to updates only and sticking to GH Actions.

dbast commented 1 year ago

Ok. Going to enable pre-commit.ci for the repo (and changing the required status checks) ... and close / re-open the PR should then show that it works.

dbast commented 1 year ago

Had to fix the error:

tests/conftest.py: error: Source file found twice under different module names: "conftest" and "tests.conftest"
tests/conftest.py: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules for more info
tests/conftest.py: note: Common resolutions include: a) adding `__init__.py` somewhere, b) using `--explicit-package-bases` or adjusting MYPYPATH
Found 1 error in 1 file (errors prevented further checking)

Added a __init__.py to the tests folder ... this seems to have triggered mypy to scan files it previously didn't scan, due to pre-commit being configured to only scan changed files... so I had to exclude tests/test_conda_lock.py from mypy as currently 73 errors.

see also https://github.com/python/mypy/issues/4008

This is now green on pre-commit.ci and locally with pre-commit run --all (which wasn't the case before).

maresb commented 1 year ago

Thanks a lot for this! All green now. I noticed one more local mypy error on my side, corrected in https://github.com/dbast/conda-lock/pull/2

maresb commented 1 year ago

Now that CI has finished, I'll merge it in this branch...

maresb commented 1 year ago

ping @mariusvniekerk