Skip to content

Commit 4283a31

Browse files
committed
📝 Update performance section
* Add Installation and usage of perflint * Add perflint pre-commit hook * Add link to cProfile
1 parent 7a7f3eb commit 4283a31

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ repos:
3737
rev: 25.1.0
3838
hooks:
3939
- id: black
40+
- repo: https://github.com/tonybaloney/perflint
41+
rev: 0.8.1
42+
hooks:
43+
- id: perflint
4044
- repo: https://github.com/adamchainz/blacken-docs
4145
rev: "1.19.1"
4246
hooks:

docs/performance/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ Performance measurements
6262
------------------------
6363

6464
Once you have worked with your code, it can be useful to examine its efficiency
65-
more closely. The :doc:`ipython-profiler` or :doc:`scalene` can be used for
66-
this.
65+
more closely. :mod:`cProfile`, :doc:`ipython-profiler` or :doc:`scalene` can be
66+
used for this.
6767

6868
.. seealso::
6969
* `airspeed velocity (asv) <https://asv.readthedocs.io/en/stable/>`_

docs/performance/perflint.rst

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,49 @@ perflint
66
========
77

88
`perflint <https://github.com/tonybaloney/perflint>`_ is an extension for
9-
`pylint <https://pylint.org/>`_ for performance anti-patterns, among others:
9+
`pylint <https://pylint.org/>`_ for performance anti-patterns.
10+
11+
Installation
12+
------------
13+
14+
.. code-block:: console
15+
16+
$ uv add --dev perflint
17+
18+
Use
19+
---
20+
21+
… as an independent linter
22+
~~~~~~~~~~~~~~~~~~~~~~~~~~
23+
24+
.. code-block:: console
25+
26+
$ uv run perflint src/
27+
28+
… as ``pylint`` plugin
29+
~~~~~~~~~~~~~~~~~~~~~~
30+
31+
.. code-block:: console
32+
33+
$ uv run perflint src/ --load-plugins=perflint
34+
35+
… as pre-commit hook
36+
~~~~~~~~~~~~~~~~~x~~~
37+
38+
perflint can also be used with the
39+
:doc:`/productive/git/advanced/hooks/pre-commit`:
40+
41+
.. code-block:: yaml
42+
:caption: .pre-commit-config.yaml
43+
44+
repos:
45+
- repo: https://github.com/tonybaloney/perflint
46+
rev: 0.8.1
47+
hooks:
48+
- id: perflint
49+
50+
Rules
51+
-----
1052

1153
W8101: ``unnecessary-list-cast``
1254
Unnecessary use of ``list()`` on an already iterable type.

0 commit comments

Comments
 (0)