{"id":13557941,"url":"https://github.com/rasbt/watermark","last_synced_at":"2025-04-11T06:22:51.986Z","repository":{"id":19174241,"uuid":"22406576","full_name":"rasbt/watermark","owner":"rasbt","description":"An IPython magic extension for printing date and time stamps, version numbers, and hardware information","archived":false,"fork":false,"pushed_at":"2024-09-22T20:08:50.000Z","size":636,"stargazers_count":920,"open_issues_count":15,"forks_count":91,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-03T07:08:25.358Z","etag":null,"topics":["ipython","jupyter","magic-extension","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rasbt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-07-30T03:46:33.000Z","updated_at":"2025-04-01T02:56:52.000Z","dependencies_parsed_at":"2024-01-17T00:18:10.008Z","dependency_job_id":"7527b127-d1b8-49d3-91df-183273815ef7","html_url":"https://github.com/rasbt/watermark","commit_stats":{"total_commits":102,"total_committers":22,"mean_commits":4.636363636363637,"dds":0.5490196078431373,"last_synced_commit":"2dc6d928f547cf88d941e79229cae3d172eeb054"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasbt%2Fwatermark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasbt%2Fwatermark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasbt%2Fwatermark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasbt%2Fwatermark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rasbt","download_url":"https://codeload.github.com/rasbt/watermark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247502733,"owners_count":20949315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ipython","jupyter","magic-extension","python"],"created_at":"2024-08-01T12:04:38.268Z","updated_at":"2025-04-11T06:22:51.958Z","avatar_url":"https://github.com/rasbt.png","language":"Python","readme":"[![Build status](https://ci.appveyor.com/api/projects/status/2q1iwyc5bbfnqxik?svg=true)](https://ci.appveyor.com/project/rasbt/watermark)\n[![PyPI version](https://badge.fury.io/py/watermark.svg)](http://badge.fury.io/py/watermark)\n![Python 3](https://img.shields.io/badge/python-3-blue.svg)\n![License](https://img.shields.io/badge/license-BSD-blue.svg)\n\n# watermark\n\nAn IPython magic extension for printing date and time stamps, version numbers, and hardware information.\n\u003cbr\u003e\n\n#### Sections\n\n- [Examples](#examples)\n- [Installation and updating](#installation-and-updating)\n- [Usage](#usage)\n- [Development guidelines](#development-guidelines)\n- [Changelog](#changelog)\n\n\u003cbr\u003e\n\n## Examples\n\n[[top](#sections)]\n\n### Using watermark in  Jupyter notebooks and IPython sessions\n\n\n\n\u003cimg src=\"docs/images/ex1.png\" width=700\u003e\n\u003cimg src=\"docs/images/ex2.png\" width=700\u003e\n\n**More examples can be found in this [Jupyter notebook](docs/watermark.ipynb).**\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/rasbt/watermark/master?filepath=docs%2Fwatermark.ipynb)\n\n\u003cbr\u003e\n\n\n### Using watermark as a module\n\n\n```python\nfrom watermark import watermark\nprint(watermark())\n```\n\n```\nLast updated: 2022-09-13T16:28:56.177487-05:00\n\nPython implementation: CPython\nPython version       : 3.9.13\nIPython version      : 8.4.0\n\nCompiler    : Clang 13.0.1\nOS          : Darwin\nRelease     : 21.6.0\nMachine     : arm64\nProcessor   : arm\nCPU cores   : 10\nArchitecture: 64bit\n```\n\n```python\nprint(watermark(packages=\"numpy,scipy\"))\n```\n\n```\nnumpy: 1.23.2\nscipy: 1.9.1\n```\n\n\n\nSee `help(watermark)` for more options.\n\n\n\n## Installation and updating\n\n[[top](#sections)]\n\nThe watermark line magic can be installed by executing\n\n```bash\npip install watermark\n```\n\nAlternatively, you can install the latest development version directly from GitHub via\n\n```bash\npip install -e git+https://github.com/rasbt/watermark#egg=watermark\n```\n\n\u003cbr\u003e\n\nNote:\n\nTo remove an old `watermark` installation (installed via the deprecated `%install_ext` magic extension), simply delete it from the ``.ipython/extensions/`` directory, which is typically located in a user's home directory.\n\n## Usage\n\n[[top](#sections)]\n\nAfter successful installation, the `watermark` magic extension can be loaded via:\n\n```python\n%load_ext watermark\n```\n\n\u003cbr\u003e\n\nTo get an overview of all available commands, type:\n\n```python\n%watermark?\n```\n\n\u003cbr\u003e\n\n```raw\n  %watermark [-a AUTHOR] [-gu GITHUB_USERNAME] [-e EMAIL] [-ws WEBSITE]\n                 [-d] [-n] [-t] [-i] [-z] [-u] [-c CUSTOM_TIME] [-v]\n                 [-p PACKAGES] [-co] [-h] [-m] [-g] [-r] [-b] [-w] [-iv]\n\nIPython magic function to print date/time stamps\nand various system information.\n\noptional arguments:\n  -a AUTHOR, --author AUTHOR\n                        prints author name\n  -gu GITHUB_USERNAME, --github_username GITHUB_USERNAME\n                        prints author github username\n  -e EMAIL, --email EMAIL\n                        prints author email\n  -ws WEBSITE, --website WEBSITE\n                        prints author or project website\n  -d, --date            prints current date as YYYY-mm-dd\n  -n, --datename        prints date with abbrv. day and month names\n  -t, --time            prints current time as HH-MM-SS\n  -i, --iso8601         prints the combined date and time including the time\n                        zone in the ISO 8601 standard with UTC offset\n  -z, --timezone        appends the local time zone\n  -u, --updated         appends a string \"Last updated: \"\n  -c CUSTOM_TIME, --custom_time CUSTOM_TIME\n                        prints a valid strftime() string\n  -v, --python          prints Python and IPython version\n  -p PACKAGES, --packages PACKAGES\n                        prints versions of specified Python modules and\n                        packages\n  -co, --conda          prints name of current conda environment\n  -h, --hostname        prints the host name\n  -m, --machine         prints system and machine info\n  -g, --githash         prints current Git commit hash\n  -r, --gitrepo         prints current Git remote address\n  -b, --gitbranch       prints current Git branch\n  -w, --watermark       prints the current version of watermark\n  -iv, --iversions      prints the name/version of all imported modules\n```\n\n\u003cbr\u003e\n\n## Development guidelines\n\n[[top](#sections)]\n\nIn line with [NEP 29][nep-29], this project supports:\n\n- All minor versions of Python released 42 months prior to the project, and at minimum the two latest minor versions.\n\n[nep-29]: https://numpy.org/neps/nep-0029-deprecation_policy.html\n\n\u003cbr\u003e\n\n## Changelog\n\n[[top](#sections)]\n\n#### v. 2.5.1.dev1 (TBD)\n\n- Extra args to allow printing `-d` (current date) and `-t` (current time) information without needing to use the `-u` (updated) flag.  ([#99](https://github.com/rasbt/watermark/pull/99), via contribution by [Daniel Kleine](https://github.com/d-kleine))\n\n#### v. 2.5.0 (Sep 20, 2024)\n\n- Can now capture imports retrospectively via `-iv` more reliably.  ([#94](https://github.com/rasbt/watermark/pull/94), via contribution by [Martin Perier](https://github.com/martinp7))\n\n For example,\n\n```python\nfrom sympy import solve\n```\n\n```\n%load_ext watermark\n```\n\n```\n%watermark -iv\n```\n\nCorrectly prints `sympy: 1.11.1`\n\n\n\n\n#### v. 2.4.3 (May 23, 2023)\n\n- Make `py3nvml` installation for GPU info optional. ([#92](https://github.com/rasbt/watermark/pull/92), via contribution by [Ben Greiner](https://github.com/bnavigator))\n\n#### v. 2.4.1 and v 2.4.2 (May 23, 2023)\n\n- PyPI and Conda-Forge packaging fixes.\n\n#### v. 2.4.0 (May 23, 2023)\n\n- Adds a new `--gpu` flag to print out GPU information (currently limited to NVIDIA devices) ([#90](https://github.com/rasbt/watermark/pull/90), via contribution by [907Resident](https://github.com/907Resident))\n\n\n#### v. 2.3.1 (May 27, 2022)\n\n- Upper limit on importlib-metadata caused trouble installing on Python 3.7.\n  Instead pin to minimum version with Python 3.8 functionality according to https://github.com/python/importlib_metadata#compatibility  ([#86](https://github.com/rasbt/watermark/pull/86), via contribution by [James Myatt](https://github.com/jamesmyatt))\n\n#### v. 2.3.0 (January 3, 2022)\n\n- Added the following arguments: `--github_username` - for prints author github username, `--email` - for prints author email, `--website` - for prints author or project website. ([#82](https://github.com/rasbt/watermark/pull/82), via contribution by [joschkazj](https://github.com/joschkazj))\n- Added a `--conda` option to print the name of the current conda environment. ([#79](https://github.com/rasbt/watermark/pull/79), via contribution by [Alexander Krasnikov](https://github.com/askras))\n-  It is now possible to inject globals when used outside IPython ([#80](https://github.com/rasbt/watermark/pull/80), via contribution by [\nHugo Lapré](https://github.com/Hugovdberg)). For example, version numbers of imported packages can now be obtained as follows:\n\n```python\nimport numpy\nimport watermark.watermark as watermark\n\n\nwatermark(iversions=True, globals_=globals())\n```\n\n#### v. 2.2.0 (February 17, 2021)\n\n- Refactoring such that a `watermark()` function now also works outside IPython and Jupyter. Now, the magic `%watermark` calls `watermark()`. Calling `%watermark` via 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](https://github.com/rasbt/watermark/pull/46), via contribution by [Tymoteusz Wołodźko](https://github.com/twolodzko))\n\n#### v. 2.1.0 (November 23, 2020)\n\n- Adopt [NEP 29][nep-29] and require Python version 3.7 or newer. ([#63](https://github.com/rasbt/watermark/pull/63), via contribution by [James Myatt](https://github.com/jamesmyatt))\n- Add Python 3.8 and 3.9 to Travis CI builds. ([#63](https://github.com/rasbt/watermark/pull/63), via contribution by [James Myatt](https://github.com/jamesmyatt))\n- Fix: Allow setup.py to run without install_requires already installed ([#67](https://github.com/rasbt/watermark/pull/67), via contribution by [James Myatt](https://github.com/jamesmyatt))\n- Major refactoring to improve code readability ([#64](https://github.com/rasbt/watermark/pull/64) and [65](https://github.com/rasbt/watermark/pull/65), via contribution by [Bahram Aghaei](https://github.com/GreatBahram))\n- Use importlib and importlib.metadata to determine package version numbers. ([#66](https://github.com/rasbt/watermark/pull/66), via contribution by [James Myatt](https://github.com/jamesmyatt))\n\n#### v. 2.0.2 (November 19, 2019)\n\n- Support `VERSION` attributes, in addition to `__version__` attributes.\n\n#### v. 2.0.1 (October 04, 2019)\n\n- Fix `'sklearn'` vs. `'scikit-learn'` import compatibility.\n\n#### v. 2.0.0 (October 04, 2019)\n\n- Now uses `pkg_resources` as the default method for getting version numbers.\n- Fixes a whitespace bug when printing the timezone.\n\n#### v. 1.8.2 (July 28, 2019)\n\n- When no Python library was imported and the `--iversion` is used, print an empty string instead of raising an error.\n\n#### v. 1.8.1 (January 26, 2019)\n\n- Fixes string alignment issues when the `-iv`/`--iversion` flag is used.\n\n#### v. 1.8.0 (January 02, 2019)\n\n- The `-iv`/`--iversion` flag now also shows package versions that were imported as `from X import Y`\nand `import X.Y as Y`. For example,\n\n```python\nimport scipy as sp\nfrom sklearn import metrics\nimport numpy.linalg as linalg\n```\n\n```\n%watermark --iversions\n```\n\nwill return\n\n```\nscipy     1.1.0\nsklearn   0.20.1\nnumpy     1.15.4\n```\n\n#### v. 1.7.0 (October 13, 2018)\n\n(Via contribution by [James Myatt](https://github.com/jamesmyatt))\n\n- Shows \"not installed\" for version of packages/modules that cannot be imported.\n- Shows \"unknown\" for version of packages/modules when version attribute cannot be found.\n- Add Python 3.6 and 3.7 to Travis CI builds.\n- Add classifiers to setuptools configuration.\n\n#### v. 1.6.1 (June 10, 2018)\n\n- Now also includes the LICENSE file in the Python Wheels distribution\n\n#### v. 1.6.0 (Jan uary18, 2018)\n\n- Adds a new `-b`/`--gitbranch` parameter that prints the current Git branch.\n\n#### v. 1.5.0 (August 27, 2017)\n\n- Adds a new `-iv`/ `--iversions` parameter 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](https://github.com/iamaziz))\n\n#### v. 1.4.0 (April 18, 2017)\n\n- Adds a new `-r`/ `--gitrepo` parameter that returns the URL of Git remote name \"origin\". (Via contribution by [Lucy Park](https://github.com/e9t))\n\n#### v. 1.3.4 (October 15, 2016)\n\n- Allow fetching scikit-learn's version number via `-p scikit-learn` in addition of `-p sklearn` (the former is deprecated and will not be supported in watermark \u003e 1.7).\n\n#### v. 1.3.3 (September 1, 2016)\n\n- Includes LICENSE in MANIFEST.in for packaging\n\n#### v. 1.3.2 (August 16, 2016)\n\n- Fixes an issue where the wrong package info was obtained when using the system level Jupyter within a virtualenv environment. (Via contribrution by [Michael Bell](https://github.com/mrbell))\n- Adds a new `-i`/ `--iso8601` parameter 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 \u003c 3.2 requires external libraries for for computing the timezone offset, thus, Python \u003c 3.2 will currently only print `2016-08-16T18:03:42`\n- Adds offsets to UTC to the default date-time string for Python \u003e= 3.2\n\n#### v. 1.3.1 (June 6, 2016)\n\n- Fixes an issue that caused problems importing watermark using Python 2.x\n\n#### v. 1.3.0 (May 21, 2016)\n\n- Removed the deprecated the %install_ext magic so that watermark can now be installed as a regular python package via `pip` (Via contribution by [Peter Bull](https://github.com/pjbull))\n\n#### v. 1.2.3 (January 29, 2016)\n\n- Changed date format to the unambiguous ISO-8601 format\n- Ditched the deprecated %install_ext function and made watermark a proper Python package\n- Released the new version under a more permissive newBSD [license](./LICENSE)\n\n#### v. 1.2.2 (June 17, 2015)\n\n- Changed the default date-format of `-d`, `--date` to MM/DD/YYYY, the format DD/MM/YYYY can be used via the shortcut `-e`, `--eurodate`.\n\n#### v. 1.2.1 (March 3, 2015)\n\n- Small bugfix to allow custom time string formatting.\n\n#### v. 1.2.0 (October 1, 2014)\n\n- `--watermark` command added to print the current version of watermark.\n- Print author name on a separate line\n- Fixed bug that day takes the same value as the minute if the `-n` flag is used.\n","funding_links":[],"categories":["Python","python","Jupyter-magic拓展","Jupyter Magic"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasbt%2Fwatermark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frasbt%2Fwatermark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasbt%2Fwatermark/lists"}