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
The repository has some code style checks in place. This will happen on every commit of a pull request. If you want to run the checks locally, you can do so by running the following command from the root of the repository:
44
54
45
-
0. Create a virtual environment (optional, but strongly recommended)
46
-
47
55
1. Install pre-commit
48
56
49
57
```bash
@@ -70,13 +78,57 @@ pre-commit run --all-files
70
78
71
79
**Once you commit something the pre-commit hook will run all the checks**!
72
80
81
+
In particular, if the commited changed have linting errors, the commit will try to fix them. If successful,you need to add the changes again (for example, `git add -u`) and commit again. If not successful, you need to fix the errors manually and commit again.
82
+
73
83
You can skip this (for example when is WIP) by adding a flag (`-n` means no-verify)
74
84
75
85
```bash
76
86
git commit -m"my message" -n
77
87
```
78
88
79
-
**Remark:** One can, of course, install `ruff` in the Python environment to enable auto-format (for example in VS Code), but this is not strictly necessary. The specific versions of` ruff` and `mypy` must be only specified in `.pre-commit-config.yaml`. It should be the only source of truth! Hence, if you want to install them locally make sure you use the same versions (revisions `rev` in the config file) as in the config file.
89
+
### Pre-Commit Components
90
+
91
+
One can, of course, install `ruff` in the Python environment to enable auto-format (for example in VS Code), but this is not strictly necessary. The specific versions of` ruff` and `mypy` must be only specified in [`.pre-commit-config.yaml`](.pre-commit-config.yaml). It should be the only source of truth! Hence, if you want to install them locally make sure you use the same versions (revisions `rev` in the config file) as in the config file.
92
+
93
+
#### Ruff
94
+
95
+
Once installed locally as
96
+
97
+
```
98
+
pip install ruff==<VERSION>
99
+
```
100
+
101
+
You can check the lint as
102
+
103
+
```bash
104
+
ruff . --no-fix
105
+
```
106
+
107
+
You can allow `ruff` to fix the code by using the flag:
108
+
109
+
```bash
110
+
ruff . --fix
111
+
```
112
+
113
+
#### MyPy
114
+
115
+
We use `mypy` to check the type annotations. Once installed locally as
116
+
117
+
```bash
118
+
pip install mypy==<VERSION>
119
+
```
120
+
121
+
You also need the `pandas-stubs` library with the version specified in the [`.pre-commit-config.yaml`](.pre-commit-config.yaml) file.
122
+
123
+
```bash
124
+
pip install pandas-stubs==<VERSION>
125
+
```
126
+
127
+
Now, you can check the type annotations as
128
+
129
+
```bash
130
+
mypy pymc_bart/.
131
+
```
80
132
81
133
### Adding new features
82
134
If you are interested in adding a new feature to pymc_bart,
0 commit comments