IPython magic extension for printing date/time stamps, version numbers, and hardware information.
npx @tessl/cli install tessl/pypi-watermark@2.5.0An IPython magic extension that provides comprehensive system information, timestamps, and version tracking capabilities for reproducible research and development workflows. Watermark enables developers to generate detailed watermarks containing date/time stamps, version numbers, and hardware information through both magic commands and programmatic function calls.
pip install watermarkpip install "watermark[gpu]"import watermark
from watermark import watermarkFor IPython magic functionality:
%load_ext watermarkLoad the extension and use the magic command:
%load_ext watermark
# Default output with timestamp, Python version, and system info
%watermark
# Show specific information
%watermark -v -m -p numpy,pandas
%watermark -a "Author Name" -d -t
%watermark -iv # Show all imported package versionsUse watermark as a regular Python function:
from watermark import watermark
# Default output
print(watermark())
# Specific information
print(watermark(python=True, machine=True, packages="numpy,pandas"))
print(watermark(author="Author Name", current_date=True, current_time=True))
# Get imported package versions (requires globals)
print(watermark(iversions=True, globals_=globals()))Watermark provides two primary interfaces:
%watermark) for interactive notebook and IPython session usagewatermark()) for programmatic access and script integrationBoth interfaces share the same underlying functionality but use different parameter formats (CLI-style flags vs keyword arguments).
The main watermark functionality that generates formatted output containing system information, timestamps, and version data based on specified parameters.
def watermark(
author=None,
email=None,
github_username=None,
website=None,
current_date=False,
datename=False,
current_time=False,
iso8601=False,
timezone=False,
updated=False,
custom_time=None,
python=False,
packages=None,
conda=False,
hostname=False,
machine=False,
githash=False,
gitrepo=False,
gitbranch=False,
watermark=False,
iversions=False,
gpu=False,
watermark_self=None,
globals_=None
): ...IPython magic command interface providing the same functionality through command-line style arguments for interactive usage in notebooks and IPython sessions.
class WaterMark(Magics):
def watermark(self, line): ...
def load_ipython_extension(ipython): ...class PackageNotFoundError(Exception):
"""Custom exception for package not found scenarios."""
pass