pylabrobot icon indicating copy to clipboard operation
pylabrobot copied to clipboard

Issues with pre-commit hooks on Windows

Open jrast opened this issue 1 year ago • 7 comments

The pre-commit hooks added in 283eb40 rely on make being available, which is mostly not the case on windows. However, the makefile simply calls ruff which can be done in pre-commit directly: https://github.com/astral-sh/ruff-pre-commit

Also I don't recommed to run the tests on each commit:

  • They take far to long for a commit (hang on windows)
  • Prevent to work on a PR which still has some issues.
  • Maybe there is a pre-commit option to only run the tests on the main branch?

Tests should be run manually and in CI to prevent merges with broken tests.

Typechecking seems to run fast but falls into a simmilar category as tests.

jrast avatar Nov 15 '24 08:11 jrast

However, it would make sense to run ruff check --select I --fix (sort imports, see https://docs.astral.sh/ruff/formatter/#sorting-imports) and ruff format to automatically apply a coding guidline and prevent whitespace or reordering changes in commits.

jrast avatar Nov 15 '24 09:11 jrast

fixed with https://github.com/PyLabRobot/pylabrobot/commit/26664f90b85cb669029164447d81f6e9cd754aa9

using another external repo just to run ruff in pre-commit seemed excessive, so i just use the cli, hope that works

rickwierenga avatar Nov 15 '24 22:11 rickwierenga

When using pre-commit, using the external repos is recommeded as the version of the hook is fixed. The hook environment is automatically shared between different projects (if the same version is used), making the overhead negible. Also the tool is only run on the files which where actually affected by the commit.

jrast avatar Nov 18 '24 08:11 jrast

But other than this, the pre-commit hooks now run under windows. 👍

jrast avatar Nov 18 '24 08:11 jrast

BTW: I still think that typechecking should not be done during pre-commit. It makes development cumbersome as the typing needs to be correct for every commit. For the moment I removed type checking from the config.

jrast avatar Nov 18 '24 09:11 jrast

opened a new branch for you to evaluate changes before merging https://github.com/PyLabRobot/pylabrobot/pull/310

rickwierenga avatar Nov 19 '24 01:11 rickwierenga

commits were getting piled up on main so let's just get it as good as we can in 310 and then merge

rickwierenga avatar Nov 19 '24 01:11 rickwierenga

i think this is resolved. please open a new issue if it appears again.

rickwierenga avatar May 28 '25 21:05 rickwierenga