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: README.md
+11-6Lines changed: 11 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ This repository provides a template for building discrete-event simulation (DES)
55
55
56
56
For clarity, changes from the DES book in this template are explained in `docs/hsma_changes.md`.
57
57
58
-
✨ **Style:** The coding style is based on the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html). Linting is implemented using `flake8` and `pylint` for `.py` files, and `pycodestyle` for `.ipynb` files.
58
+
✨ **Style:** The coding style is based on the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html). Linting is implemented using `pylint` (with `nbqa` to enable it to run on jupyter notebooks).
59
59
60
60
🧱 **Package structure:** In Python, a package can simply be defined as a directory with an `__init__.py` file in it. In this repository, the scripts for model (within `simulation/`) are treated as a little local package. This keeps the code model code isolated from our experiments and analysis. It is installed as an editable (`-e`) local import - with `-e` meaning it will update with changes to the local files in `simulation/`. As it is installed in our environment, it can then easily be used anywhere else in the directory - here, in `notebooks/` and `tests/` - without needing any additional code (e.g. no need to modify `sys.path`, or have additional `__init__.py` files).
61
61
@@ -162,18 +162,22 @@ If you have changed the model behaviour, you may wish to amend, remove or write
162
162
163
163
🔎 **Linting**
164
164
165
-
You can lint the `.py` files by running either of this commands from the terminal:
165
+
You can lint the `.py` files by running:
166
166
167
167
```
168
-
flake8 simulation/model.py
169
168
pylint simulation/model.py
170
169
```
171
170
172
-
The first commands in the `.ipynb`files will lint the notebooks using `pycodestyle` when executed:
171
+
You can lint the `.ipynb`by adding `nbqa` to the start of the command - e.g.:
173
172
174
173
```
175
-
%load_ext pycodestyle_magic
176
-
%pycodestyle_on
174
+
nbqa pylint notebooks/analysis.ipynb
175
+
```
176
+
177
+
A bash script has been provided which can be used to lint all files in succession by running:
0 commit comments