Skip to content

Commit 2dc0009

Browse files
michaelosthegetwiecki
authored andcommitted
Add troubleshooting tips on pre-commit
1 parent 48eff60 commit 2dc0009

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

docs/source/contributing/python_style.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,31 @@ or, if you just want to manually run them on a subset of files,
4747
```bash
4848
pre-commit run --files <file_1> <file_2> ... <file_n>
4949
```
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]`.

docs/source/contributing/review_pr_pymc_examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The most important guideline is the following: **When you aren't _completely_
1414
sure about something communicate it, ask around and (re)read the documentation**.
1515
:::
1616

17-
pymc-examples is a huge collection of notebooks, covering many fields
17+
[pymc-examples](https://github.com/pymc-devs/pymc-examples/) is a huge collection of notebooks, covering many fields
1818
and applications of PyMC and Bayesian statistics. In addition,
1919
its HTML generation infrastructure has been improved by specialized
2020
people who were also paid so they could dedicate themselves to this task.

0 commit comments

Comments
 (0)