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
# There are automated tools which enforce coding conventions and check for common mistakes.
221
222
#
222
-
# These are called **linters**. A popular one is [pycodestyle](https://pypi.org/project/pycodestyle/):
223
-
#
224
-
# E.g. `pip install pycodestyle`
225
-
#
226
-
#
227
-
#
223
+
# These are called ** formatters** and **linters**. Some widely used linters and formatters in the Python ecosystem ar -
224
+
# - [pycodestyle](https://pypi.org/project/pycodestyle/): check your code against PEP8
225
+
# - [pylint](https://www.pylint.org/): useful information about the quality of your code
226
+
# - [black](https://github.com/psf/black): code formatter written in Python
227
+
# - [ruff](https://github.com/astral-sh/ruff): blazing fast code formatter and linter written in Rust with ideas borrowed from Pythonic linters and formatters
# and with [black](https://black.readthedocs.io/) you can fix all the errors at once.
252
-
# ```bash
253
-
# black species.py
254
-
# ```
255
244
# These linters can be configured to choose which points to flag and which to ignore.
256
245
#
257
246
# Do not blindly believe all these automated tools! Style guides are **guides** not **rules**.
258
247
259
248
# %% [markdown]
260
-
# Finally, there are tools like [editorconfig](https://editorconfig.org/) to help sharing the conventions used within a project, where each contributor uses different IDEs and tools. There are also bots like [pep8speaks](https://pep8speaks.com/) that comments on contributors' pull requests suggesting what to change to follow the conventions for the project.
249
+
#
250
+
# It is a good idea to run a linter before every commit, or include it in your CI tests.
251
+
#
252
+
# [`pre-commit`](https://pre-commit.com) allows developers to add tools like linters and formatters
253
+
# as git hooks, such that they run before every commit. The hooks can be installed locally using -
254
+
#
255
+
# ```bash
256
+
# pip install pre-commit
257
+
# pre-commit install # provided a .pre-commit-config.yaml is present in your repository
258
+
# ```
259
+
#
260
+
# This would run the checks every time a commit is created locally. The checks will only run on the files
261
+
# modified by that commit.
262
+
263
+
264
+
# %% [markdown]
265
+
# Finally, there are tools like [editorconfig](https://editorconfig.org/) to help sharing the conventions used within a project, where each contributor uses different IDEs and tools.
266
+
# There are also bots like [pep8speaks](https://pep8speaks.com/) and [pre-commit.ci](https://pre-commit.ci) that comments/run checks on contributors' pull requests suggesting what to change to follow the conventions for the project.
0 commit comments