An IPython magic extension for printing date and time stamps, version numbers, and hardware information
An IPython magic extension for printing date and time stamps, version numbers, and hardware information.
More examples can be found in this Jupyter notebook.
The watermark line magic can be installed by executing
pip install watermark
Alternatively, you can install the latest development version directly from GitHub via
pip install -e git+https://github.com/rasbt/watermark#egg=watermark
To remove an old
watermarkinstallation (installed via the deprecated
%install_extmagic extension), simply delete it from the
.ipython/extensions/directory, which is typically located in a user's home directory.
After successful installation, the
watermarkmagic extension can be loaded via:
To get an overview of all available commands, type:
%watermark [-a AUTHOR] [-d] [-n] [-t] [-i] [-z] [-u] [-c CUSTOM_TIME] [-v] [-p PACKAGES] [-h] [-m] [-g] [-w]
IPython magic function to print date/time stamps and various system information.
optional arguments: -a AUTHOR, --author AUTHOR prints author name -d, --date prints current date as YYYY-mm-dd -n, --datename prints date with abbrv. day and month names -t, --time prints current time as HH-MM-SS -i, --iso8601 prints the combined date and time including the time zone in the ISO 8601 standard with UTC offset -z, --timezone appends the local time zone -u, --updated appends a string "Last updated: " -c CUSTOM_TIME, --custom_time CUSTOM_TIME prints a valid strftime() string -v, --python prints Python and IPython version -p PACKAGES, --packages PACKAGES prints versions of specified Python modules and packages -h, --hostname prints the host name -m, --machine prints system and machine info -g, --githash prints current Git commit hash -r, --gitrepo prints current Git remote address -b, --gitbranch prints the current Git branch (new in v1.6) -iv, --iversion print name and version of all imported packages -w, --watermark prints the current version of watermark
In line with NEP 29, this project supports:
watermark()function now also works outside IPython and Jupyter. Now, the magic
%watermarkvia IPython and Juypter still works as usual. However, in addition the
watermark()function can be used within regular Python for unit testing purposes etc. (#46, via contribution by Tymoteusz Wołodźko)
VERSIONattributes, in addition to
pkg_resourcesas the default method for getting version numbers.
--iversionis used, print an empty string instead of raising an error.
--iversionflag is used.
--iversionflag now also shows package versions that were imported as
from X import Yand
import X.Y as Y. For example,
import scipy as sp from sklearn import metrics import numpy.linalg as linalg
scipy 1.1.0 sklearn 0.20.1 numpy 1.15.4
(Via contribution by James Myatt)
--gitbranchparameter that prints the current Git branch.
--iversionsparameter that prints the package names and version numbers of all packages that were previously imported in the current Python session. (Via contribution by Aziz Alto)
--gitrepoparameter that returns the URL of Git remote name "origin". (Via contribution by Lucy Park)
-p scikit-learnin addition of
-p sklearn(the former is deprecated and will not be supported in watermark > 1.7).
--iso8601parameter that returns the current date-time string in ISO 8601 format with offset to UTC. For instance:
2016-08-16T18:03:42-04:00. Current caveat: Python < 3.2 requires external libraries for for computing the timezone offset, thus, Python < 3.2 will currently only print
pip(Via contribution by Peter Bull)
--dateto MM/DD/YYYY, the format DD/MM/YYYY can be used via the shortcut
--watermarkcommand added to print the current version of watermark.
-nflag is used.