Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-watermark for openSUSE:Factory checked in at 2022-02-21 17:46:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-watermark (Old) and /work/SRC/openSUSE:Factory/.python-watermark.new.1958 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-watermark" Mon Feb 21 17:46:38 2022 rev:6 rq:956264 version:2.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-watermark/python-watermark.changes 2020-12-17 17:08:38.729931579 +0100 +++ /work/SRC/openSUSE:Factory/.python-watermark.new.1958/python-watermark.changes 2022-02-21 17:47:46.859615117 +0100 @@ -1,0 +2,42 @@ +Sat Feb 19 03:39:20 UTC 2022 - Arun Persaud <a...@gmx.de> + +- specfile: + * update copyright year + * skip python 3.6 + +- update to version 2.3.0: + * Added the following arguments: --github_username - for prints + author github username, --email - for prints author email, + --website - for prints author or project website. (#82, via + contribution by joschkazj) + * Added a --conda option to print the name of the current conda + environment. (#79, via contribution by Alexander Krasnikov) + * It is now possible to inject globals when used outside IPython + (#80, via contribution by Hugo Lapr??). For example, version + numbers of imported packages can now be obtained as follows: + import numpy + import watermark.watermark as watermark + + watermark(iversions=True, globals_=globals()) + +- changes from version 2.2.0: + * 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, + via contribution by Tymoteusz Wo??od??ko) + +- changes from version 2.1.0: + * Adopt NEP 29 and require Python version 3.7 or newer. (#63, via + contribution by James Myatt) + * Add Python 3.8 and 3.9 to Travis CI builds. (#63, via contribution + by James Myatt) + * Fix: Allow setup.py to run without install_requires already + installed (#67, via contribution by James Myatt) + * Major refactoring to improve code readability (#64 and 65, via + contribution by Bahram Aghaei) + * Use importlib and importlib.metadata to determine package version + numbers. (#66, via contribution by James Myatt) + +------------------------------------------------------------------- Old: ---- watermark-2.0.2.tar.gz New: ---- watermark-2.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-watermark.spec ++++++ --- /var/tmp/diff_new_pack.LvZ5sq/_old 2022-02-21 17:47:47.491615305 +0100 +++ /var/tmp/diff_new_pack.LvZ5sq/_new 2022-02-21 17:47:47.495615307 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-watermark # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,16 +16,17 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 Name: python-watermark -Version: 2.0.2 +Version: 2.3.0 Release: 0 Summary: IPython magic function to psystem information License: BSD-3-Clause Group: Development/Languages/Python URL: https://github.com/rasbt/watermark Source: https://files.pythonhosted.org/packages/source/w/watermark/watermark-%{version}.tar.gz +BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module ipython} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -54,13 +55,13 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%python_exec -c "import watermark; print('watermark %s' % watermark.__version__)"; -%python_expand ipython-%{$python_bin_suffix} -c "%load_ext watermark"; +%python_exec -c "import watermark; print('watermark %%s' %% watermark.__version__)"; +%python_expand ipython-%{$python_bin_suffix} -c "%%load_ext watermark"; %files %{python_files} %doc README.md %license LICENSE -%{python_sitelib}/watermark-%{version}-py*.egg-info +%{python_sitelib}/watermark-%{version}*-info %{python_sitelib}/watermark/ %changelog ++++++ watermark-2.0.2.tar.gz -> watermark-2.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/watermark-2.0.2/LICENSE new/watermark-2.3.0/LICENSE --- old/watermark-2.0.2/LICENSE 2019-07-28 22:21:19.000000000 +0200 +++ new/watermark-2.3.0/LICENSE 2022-01-04 02:54:42.000000000 +0100 @@ -1,6 +1,6 @@ New BSD License -Copyright (c) 2014-2018, Sebastian Raschka. +Copyright (c) 2014-2022, Sebastian Raschka. All rights reserved. Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/watermark-2.0.2/PKG-INFO new/watermark-2.3.0/PKG-INFO --- old/watermark-2.0.2/PKG-INFO 2019-11-19 16:37:50.000000000 +0100 +++ new/watermark-2.3.0/PKG-INFO 2022-01-04 02:54:47.455557600 +0100 @@ -1,36 +1,36 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: watermark -Version: 2.0.2 -Summary: IPython magic function to print date/time stamps andvarious system information. +Version: 2.3.0 +Summary: IPython magic function to print date/time stamps and various system information. Home-page: https://github.com/rasbt/watermark Author: Sebastian Raschka Author-email: m...@sebastianraschka.com License: newBSD -Description: - An IPython magic extension for printing date and time stamps, version numbers, - and hardware information. - - Contact - ============= - If you have any questions or comments about watermark, - please feel free to contact me via - email: m...@sebastianraschka.com - - This project is hosted at https://github.com/rasbt/watermark - - The documentation can be found at - https://github.com/rasbt/watermark/blob/master/README.md - Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Framework :: IPython Classifier: Intended Audience :: Developers Classifier: Intended Audience :: Science/Research Classifier: License :: OSI Approved :: BSD License -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Requires-Python: >=3.7 +License-File: LICENSE + +An IPython magic extension for printing date and time stamps, version +numbers, and hardware information. + +Contact +============= +If you have any questions or comments about watermark, +please feel free to contact me via +email: m...@sebastianraschka.com + +This project is hosted at https://github.com/rasbt/watermark + +The documentation can be found at +https://github.com/rasbt/watermark/blob/master/README.md + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/watermark-2.0.2/README.md new/watermark-2.3.0/README.md --- old/watermark-2.0.2/README.md 2019-11-19 16:35:55.000000000 +0100 +++ new/watermark-2.3.0/README.md 2022-01-04 02:54:42.000000000 +0100 @@ -1,21 +1,19 @@ [](https://travis-ci.org/rasbt/watermark) [](http://badge.fury.io/py/watermark) -   -watermark -========= +# watermark An IPython magic extension for printing date and time stamps, version numbers, and hardware information. <br> - #### Sections - [Examples](#examples) - [Installation and updating](#installation-and-updating) - [Usage](#usage) +- [Development guidelines](#development-guidelines) - [Changelog](#changelog) <br> @@ -24,13 +22,14 @@ [[top](#sections)] - + + + - - +**More examples can be found in this [Jupyter notebook](docs/watermark.ipynb).** -More examples can be found in this [Jupyter notebook](https://github.com/rasbt/watermark/blob/master/docs/watermark.ipynb). +[](https://mybinder.org/v2/gh/rasbt/watermark/master?filepath=docs%2Fwatermark.ipynb) <br> @@ -56,62 +55,111 @@ To 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. - ## Usage [[top](#sections)] After successful installation, the `watermark` magic extension can be loaded via: - %load_ext watermark +```python +%load_ext watermark +``` <br> To get an overview of all available commands, type: - %watermark? +```python +%watermark? +``` <br> - -``` -%watermark [-a AUTHOR] [-d] [-n] [-t] [-i] [-z] [-u] [-c CUSTOM_TIME] - [-v] [-p PACKAGES] [-h] [-m] [-g] [-w] +```raw + %watermark [-a AUTHOR] [-gu GITHUB_USERNAME] [-e EMAIL] [-ws WEBSITE] + [-d] [-n] [-t] [-i] [-z] [-u] [-c CUSTOM_TIME] [-v] + [-p PACKAGES] [-co] [-h] [-m] [-g] [-r] [-b] [-w] [-iv] 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 + -a AUTHOR, --author AUTHOR + prints author name + -gu GITHUB_USERNAME, --github_username GITHUB_USERNAME + prints author github username + -e EMAIL, --email EMAIL + prints author email + -ws WEBSITE, --website WEBSITE + prints author or project website + -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 + -co, --conda prints name of current conda environment + -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 current Git branch + -w, --watermark prints the current version of watermark + -iv, --iversions prints the name/version of all imported modules ``` <br> +## Development guidelines + +[[top](#sections)] + +In line with [NEP 29][nep-29], this project supports: + +- All minor versions of Python released 42 months prior to the project, and at minimum the two latest minor versions. + +[nep-29]: https://numpy.org/neps/nep-0029-deprecation_policy.html + +<br> + ## Changelog [[top](#sections)] +#### v. 2.3.0 (January 3, 2022) + +- 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)) +- 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)) +- It is now possible to inject globals when used outside IPython ([#80](https://github.com/rasbt/watermark/pull/80), via contribution by [ +Hugo Lapr??](https://github.com/Hugovdberg)). For example, version numbers of imported packages can now be obtained as follows: + +```python +import numpy +import watermark.watermark as watermark + + +watermark(iversions=True, globals_=globals()) +``` + +#### v. 2.2.0 (February 17, 2021) + +- 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)) + +#### v. 2.1.0 (November 23, 2020) + +- 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)) +- 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)) +- 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)) +- 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)) +- 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)) + #### v. 2.0.2 (November 19, 2019) - Support `VERSION` attributes, in addition to `__version__` attributes. @@ -159,7 +207,7 @@ #### v. 1.7.0 (October 13, 2018) (Via contribution by [James Myatt](https://github.com/jamesmyatt)) - + - Shows "not installed" for version of packages/modules that cannot be imported. - Shows "unknown" for version of packages/modules when version attribute cannot be found. - Add Python 3.6 and 3.7 to Travis CI builds. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/watermark-2.0.2/setup.cfg new/watermark-2.3.0/setup.cfg --- old/watermark-2.0.2/setup.cfg 2019-11-19 16:37:50.000000000 +0100 +++ new/watermark-2.3.0/setup.cfg 2022-01-04 02:54:47.455769300 +0100 @@ -1,4 +1,5 @@ [metadata] +version = 2.3.0 license_file = LICENSE classifiers = Development Status :: 5 - Production/Stable @@ -6,13 +7,14 @@ Intended Audience :: Developers Intended Audience :: Science/Research License :: OSI Approved :: BSD License - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 - Programming Language :: Python :: 3.4 - Programming Language :: Python :: 3.5 - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + +[options] +python_requires = >=3.7 [egg_info] tag_build = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/watermark-2.0.2/setup.py new/watermark-2.3.0/setup.py --- old/watermark-2.0.2/setup.py 2019-07-28 22:21:19.000000000 +0200 +++ new/watermark-2.3.0/setup.py 2022-01-04 02:25:16.000000000 +0100 @@ -5,36 +5,40 @@ # # License: BSD 3 clause -from setuptools import setup, find_packages -import os -import watermark +from textwrap import dedent -VERSION = watermark.__version__ +from setuptools import find_packages, setup +# Also see settings in setup.cfg setup( - name='watermark', - version=VERSION, - license='newBSD', - description=('IPython magic function to print date/time stamps and' - 'various system information.'), - author='Sebastian Raschka', - author_email='m...@sebastianraschka.com', - url='https://github.com/rasbt/watermark', + name="watermark", + license="newBSD", + description=( + "IPython magic function to print date/time stamps and " + "various system information." + ), + author="Sebastian Raschka", + author_email="m...@sebastianraschka.com", + url="https://github.com/rasbt/watermark", packages=find_packages(exclude=[]), - install_requires=['ipython'], - long_description=""" -An IPython magic extension for printing date and time stamps, version numbers, -and hardware information. - -Contact -============= -If you have any questions or comments about watermark, -please feel free to contact me via -email: m...@sebastianraschka.com - -This project is hosted at https://github.com/rasbt/watermark - -The documentation can be found at -https://github.com/rasbt/watermark/blob/master/README.md -""" + install_requires=[ + "ipython", + 'importlib-metadata < 3.0 ; python_version < "3.8"', + ], + long_description=dedent( + """\ + An IPython magic extension for printing date and time stamps, version + numbers, and hardware information. + + Contact + ============= + If you have any questions or comments about watermark, + please feel free to contact me via + email: m...@sebastianraschka.com + + This project is hosted at https://github.com/rasbt/watermark + + The documentation can be found at + https://github.com/rasbt/watermark/blob/master/README.md""" + ), ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/watermark-2.0.2/watermark/__init__.py new/watermark-2.3.0/watermark/__init__.py --- old/watermark-2.0.2/watermark/__init__.py 2019-11-19 16:35:31.000000000 +0100 +++ new/watermark-2.3.0/watermark/__init__.py 2022-01-04 02:25:16.000000000 +0100 @@ -5,15 +5,11 @@ # # License: BSD 3 clause +from __future__ import absolute_import -import sys +from .version import __version__ +from watermark.magic import * +from watermark.watermark import watermark -__version__ = '2.0.2' - -if sys.version_info >= (3, 0): - from watermark.watermark import * -else: - from watermark import * - -__all__ = ['watermark'] +__all__ = ["watermark", "magic"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/watermark-2.0.2/watermark/magic.py new/watermark-2.3.0/watermark/magic.py --- old/watermark-2.0.2/watermark/magic.py 1970-01-01 01:00:00.000000000 +0100 +++ new/watermark-2.3.0/watermark/magic.py 2022-01-04 02:54:42.000000000 +0100 @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +""" +IPython magic function to print date/time stamps and +various system information. +Author: Sebastian Raschka <sebastianraschka.com> +License: BSD 3 clause +""" + +from IPython.core.magic import Magics +from IPython.core.magic import magics_class +from IPython.core.magic import line_magic +from IPython.core.magic_arguments import argument +from IPython.core.magic_arguments import magic_arguments +from IPython.core.magic_arguments import parse_argstring + +from watermark import watermark + + +class PackageNotFoundError(Exception): + pass + + +@magics_class +class WaterMark(Magics): + """ + IPython magic function to print date/time stamps + and various system information. + """ + @magic_arguments() + @argument('-a', '--author', type=str, + help='prints author name') + @argument('-gu', '--github_username', type=str, + help='prints author github username') + @argument('-e', '--email', type=str, + help='prints author email') + @argument('-ws', '--website', type=str, + help='prints author or project website') + @argument('-d', '--date', action='store_true', + help='prints current date as YYYY-mm-dd') + @argument('-n', '--datename', action='store_true', + help='prints date with abbrv. day and month names') + @argument('-t', '--time', action='store_true', + help='prints current time as HH-MM-SS') + @argument('-i', '--iso8601', action='store_true', + help='prints the combined date and time including the time zone' + ' in the ISO 8601 standard with UTC offset') + @argument('-z', '--timezone', action='store_true', + help='appends the local time zone') + @argument('-u', '--updated', action='store_true', + help='appends a string "Last updated: "') + @argument('-c', '--custom_time', type=str, + help='prints a valid strftime() string') + @argument('-v', '--python', action='store_true', + help='prints Python and IPython version') + @argument('-p', '--packages', type=str, + help='prints versions of specified Python modules and packages') + @argument('-co', '--conda', action='store_true', + help='prints name of current conda environment') + @argument('-h', '--hostname', action='store_true', + help='prints the host name') + @argument('-m', '--machine', action='store_true', + help='prints system and machine info') + @argument('-g', '--githash', action='store_true', + help='prints current Git commit hash') + @argument('-r', '--gitrepo', action='store_true', + help='prints current Git remote address') + @argument('-b', '--gitbranch', action='store_true', + help='prints current Git branch') + @argument('-w', '--watermark', action='store_true', + help='prints the current version of watermark') + @argument('-iv', '--iversions', action='store_true', + help='prints the name/version of all imported modules') + @line_magic + def watermark(self, line): + """ + IPython magic function to print date/time stamps + and various system information. + """ + args = vars(parse_argstring(self.watermark, line)) + + # renaming not to pollute the namespace + # while preserving backward compatibility + args['current_date'] = args.pop('date') + args['current_time'] = args.pop('time') + args['watermark_self'] = self + + formatted_text = watermark.watermark(**args) + print(formatted_text) + + +def load_ipython_extension(ipython): + ipython.register_magics(WaterMark) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/watermark-2.0.2/watermark/version.py new/watermark-2.3.0/watermark/version.py --- old/watermark-2.0.2/watermark/version.py 1970-01-01 01:00:00.000000000 +0100 +++ new/watermark-2.3.0/watermark/version.py 2022-01-04 02:25:16.000000000 +0100 @@ -0,0 +1,10 @@ +try: + import importlib.metadata as importlib_metadata +except ImportError: + # Running on pre-3.8 Python; use importlib-metadata package + import importlib_metadata + +try: + __version__ = importlib_metadata.version("watermark") +except Exception: + __version__ = "unknown" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/watermark-2.0.2/watermark/watermark.py new/watermark-2.3.0/watermark/watermark.py --- old/watermark-2.0.2/watermark/watermark.py 2019-11-19 16:35:31.000000000 +0100 +++ new/watermark-2.3.0/watermark/watermark.py 2022-01-04 02:25:26.000000000 +0100 @@ -1,254 +1,308 @@ +# -*- coding: utf-8 -*- """ -IPython magic function to print date/time stamps and +Function to print date/time stamps and various system information. -Author: Sebastian Raschka <sebastianraschka.com> +Authors: Sebastian Raschka <sebastianraschka.com>, Tymoteusz Wo??od??ko License: BSD 3 clause """ -from . import __version__ +from __future__ import absolute_import + +import datetime +import importlib +import os import platform import subprocess -from time import strftime -from time import time -import datetime -from socket import gethostname -from multiprocessing import cpu_count +import time import types -import pkg_resources -from pkg_resources import DistributionNotFound +from multiprocessing import cpu_count +from socket import gethostname + +try: + import importlib.metadata as importlib_metadata +except ImportError: + # Running on pre-3.8 Python; use importlib-metadata package + import importlib_metadata import IPython -from IPython.core.magic import Magics -from IPython.core.magic import magics_class -from IPython.core.magic import line_magic -from IPython.core.magic_arguments import argument -from IPython.core.magic_arguments import magic_arguments -from IPython.core.magic_arguments import parse_argstring - - -class PackageNotFoundError(Exception): - pass - - -@magics_class -class WaterMark(Magics): - """ - IPython magic function to print date/time stamps - and various system information. - - """ - @magic_arguments() - @argument('-a', '--author', type=str, - help='prints author name') - @argument('-d', '--date', action='store_true', - help='prints current date as YYYY-mm-dd') - @argument('-n', '--datename', action='store_true', - help='prints date with abbrv. day and month names') - @argument('-t', '--time', action='store_true', - help='prints current time as HH-MM-SS') - @argument('-i', '--iso8601', action='store_true', - help='prints the combined date and time including the time zone' - ' in the ISO 8601 standard with UTC offset') - @argument('-z', '--timezone', action='store_true', - help='appends the local time zone') - @argument('-u', '--updated', action='store_true', - help='appends a string "Last updated: "') - @argument('-c', '--custom_time', type=str, - help='prints a valid strftime() string') - @argument('-v', '--python', action='store_true', - help='prints Python and IPython version') - @argument('-p', '--packages', type=str, - help='prints versions of specified Python modules and packages') - @argument('-h', '--hostname', action='store_true', - help='prints the host name') - @argument('-m', '--machine', action='store_true', - help='prints system and machine info') - @argument('-g', '--githash', action='store_true', - help='prints current Git commit hash') - @argument('-r', '--gitrepo', action='store_true', - help='prints current Git remote address') - @argument('-b', '--gitbranch', action='store_true', - help='prints current Git branch') - @argument('-w', '--watermark', action='store_true', - help='prints the current version of watermark') - @argument('-iv', '--iversions', action='store_true', - help='prints the name/version of all imported modules') - @line_magic - def watermark(self, line): - """ - IPython magic function to print date/time stamps - and various system information. - """ - self.out = '' - args = parse_argstring(self.watermark, line) - if not any(vars(args).values()) or args.iso8601: - try: - dt = datetime.datetime.fromtimestamp(int(time()), - datetime.timezone.utc) - iso_dt = dt.astimezone().isoformat() - except AttributeError: # timezone only supported by Py >=3.2: - iso_dt = strftime('%Y-%m-%dT%H:%M:%S') - - if not any(vars(args).values()): - self.out += iso_dt - self._get_pyversions() - self._get_sysinfo() - - else: - if args.author: - self.out += '% s ' % args.author.strip('\'"') - if args.updated and args.author: - self.out += '\n' - if args.updated: - self.out += 'last updated: ' - if args.custom_time: - self.out += '%s ' % strftime(args.custom_time) - if args.date: - self.out += '%s ' % strftime('%Y-%m-%d') - elif args.datename: - self.out += '%s ' % strftime('%a %b %d %Y') - if args.time: - self.out += '%s ' % strftime('%H:%M:%S') - if args.timezone: - self.out += '%s ' % strftime('%Z') - if args.iso8601: - self.out += iso_dt - if args.python: - self._get_pyversions() - if args.packages: - self._get_packages(args.packages) - if args.machine: - self._get_sysinfo() - if args.hostname: - space = '' - if args.machine: - space = ' ' - self.out += '\nhost name%s: %s' % (space, gethostname()) - if args.githash: - self._get_commit_hash(bool(args.machine)) - if args.gitrepo: - self._get_git_remote_origin(bool(args.machine)) - if args.gitbranch: - self._get_git_branch(bool(args.machine)) - if args.iversions: - self._print_all_import_versions(self.shell.user_ns) - if args.watermark: - if self.out: - self.out += '\n' - self.out += 'watermark %s' % __version__ - print(self.out.strip()) - - def _get_packages(self, pkgs): - if self.out: - self.out += '\n' - packages = pkgs.split(',') - - for p in packages: - if p == 'scikit-learn': - p = 'sklearn' - try: - imported = __import__(p) - except ImportError: - ver = 'not installed' +from .version import __version__ + + +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, watermark_self=None, + globals_=None): + + '''Function to print date/time stamps and various system information. + + Parameters: + =========== + + author : + prints author name + + github_username : + prints author github username + + email : + prints author email + + website : + prints author or project website + + current_date : + prints current date as YYYY-mm-dd + + datename : + prints date with abbrv. day and month names + + current_time : + prints current time as HH-MM-SS + + iso8601 : + prints the combined date and time including the time zone + in the ISO 8601 standard with UTC offset + + timezone : + appends the local time zone + + updated : + appends a string "Last updated: " + + custom_time : + prints a valid strftime() string + + python : + prints Python and IPython version (if running from Jupyter) + + packages : + prints versions of specified Python modules and packages + + conda : + prints name of current conda environment + + hostname : + prints the host name + + machine : + prints system and machine info + + githash : + prints current Git commit hash + + gitrepo : + prints current Git remote address + + gitbranch : + prints current Git branch + + watermark : + prints the current version of watermark + + iversions : + prints the name/version of all imported modules + + watermark_self : + instance of the watermark magics class, which is required + for iversions. + + ''' + output = [] + args = locals() + watermark_self = args['watermark_self'] + del args['watermark_self'] + + if not any(args.values()) or args['iso8601']: + iso_dt = _get_datetime() + + if not any(args.values()): + args['updated'] = True + output.append({"Last updated": iso_dt}) + output.append(_get_pyversions()) + output.append(_get_sysinfo()) + else: + if args['author']: + output.append({"Author": args['author'].strip("'\"")}) + if args['github_username']: + output.append({"Github username": \ + args['github_username'].strip("'\"")}) + if args['email']: + output.append({"Email": args['email'].strip("'\"")}) + if args['website']: + output.append({"Website": args['website'].strip("'\"")}) + if args['updated']: + value = "" + if args['custom_time']: + value = time.strftime(args['custom_time']) + elif args['iso8601']: + value = iso_dt + else: + values = [] + if args['current_date']: + values.append(time.strftime("%Y-%m-%d")) + elif args['datename']: + values.append(time.strftime("%a %b %d %Y")) + if args['current_time']: + time_str = time.strftime("%H:%M:%S") + if args['timezone']: + time_str += time.strftime("%Z") + values.append(time_str) + value = " ".join(values) + output.append({"Last updated": value}) + if args['python']: + output.append(_get_pyversions()) + if args['packages']: + output.append(_get_packages(args['packages'])) + if args['conda']: + output.append(_get_conda_env()) + if args['machine']: + output.append(_get_sysinfo()) + if args['hostname']: + output.append({"Hostname": gethostname()}) + if args['githash']: + output.append(_get_commit_hash(bool(args['machine']))) + if args['gitrepo']: + output.append(_get_git_remote_origin(bool(args['machine']))) + if args['gitbranch']: + output.append(_get_git_branch(bool(args['machine']))) + if args['iversions']: + if watermark_self: + ns = watermark_self.shell.user_ns + elif globals_: + ns = globals_ else: + raise RuntimeError( + "Either `watermark_self` or `globals_` must be provided " + "to show imported package versions." + ) + output.append(_get_all_import_versions(ns)) + if args['watermark']: + output.append({"Watermark": __version__}) + + return _generate_formatted_text(output) + + +def _generate_formatted_text(list_of_dicts): + result = [] + for section in list_of_dicts: + if section: + text = "" + longest = max(len(key) for key in section) + for key, value in section.items(): + text += f"{key.ljust(longest)}: {value}\n" + result.append(text) + return "\n".join(result) + + +def _get_datetime(pattern="%Y-%m-%dT%H:%M:%S"): + try: + dt = datetime.datetime.now(tz=datetime.timezone.utc) + iso_dt = dt.astimezone().isoformat() + except AttributeError: # timezone only supported by Py >=3.2: + iso_dt = time.strftime(pattern) + return iso_dt + + +def _get_packages(pkgs): + packages = pkgs.split(",") + return {package: _get_package_version(package) + for package in packages} + + +def _get_package_version(pkg_name): + """Return the version of a given package""" + if pkg_name == "scikit-learn": + pkg_name = "sklearn" + try: + imported = importlib.import_module(pkg_name) + except ImportError: + version = "not installed" + else: + try: + version = importlib_metadata.version(pkg_name) + except importlib_metadata.PackageNotFoundError: + try: + version = imported.__version__ + except AttributeError: try: - ver = pkg_resources.get_distribution(p).version - except DistributionNotFound: + version = imported.version + except AttributeError: try: - ver = imported.__version__ + version = imported.version_info except AttributeError: - try: - ver = imported.version - except AttributeError: - try: - ver = imported.version_info - except AttributeError: - ver = 'unknown' - - self.out += '\n%s %s' % (p, ver) - - def _get_pyversions(self): - if self.out: - self.out += '\n\n' - self.out += '%s %s\nIPython %s' % ( - platform.python_implementation(), - platform.python_version(), - IPython.__version__) - - def _get_sysinfo(self): - if self.out: - self.out += '\n\n' - self.out += ('compiler : %s\nsystem : %s\n' - 'release : %s\nmachine : %s\n' - 'processor : %s\nCPU cores : %s\ninterpreter: %s') % ( - platform.python_compiler(), - platform.system(), - platform.release(), - platform.machine(), - platform.processor(), - cpu_count(), - platform.architecture()[0]) - - def _get_commit_hash(self, machine): - process = subprocess.Popen(['git', 'rev-parse', 'HEAD'], - shell=False, - stdout=subprocess.PIPE) - git_head_hash = process.communicate()[0].strip() - space = '' - if machine: - space = ' ' - self.out += '\nGit hash%s: %s' % (space, - git_head_hash.decode("utf-8")) - - def _get_git_remote_origin(self, machine): - process = subprocess.Popen(['git', 'config', '--get', - 'remote.origin.url'], - shell=False, - stdout=subprocess.PIPE) - git_remote_origin = process.communicate()[0].strip() - space = '' - if machine: - space = ' ' - self.out += '\nGit repo%s: %s' % (space, - git_remote_origin.decode("utf-8")) - - def _get_git_branch(self, machine): - process = subprocess.Popen(['git', 'rev-parse', '--abbrev-ref', - 'HEAD'], - shell=False, - stdout=subprocess.PIPE) - git_branch = process.communicate()[0].strip() - space = '' - if machine: - space = ' ' - self.out += '\nGit branch%s: %s' % (space, - git_branch.decode("utf-8")) - - @staticmethod - def _print_all_import_versions(vars): - to_print = set() - for val in list(vars.values()): - if isinstance(val, types.ModuleType): - if val.__name__ != 'builtins': - try: - for v in ["VERSION", "__version__"]: - if hasattr(val, v): - to_print.add((val.__name__, getattr(val, v))) - break - except AttributeError as e: - try: - imported = __import__(val.__name__.split('.')[0]) - to_print.add((imported.__name__, - imported.__version__)) - except AttributeError as e: - continue - - longest = max([len(i[0]) for i in to_print] + [0]) + 1 - for entry in to_print: - print(('%s' % entry[0]).ljust(longest) + entry[1]) + version = "unknown" + return version -def load_ipython_extension(ipython): - ipython.register_magics(WaterMark) +def _get_pyversions(): + return { + "Python implementation": platform.python_implementation(), + "Python version": platform.python_version(), + "IPython version": IPython.__version__, + } + + +def _get_sysinfo(): + return { + "Compiler": platform.python_compiler(), + "OS": platform.system(), + "Release": platform.release(), + "Machine": platform.machine(), + "Processor": platform.processor(), + "CPU cores": cpu_count(), + "Architecture": platform.architecture()[0], + } + + +def _get_commit_hash(machine): + process = subprocess.Popen( + ["git", "rev-parse", "HEAD"], shell=False, stdout=subprocess.PIPE + ) + git_head_hash = process.communicate()[0].strip() + return {"Git hash": git_head_hash.decode("utf-8")} + + +def _get_git_remote_origin(machine): + process = subprocess.Popen( + ["git", "config", "--get", "remote.origin.url"], + shell=False, + stdout=subprocess.PIPE, + ) + git_remote_origin = process.communicate()[0].strip() + return {"Git repo": git_remote_origin.decode("utf-8")} + + +def _get_git_branch(machine): + process = subprocess.Popen( + ["git", "rev-parse", "--abbrev-ref", "HEAD"], + shell=False, + stdout=subprocess.PIPE, + ) + git_branch = process.communicate()[0].strip() + return {"Git branch": git_branch.decode("utf-8")} + + +def _get_all_import_versions(vars): + to_print = {} + imported_pkgs = { + val.__name__.split(".")[0] + for val in list(vars.values()) + if isinstance(val, types.ModuleType) + } + imported_pkgs.discard("builtins") + for pkg_name in imported_pkgs: + pkg_version = _get_package_version(pkg_name) + if pkg_version not in ("not installed", "unknown"): + to_print[pkg_name] = pkg_version + return to_print + + +def _get_conda_env(): + name = os.getenv('CONDA_DEFAULT_ENV', 'n/a') + return {"conda environment": name} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/watermark-2.0.2/watermark.egg-info/PKG-INFO new/watermark-2.3.0/watermark.egg-info/PKG-INFO --- old/watermark-2.0.2/watermark.egg-info/PKG-INFO 2019-11-19 16:37:50.000000000 +0100 +++ new/watermark-2.3.0/watermark.egg-info/PKG-INFO 2022-01-04 02:54:47.000000000 +0100 @@ -1,36 +1,36 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: watermark -Version: 2.0.2 -Summary: IPython magic function to print date/time stamps andvarious system information. +Version: 2.3.0 +Summary: IPython magic function to print date/time stamps and various system information. Home-page: https://github.com/rasbt/watermark Author: Sebastian Raschka Author-email: m...@sebastianraschka.com License: newBSD -Description: - An IPython magic extension for printing date and time stamps, version numbers, - and hardware information. - - Contact - ============= - If you have any questions or comments about watermark, - please feel free to contact me via - email: m...@sebastianraschka.com - - This project is hosted at https://github.com/rasbt/watermark - - The documentation can be found at - https://github.com/rasbt/watermark/blob/master/README.md - Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Framework :: IPython Classifier: Intended Audience :: Developers Classifier: Intended Audience :: Science/Research Classifier: License :: OSI Approved :: BSD License -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Requires-Python: >=3.7 +License-File: LICENSE + +An IPython magic extension for printing date and time stamps, version +numbers, and hardware information. + +Contact +============= +If you have any questions or comments about watermark, +please feel free to contact me via +email: m...@sebastianraschka.com + +This project is hosted at https://github.com/rasbt/watermark + +The documentation can be found at +https://github.com/rasbt/watermark/blob/master/README.md + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/watermark-2.0.2/watermark.egg-info/SOURCES.txt new/watermark-2.3.0/watermark.egg-info/SOURCES.txt --- old/watermark-2.0.2/watermark.egg-info/SOURCES.txt 2019-11-19 16:37:50.000000000 +0100 +++ new/watermark-2.3.0/watermark.egg-info/SOURCES.txt 2022-01-04 02:54:47.000000000 +0100 @@ -4,6 +4,8 @@ setup.cfg setup.py watermark/__init__.py +watermark/magic.py +watermark/version.py watermark/watermark.py watermark.egg-info/PKG-INFO watermark.egg-info/SOURCES.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/watermark-2.0.2/watermark.egg-info/requires.txt new/watermark-2.3.0/watermark.egg-info/requires.txt --- old/watermark-2.0.2/watermark.egg-info/requires.txt 2019-11-19 16:37:50.000000000 +0100 +++ new/watermark-2.3.0/watermark.egg-info/requires.txt 2022-01-04 02:54:47.000000000 +0100 @@ -1 +1,4 @@ ipython + +[:python_version < "3.8"] +importlib-metadata<3.0