-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shaperilio/autoreload verbosity (#13774)
Worked on three things: 1. More descriptive parameter names for `%autoreload`; `now`, `off`, `explicit`, `all`, `complete`. (This last one could probably use a better name, but I couldn't think of anything better based on the message in 1d3018a) 2. New optional arguments for `%autoreload` allow displaying the names of modules that are reloaded. Use `--print` or `-p` to use `print` statements, or `--log` / `-l` to log at `INFO` level. 3. `%aimport` can parse whitelist/blacklist modules on the same line, e.g. `%aimport os, -math` now works. `%autoreload` and will also now raise a `ValueError` if the parameter is invalid. I suppose a bit more verification could be done for input to `%aimport`....
- Loading branch information
Showing
3 changed files
with
231 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Autoreload verbosity | ||
==================== | ||
|
||
We introduce more descriptive names for the ``%autoreload`` parameter: | ||
|
||
- ``%autoreload now`` (also ``%autoreload``) - perform autoreload immediately. | ||
- ``%autoreload off`` (also ``%autoreload 0``) - turn off autoreload. | ||
- ``%autoreload explicit`` (also ``%autoreload 1``) - turn on autoreload only for modules | ||
whitelisted by ``%aimport`` statements. | ||
- ``%autoreload all`` (also ``%autoreload 2``) - turn on autoreload for all modules except those | ||
blacklisted by ``%aimport`` statements. | ||
- ``%autoreload complete`` (also ``%autoreload 3``) - all the fatures of ``all`` but also adding new | ||
objects from the imported modules (see | ||
IPython/extensions/tests/test_autoreload.py::test_autoload_newly_added_objects). | ||
|
||
The original designations (e.g. "2") still work, and these new ones are case-insensitive. | ||
|
||
Additionally, the option ``--print`` or ``-p`` can be added to the line to print the names of | ||
modules being reloaded. Similarly, ``--log`` or ``-l`` will output the names to the logger at INFO | ||
level. Both can be used simultaneously. | ||
|
||
The parsing logic for ``%aimport`` is now improved such that modules can be whitelisted and | ||
blacklisted in the same line, e.g. it's now possible to call ``%aimport os, -math`` to include | ||
``os`` for ``%autoreload explicit`` and exclude ``math`` for modes ``all`` and ``complete``. | ||
|
||
|