You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/contributing/python_style.md
+28Lines changed: 28 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -47,3 +47,31 @@ or, if you just want to manually run them on a subset of files,
47
47
```bash
48
48
pre-commit run --files <file_1><file_2> ... <file_n>
49
49
```
50
+
51
+
## Gotchas & Troubleshooting
52
+
__Pre-commit runs on staged files__
53
+
54
+
If you have some `git` changes staged and other unstaged, the `pre-commit` will only run on the staged files.
55
+
56
+
__Pre-commit repeatedly complains about the same formatting changes__
57
+
58
+
Check the unstaged changes (see previous point).
59
+
60
+
__Whitespace changes in the `environment-dev-*.yml` files__
61
+
62
+
On Windows, there are some bugs in pre-commit hooks that can lead to changes in some environment YAML files.
63
+
Until this is fixed upstream, you should __ignore these changes__.
64
+
To actually make the commit, deactivate the automated `pre-commit` with `pre-commit uninstall` and make sure to run it manually with `pre-commit run --all`.
65
+
66
+
__Failures in the `mypy` step__
67
+
68
+
We are running static type checks with `mypy` to continuously improve the reliability and type safety of the PyMC codebase.
69
+
However, there are many files with unresolved type problems, which is why we are allowing some files to fail the `mypy` check.
70
+
71
+
If you are seeing the `mypy` step complain, chances are that you are in one of the following two situations:
72
+
* 😕 Your changes introduced type problems in a file that was previously free of type problems.
73
+
* 🥳 Your changes fixed type problems.
74
+
75
+
In any case __read the logging output of the `mypy` hook__, because it contains the instructions how to proceed.
76
+
77
+
You can also run the `mypy` check manually with `python scripts/run_mypy.py [--verbose]`.
0 commit comments