Skip to content

Commit

Permalink
Add clearer note about stub generation importing modules; fixes #57.
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed Jan 19, 2018
1 parent ff1dfc8 commit 178e889
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/generation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ some/module.pyi``).
You can also run e.g. ``monkeytype stub some.module:SomeClass`` or ``monkeytype
stub some.module:somefunc`` to generate a stub for just one class or function.

MonkeyType must import your code in order to generate annotations for it, so if
a module has import side effects, running ``monkeytype stub`` on the module
will trigger those side effects. For "executable" modules, ensure the execution
code is protected with ``if __name__ == '__main__'`` to avoid MonkeyType
triggering it.

.. _monkeytype-apply:

monkeytype apply
Expand Down

0 comments on commit 178e889

Please sign in to comment.