Skip to content

Commit

Permalink
Documentation for init-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
JessJohn0 committed Dec 5, 2024
1 parent a4e91d7 commit 7a1ba85
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions doc/user_guide/configuration/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ configuration overrides. For all other options, Pylint will use its default valu
was used to generate the file. Most notably ``py-version`` which defaults to the
current interpreter.

``--init-hook``
===================

Allows the user to include Python code that runs before Pylint executes.

For example, the user's configuration file ``(~/.pylintrc)`` can be edited to
append alternative ``site-packages`` paths to ``sys.path``.

View the ``sys.path`` Pylint will use when it executes::

pylint --init-hook="import sys; print(sys.path)"

Append directories to ``sys.path`` via ``(~/.pylintrc)`` modification::

[MAIN]
init-hook='import sys; sys.path.append("/path/to/my/site-packages/")'

.. toctree::
:maxdepth: 2
:titlesonly:
Expand Down

0 comments on commit 7a1ba85

Please sign in to comment.