Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-colorlog for openSUSE:Factory checked in at 2021-08-18 08:56:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-colorlog (Old) and /work/SRC/openSUSE:Factory/.python-colorlog.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-colorlog" Wed Aug 18 08:56:15 2021 rev:9 rq:912687 version:5.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-colorlog/python-colorlog.changes 2021-03-10 08:58:29.446965498 +0100 +++ /work/SRC/openSUSE:Factory/.python-colorlog.new.1899/python-colorlog.changes 2021-08-18 08:57:06.962889955 +0200 @@ -1,0 +2,12 @@ +Tue Aug 17 10:48:36 UTC 2021 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- Update to 5.0.1 + * Fix version check +- from version 5.0.0 + * Release v5.0.0, warning on older Python versions + * Fix #68 +- from version 4.8.0 + * Reformat code with black + * Fix #98 + +------------------------------------------------------------------- Old: ---- colorlog-4.7.2.tar.gz New: ---- colorlog-5.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-colorlog.spec ++++++ --- /var/tmp/diff_new_pack.t5pVvF/_old 2021-08-18 08:57:09.002887557 +0200 +++ /var/tmp/diff_new_pack.t5pVvF/_new 2021-08-18 08:57:09.002887557 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-colorlog -Version: 4.7.2 +Version: 5.0.1 Release: 0 Summary: Log formatting with colors License: MIT ++++++ colorlog-4.7.2.tar.gz -> colorlog-5.0.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/LICENSE new/colorlog-5.0.1/LICENSE --- old/colorlog-4.7.2/LICENSE 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/LICENSE 2021-04-13 15:51:42.000000000 +0200 @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Sam Clements <s...@borntyping.co.uk> +Copyright (c) 2012-2021 Sam Clements <s...@borntyping.co.uk> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/PKG-INFO new/colorlog-5.0.1/PKG-INFO --- old/colorlog-4.7.2/PKG-INFO 2021-01-14 13:47:40.983046000 +0100 +++ new/colorlog-5.0.1/PKG-INFO 2021-04-13 15:51:46.355711500 +0200 @@ -1,7 +1,7 @@ Metadata-Version: 2.1 Name: colorlog -Version: 4.7.2 -Summary: Log formatting with colors! +Version: 5.0.1 +Summary: Add colours to the output of Python's logging module. Home-page: https://github.com/borntyping/python-colorlog Author: Sam Clements Author-email: s...@borntyping.co.uk @@ -13,12 +13,31 @@ [](https://pypi.org/project/colorlog/) [](https://travis-ci.org/borntyping/python-colorlog) - `colorlog.ColoredFormatter` is a formatter for use with Python's `logging` - module that outputs records using terminal colors. + Add colours to the output of Python's `logging` module. * [Source on GitHub](https://github.com/borntyping/python-colorlog) * [Packages on PyPI](https://pypi.org/pypi/colorlog/) - * [Builds on Travis CI](https://travis-ci.org/borntyping/python-colorlog) + + Status + ------ + + colorlog currently requires Python 3.5 or higher. Older versions (below 5.x.x) + support Python 2.6 and above. + + * colorlog 6.x requires Python 3.5 or higher. + * colorlog 5.x is an interim version that will warn Python 2 users to downgrade. + * colorlog 4.x is the final version supporting Python 2. + + [colorama] is included as a required dependency and initialised when using + colorlog on Windows. + + This library is almost a decade old and supported a wide set of Python versions + for most of its life, which has made it a difficult library to add new features + to. colorlog 6 may break backwards compatibility so that newer features + can be added more easily, but may still not accept all changes or feature + requests. colorlog 4 might accept essential bugfixes but should not be + considered actively maintained and will not accept any major changes or new + features. Installation ------------ @@ -181,27 +200,16 @@ logger.log(TRACE, 'a message using a custom level') ``` - Compatibility - ------------- - - colorlog works on Python 2.6 and above, including Python 3. - - On Windows, [colorama] is required for `colorlog` to work properly. It will - automatically be included when installing `colorlog` on windows. - Tests ----- Tests similar to the above examples are found in `tests/test_colorlog.py`. - [`tox`][tox] will run the tests under all compatible python versions. - - Status ------ - colorlog is in maintainance mode. I try and ensure bugfixes are published, - but compatibility with Python 2.6+ and Python 3+ makes this a difficult + colorlog is in maintenance mode. I try and ensure bugfixes are published, + but compatibility with Python 2.6+ and Python 3+ makes this a difficult codebase to add features to. Any changes that might break backwards compatibility for existing users will not be considered. @@ -225,7 +233,7 @@ Licence ------- - Copyright (c) 2012-2020 Sam Clements <s...@borntyping.co.uk> + Copyright (c) 2012-2021 Sam Clements <s...@borntyping.co.uk> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -252,7 +260,7 @@ [Arch AUR]: https://aur.archlinux.org/packages/python-colorlog/ [BSD ports]: https://www.freshports.org/devel/py-colorlog/ [colorama]: https://pypi.python.org/pypi/colorama - [Conda]: https://anaconda.org/auto/colorlog + [Conda]: https://anaconda.org/conda-forge/colorlog [Counterparty]: https://counterparty.io/ [Debian]: https://packages.debian.org/jessie/python-colorlog [Errbot]: http://errbot.io/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/README.md new/colorlog-5.0.1/README.md --- old/colorlog-4.7.2/README.md 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/README.md 2021-04-13 15:51:42.000000000 +0200 @@ -5,12 +5,31 @@ [](https://pypi.org/project/colorlog/) [](https://travis-ci.org/borntyping/python-colorlog) -`colorlog.ColoredFormatter` is a formatter for use with Python's `logging` -module that outputs records using terminal colors. +Add colours to the output of Python's `logging` module. * [Source on GitHub](https://github.com/borntyping/python-colorlog) * [Packages on PyPI](https://pypi.org/pypi/colorlog/) -* [Builds on Travis CI](https://travis-ci.org/borntyping/python-colorlog) + +Status +------ + +colorlog currently requires Python 3.5 or higher. Older versions (below 5.x.x) +support Python 2.6 and above. + +* colorlog 6.x requires Python 3.5 or higher. +* colorlog 5.x is an interim version that will warn Python 2 users to downgrade. +* colorlog 4.x is the final version supporting Python 2. + +[colorama] is included as a required dependency and initialised when using +colorlog on Windows. + +This library is almost a decade old and supported a wide set of Python versions +for most of its life, which has made it a difficult library to add new features +to. colorlog 6 may break backwards compatibility so that newer features +can be added more easily, but may still not accept all changes or feature +requests. colorlog 4 might accept essential bugfixes but should not be +considered actively maintained and will not accept any major changes or new +features. Installation ------------ @@ -173,27 +192,16 @@ logger.log(TRACE, 'a message using a custom level') ``` -Compatibility -------------- - -colorlog works on Python 2.6 and above, including Python 3. - -On Windows, [colorama] is required for `colorlog` to work properly. It will -automatically be included when installing `colorlog` on windows. - Tests ----- Tests similar to the above examples are found in `tests/test_colorlog.py`. -[`tox`][tox] will run the tests under all compatible python versions. - - Status ------ -colorlog is in maintainance mode. I try and ensure bugfixes are published, -but compatibility with Python 2.6+ and Python 3+ makes this a difficult +colorlog is in maintenance mode. I try and ensure bugfixes are published, +but compatibility with Python 2.6+ and Python 3+ makes this a difficult codebase to add features to. Any changes that might break backwards compatibility for existing users will not be considered. @@ -217,7 +225,7 @@ Licence ------- -Copyright (c) 2012-2020 Sam Clements <s...@borntyping.co.uk> +Copyright (c) 2012-2021 Sam Clements <s...@borntyping.co.uk> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -244,7 +252,7 @@ [Arch AUR]: https://aur.archlinux.org/packages/python-colorlog/ [BSD ports]: https://www.freshports.org/devel/py-colorlog/ [colorama]: https://pypi.python.org/pypi/colorama -[Conda]: https://anaconda.org/auto/colorlog +[Conda]: https://anaconda.org/conda-forge/colorlog [Counterparty]: https://counterparty.io/ [Debian]: https://packages.debian.org/jessie/python-colorlog [Errbot]: http://errbot.io/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/colorlog/__init__.py new/colorlog-5.0.1/colorlog/__init__.py --- old/colorlog-4.7.2/colorlog/__init__.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/colorlog/__init__.py 2021-04-13 15:51:42.000000000 +0200 @@ -2,15 +2,54 @@ from __future__ import absolute_import +import sys +import warnings + from colorlog.colorlog import ( - escape_codes, default_log_colors, - ColoredFormatter, LevelFormatter, TTYColoredFormatter) + escape_codes, + default_log_colors, + ColoredFormatter, + LevelFormatter, + TTYColoredFormatter, +) from colorlog.logging import ( - basicConfig, root, getLogger, log, - debug, info, warning, error, exception, critical, StreamHandler) + basicConfig, + root, + getLogger, + log, + debug, + info, + warning, + error, + exception, + critical, + StreamHandler, +) + +__all__ = ( + "ColoredFormatter", + "default_log_colors", + "escape_codes", + "basicConfig", + "root", + "getLogger", + "debug", + "info", + "warning", + "error", + "exception", + "critical", + "log", + "exception", + "StreamHandler", + "LevelFormatter", + "TTYColoredFormatter", +) -__all__ = ('ColoredFormatter', 'default_log_colors', 'escape_codes', - 'basicConfig', 'root', 'getLogger', 'debug', 'info', 'warning', - 'error', 'exception', 'critical', 'log', 'exception', - 'StreamHandler', 'LevelFormatter', 'TTYColoredFormatter') +if sys.version_info < (3, 5): + warnings.warn( + "Colorlog 6.0.0 will require Python 3.5 or above. Pin 'colorlog<5' to your " + "dependencies if you require compatibility with older versions of Python. See " + "https://github.com/borntyping/python-colorlog#status for more information." + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/colorlog/colorlog.py new/colorlog-5.0.1/colorlog/colorlog.py --- old/colorlog-4.7.2/colorlog/colorlog.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/colorlog/colorlog.py 2021-04-13 15:51:42.000000000 +0200 @@ -7,23 +7,28 @@ from colorlog.escape_codes import escape_codes, parse_colors -__all__ = ('escape_codes', 'default_log_colors', 'ColoredFormatter', - 'LevelFormatter', 'TTYColoredFormatter') +__all__ = ( + "escape_codes", + "default_log_colors", + "ColoredFormatter", + "LevelFormatter", + "TTYColoredFormatter", +) # The default colors to use for the debug levels default_log_colors = { - 'DEBUG': 'white', - 'INFO': 'green', - 'WARNING': 'yellow', - 'ERROR': 'red', - 'CRITICAL': 'bold_red', + "DEBUG": "white", + "INFO": "green", + "WARNING": "yellow", + "ERROR": "red", + "CRITICAL": "bold_red", } # The default format to use for each style default_formats = { - '%': '%(log_color)s%(levelname)s:%(name)s:%(message)s', - '{': '{log_color}{levelname}:{name}:{message}', - '$': '${log_color}${levelname}:${name}:${message}' + "%": "%(log_color)s%(levelname)s:%(name)s:%(message)s", + "{": "{log_color}{levelname}:{name}:{message}", + "$": "${log_color}${levelname}:${name}:${message}", } @@ -55,9 +60,15 @@ Intended to help in creating more readable logging output. """ - def __init__(self, fmt=None, datefmt=None, style='%', - log_colors=None, reset=True, - secondary_log_colors=None): + def __init__( + self, + fmt=None, + datefmt=None, + style="%", + log_colors=None, + reset=True, + secondary_log_colors=None, + ): """ Set the format and colors the ColoredFormatter will use. @@ -85,12 +96,14 @@ if sys.version_info > (3, 2): fmt = default_formats[style] else: - fmt = default_formats['%'] + fmt = default_formats["%"] - if sys.version_info > (3, 8) and isinstance(self, LevelFormatter) \ - and isinstance(fmt, dict): - super(ColoredFormatter, self).__init__( - fmt, datefmt, style, validate=False) + if ( + sys.version_info > (3, 8) + and isinstance(self, LevelFormatter) + and isinstance(fmt, dict) + ): + super(ColoredFormatter, self).__init__(fmt, datefmt, style, validate=False) elif sys.version_info > (3, 2): super(ColoredFormatter, self).__init__(fmt, datefmt, style) elif sys.version_info > (2, 7): @@ -98,8 +111,7 @@ else: logging.Formatter.__init__(self, fmt, datefmt) - self.log_colors = ( - log_colors if log_colors is not None else default_log_colors) + self.log_colors = log_colors if log_colors is not None else default_log_colors self.secondary_log_colors = secondary_log_colors self.reset = reset @@ -116,7 +128,7 @@ if self.secondary_log_colors: for name, log_colors in self.secondary_log_colors.items(): color = self.color(log_colors, record.levelname) - setattr(record, name + '_log_color', color) + setattr(record, name + "_log_color", color) # Format the message if sys.version_info > (2, 7): @@ -126,8 +138,8 @@ # Add a reset code to the end of the message # (if it wasn't explicitly added in format str) - if self.reset and not message.endswith(escape_codes['reset']): - message += escape_codes['reset'] + if self.reset and not message.endswith(escape_codes["reset"]): + message += escape_codes["reset"] return message @@ -135,9 +147,15 @@ class LevelFormatter(ColoredFormatter): """An extension of ColoredFormatter that uses per-level format strings.""" - def __init__(self, fmt=None, datefmt=None, style='%', - log_colors=None, reset=True, - secondary_log_colors=None): + def __init__( + self, + fmt=None, + datefmt=None, + style="%", + log_colors=None, + reset=True, + secondary_log_colors=None, + ): """ Set the per-loglevel format that will be used. @@ -162,13 +180,23 @@ """ if sys.version_info > (2, 7): super(LevelFormatter, self).__init__( - fmt=fmt, datefmt=datefmt, style=style, log_colors=log_colors, - reset=reset, secondary_log_colors=secondary_log_colors) + fmt=fmt, + datefmt=datefmt, + style=style, + log_colors=log_colors, + reset=reset, + secondary_log_colors=secondary_log_colors, + ) else: ColoredFormatter.__init__( - self, fmt=fmt, datefmt=datefmt, style=style, - log_colors=log_colors, reset=reset, - secondary_log_colors=secondary_log_colors) + self, + fmt=fmt, + datefmt=datefmt, + style=style, + log_colors=log_colors, + reset=reset, + secondary_log_colors=secondary_log_colors, + ) self.style = style self.fmt = fmt @@ -180,8 +208,9 @@ # Update self._style because we've changed self._fmt # (code based on stdlib's logging.Formatter.__init__()) if self.style not in logging._STYLES: - raise ValueError('Style must be one of: %s' % ','.join( - logging._STYLES.keys())) + raise ValueError( + "Style must be one of: %s" % ",".join(logging._STYLES.keys()) + ) self._style = logging._STYLES[self.style][0](self._fmt) if sys.version_info > (2, 7): @@ -201,10 +230,10 @@ def __init__(self, *args, **kwargs): """Overwrite the `reset` argument to False if stream is not a TTY.""" - self.stream = kwargs.pop('stream') + self.stream = kwargs.pop("stream") # Both `reset` and `isatty` must be true to insert reset codes. - kwargs['reset'] = kwargs.get('reset', True) and self.stream.isatty() + kwargs["reset"] = kwargs.get("reset", True) and self.stream.isatty() ColoredFormatter.__init__(self, *args, **kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/colorlog/escape_codes.py new/colorlog-5.0.1/colorlog/escape_codes.py --- old/colorlog-4.7.2/colorlog/escape_codes.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/colorlog/escape_codes.py 2021-04-13 15:51:42.000000000 +0200 @@ -15,42 +15,32 @@ if sys.platform == "win32": colorama.init(strip=False) -__all__ = ('escape_codes', 'parse_colors') +__all__ = ("escape_codes", "parse_colors") # Returns escape codes from format codes def esc(*x): - return '\033[' + ';'.join(x) + 'm' + return "\033[" + ";".join(x) + "m" # The initial list of escape codes -escape_codes = { - 'reset': esc('0'), - 'bold': esc('01'), - 'thin': esc('02') -} +escape_codes = {"reset": esc("0"), "bold": esc("01"), "thin": esc("02")} # The color names -COLORS = [ - 'black', - 'red', - 'green', - 'yellow', - 'blue', - 'purple', - 'cyan', - 'white' -] +COLORS = ["black", "red", "green", "yellow", "blue", "purple", "cyan", "white"] PREFIXES = [ # Foreground without prefix - ('3', ''), ('01;3', 'bold_'), ('02;3', 'thin_'), - + ("3", ""), + ("01;3", "bold_"), + ("02;3", "thin_"), # Foreground with fg_ prefix - ('3', 'fg_'), ('01;3', 'fg_bold_'), ('02;3', 'fg_thin_'), - + ("3", "fg_"), + ("01;3", "fg_bold_"), + ("02;3", "fg_thin_"), # Background with bg_ prefix - bold/light works differently - ('4', 'bg_'), ('10', 'bg_bold_'), + ("4", "bg_"), + ("10", "bg_bold_"), ] for prefix, prefix_name in PREFIXES: @@ -60,4 +50,4 @@ def parse_colors(sequence): """Return escape codes from a color sequence.""" - return ''.join(escape_codes[n] for n in sequence.split(',') if n) + return "".join(escape_codes[n] for n in sequence.split(",") if n) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/colorlog/logging.py new/colorlog-5.0.1/colorlog/logging.py --- old/colorlog-4.7.2/colorlog/logging.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/colorlog/logging.py 2021-04-13 15:51:42.000000000 +0200 @@ -10,8 +10,15 @@ BASIC_FORMAT = "%(log_color)s%(levelname)s%(reset)s:%(name)s:%(message)s" -def basicConfig(style='%', log_colors=None, reset=True, - secondary_log_colors=None, **kwargs): +def basicConfig( + style="%", + log_colors=None, + reset=True, + secondary_log_colors=None, + format=BASIC_FORMAT, + datefmt=None, + **kwargs +): """Call ``logging.basicConfig`` and override the formatter it creates.""" logging.basicConfig(**kwargs) logging._acquireLock() @@ -19,24 +26,27 @@ stream = logging.root.handlers[0] stream.setFormatter( ColoredFormatter( - fmt=kwargs.get('format', BASIC_FORMAT), - datefmt=kwargs.get('datefmt', None), + fmt=format, + datefmt=datefmt, style=style, log_colors=log_colors, reset=reset, - secondary_log_colors=secondary_log_colors - )) + secondary_log_colors=secondary_log_colors, + ) + ) finally: logging._releaseLock() def ensure_configured(func): """Modify a function to call ``basicConfig`` first if no handlers exist.""" + @functools.wraps(func) def wrapper(*args, **kwargs): if len(logging.root.handlers) == 0: basicConfig() return func(*args, **kwargs) + return wrapper diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/colorlog/tests/conftest.py new/colorlog-5.0.1/colorlog/tests/conftest.py --- old/colorlog-4.7.2/colorlog/tests/conftest.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/colorlog/tests/conftest.py 2021-04-13 15:51:42.000000000 +0200 @@ -24,9 +24,9 @@ log_function(message) out, err = capsys.readouterr() # Print the output so that py.test shows it when a test fails - print(err, end='', file=sys.stderr) + print(err, end="", file=sys.stderr) # Assert the message send to the logger was output - assert message in err, 'Log message not output to STDERR' + assert message in err, "Log message not output to STDERR" return err @@ -40,11 +40,11 @@ def test_logger(reset_loggers, capsys): def function(logger, validator=None): lines = [ - assert_log_message(logger.debug, 'a debug message', capsys), - assert_log_message(logger.info, 'an info message', capsys), - assert_log_message(logger.warning, 'a warning message', capsys), - assert_log_message(logger.error, 'an error message', capsys), - assert_log_message(logger.critical, 'a critical message', capsys) + assert_log_message(logger.debug, "a debug message", capsys), + assert_log_message(logger.info, "an info message", capsys), + assert_log_message(logger.warning, "a warning message", capsys), + assert_log_message(logger.error, "an error message", capsys), + assert_log_message(logger.critical, "a critical message", capsys), ] if validator is not None: @@ -60,8 +60,8 @@ @pytest.fixture() def create_and_test_logger(test_logger): def function(*args, **kwargs): - validator = kwargs.pop('validator', None) - formatter_cls = kwargs.pop('formatter_class', colorlog.ColoredFormatter) + validator = kwargs.pop("validator", None) + formatter_cls = kwargs.pop("formatter_class", colorlog.ColoredFormatter) formatter = formatter_cls(*args, **kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/colorlog/tests/test_colorlog.py new/colorlog-5.0.1/colorlog/tests/test_colorlog.py --- old/colorlog-4.7.2/colorlog/tests/test_colorlog.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/colorlog/tests/test_colorlog.py 2021-04-13 15:51:42.000000000 +0200 @@ -14,13 +14,12 @@ def test_custom_colors(create_and_test_logger): """Disable all colors and check no escape codes are output.""" create_and_test_logger( - log_colors={}, reset=False, - validator=lambda line: '\x1b[' not in line) + log_colors={}, reset=False, validator=lambda line: "\x1b[" not in line + ) def test_reset(create_and_test_logger): - create_and_test_logger( - reset=True, validator=lambda l: l.endswith('\x1b[0m')) + create_and_test_logger(reset=True, validator=lambda l: l.endswith("\x1b[0m")) def test_no_reset(create_and_test_logger): @@ -28,11 +27,12 @@ fmt="%(reset)s%(log_color)s%(levelname)s:%(name)s:%(message)s", reset=False, # Check that each line does not end with an escape code - validator=lambda line: not line.endswith('\x1b[0m')) + validator=lambda line: not line.endswith("\x1b[0m"), + ) def test_secondary_colors(create_and_test_logger): - expected = ':\x1b[31mtest_secondary_colors:\x1b[34m' + expected = ":\x1b[31mtest_secondary_colors:\x1b[34m" create_and_test_logger( fmt=( "%(log_color)s%(levelname)s:" @@ -40,65 +40,67 @@ "%(message_log_color)s%(message)s" ), secondary_log_colors={ - 'name': { - 'DEBUG': 'red', - 'INFO': 'red', - 'WARNING': 'red', - 'ERROR': 'red', - 'CRITICAL': 'red', + "name": { + "DEBUG": "red", + "INFO": "red", + "WARNING": "red", + "ERROR": "red", + "CRITICAL": "red", + }, + "message": { + "DEBUG": "blue", + "INFO": "blue", + "WARNING": "blue", + "ERROR": "blue", + "CRITICAL": "blue", }, - 'message': { - 'DEBUG': 'blue', - 'INFO': 'blue', - 'WARNING': 'blue', - 'ERROR': 'blue', - 'CRITICAL': 'blue', - } }, - validator=lambda line: expected in line) + validator=lambda line: expected in line, + ) def test_some_secondary_colors(create_and_test_logger): lines = create_and_test_logger( fmt="%(message_log_color)s%(message)s", - secondary_log_colors={ - 'message': { - 'ERROR': 'red', - 'CRITICAL': 'red' - } - }) + secondary_log_colors={"message": {"ERROR": "red", "CRITICAL": "red"}}, + ) # Check that only two lines are colored - assert len([l for l in lines if '\x1b[31m' in l]) == 2 + assert len([l for l in lines if "\x1b[31m" in l]) == 2 def test_percent_style(create_and_test_logger): create_and_test_logger( - fmt='%(log_color)s%(levelname)s%(reset)s:%(name)s:%(message)s', style='%') + fmt="%(log_color)s%(levelname)s%(reset)s:%(name)s:%(message)s", style="%" + ) @pytest.mark.skipif(sys.version_info < (3, 2), reason="requires python3.2") def test_braces_style(create_and_test_logger): create_and_test_logger( - fmt='{log_color}{levelname}{reset}:{name}:{message}', style='{') + fmt="{log_color}{levelname}{reset}:{name}:{message}", style="{" + ) @pytest.mark.skipif(sys.version_info < (3, 2), reason="requires python3.2") def test_template_style(create_and_test_logger): create_and_test_logger( - fmt='${log_color}${levelname}${reset}:${name}:${message}', style='$') + fmt="${log_color}${levelname}${reset}:${name}:${message}", style="$" + ) def test_ttycolorlog(create_and_test_logger, monkeypatch): - monkeypatch.setattr(sys.stderr, 'isatty', lambda: True) + monkeypatch.setattr(sys.stderr, "isatty", lambda: True) create_and_test_logger( formatter_class=colorlog.TTYColoredFormatter, - validator=lambda line: '\x1b[' in line, - stream=sys.stderr) + validator=lambda line: "\x1b[" in line, + stream=sys.stderr, + ) def test_ttycolorlog_notty(create_and_test_logger, monkeypatch): - monkeypatch.setattr(sys.stderr, 'isatty', lambda: False) + monkeypatch.setattr(sys.stderr, "isatty", lambda: False) create_and_test_logger( formatter_class=colorlog.TTYColoredFormatter, - validator=lambda line: '\x1b[' not in line, - stream=sys.stderr) + validator=lambda line: "\x1b[" not in line, + stream=sys.stderr, + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/colorlog/tests/test_config.py new/colorlog-5.0.1/colorlog/tests/test_config.py --- old/colorlog-4.7.2/colorlog/tests/test_config.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/colorlog/tests/test_config.py 2021-04-13 15:51:42.000000000 +0200 @@ -15,32 +15,33 @@ def test_build_from_file(test_logger): logging.config.fileConfig(path("test_config.ini")) - test_logger(logging.getLogger(), lambda l: ':test_config.ini' in l) + test_logger(logging.getLogger(), lambda l: ":test_config.ini" in l) @pytest.mark.skipif(sys.version_info < (2, 7), reason="requires python2.7") def test_build_from_dictionary(test_logger): - logging.config.dictConfig({ - 'version': 1, - 'formatters': { - 'colored': { - '()': 'colorlog.ColoredFormatter', - 'format': - "%(log_color)s%(levelname)s:%(name)s:%(message)s:dict", - } - }, - 'handlers': { - 'stream': { - 'class': 'logging.StreamHandler', - 'formatter': 'colored', - 'level': 'DEBUG' + logging.config.dictConfig( + { + "version": 1, + "formatters": { + "colored": { + "()": "colorlog.ColoredFormatter", + "format": "%(log_color)s%(levelname)s:%(name)s:%(message)s:dict", + } }, - }, - 'loggers': { - '': { - 'handlers': ['stream'], - 'level': 'DEBUG', + "handlers": { + "stream": { + "class": "logging.StreamHandler", + "formatter": "colored", + "level": "DEBUG", + }, }, - }, - }) - test_logger(logging.getLogger(), lambda l: ':dict' in l) + "loggers": { + "": { + "handlers": ["stream"], + "level": "DEBUG", + }, + }, + } + ) + test_logger(logging.getLogger(), lambda l: ":dict" in l) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/colorlog/tests/test_escape_codes.py new/colorlog-5.0.1/colorlog/tests/test_escape_codes.py --- old/colorlog-4.7.2/colorlog/tests/test_escape_codes.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/colorlog/tests/test_escape_codes.py 2021-04-13 15:51:42.000000000 +0200 @@ -6,23 +6,23 @@ def test_esc(): - assert esc('1', '2', '3') == '\033[1;2;3m' + assert esc("1", "2", "3") == "\033[1;2;3m" def test_reset(): - assert escape_codes['reset'] == '\033[0m' + assert escape_codes["reset"] == "\033[0m" def test_bold_color(): - assert escape_codes['bold_red'] == '\033[01;31m' + assert escape_codes["bold_red"] == "\033[01;31m" def test_fg_color(): - assert escape_codes['fg_bold_yellow'] == '\033[01;33m' + assert escape_codes["fg_bold_yellow"] == "\033[01;33m" def test_bg_color(): - assert escape_codes['bg_bold_blue'] == '\033[104m' + assert escape_codes["bg_bold_blue"] == "\033[104m" def test_rainbow(create_and_test_logger): @@ -30,26 +30,23 @@ create_and_test_logger( "%(log_color)s%(levelname)s%(reset)s:%(bold_black)s%(name)s:" "%(message)s%(reset)s:" - "%(bold_red)sr%(red)sa%(yellow)si%(green)sn%(bold_blue)sb" "%(blue)so%(purple)sw%(reset)s " - "%(fg_bold_red)sr%(fg_red)sa%(fg_yellow)si%(fg_green)sn" "%(fg_bold_blue)sb%(fg_blue)so%(fg_purple)sw%(reset)s " - "%(bg_red)sr%(bg_bold_red)sa%(bg_yellow)si%(bg_green)sn" "%(bg_bold_blue)sb%(bg_blue)so%(bg_purple)sw%(reset)s " ) def test_parse_colors(): - assert parse_colors('reset') == '\033[0m' + assert parse_colors("reset") == "\033[0m" def test_parse_multiple_colors(): - assert parse_colors('bold_red,bg_bold_blue') == '\033[01;31m\033[104m' + assert parse_colors("bold_red,bg_bold_blue") == "\033[01;31m\033[104m" def test_parse_invalid_colors(): with pytest.raises(KeyError): - parse_colors('false') + parse_colors("false") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/colorlog/tests/test_example.py new/colorlog-5.0.1/colorlog/tests/test_example.py --- old/colorlog-4.7.2/colorlog/tests/test_example.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/colorlog/tests/test_example.py 2021-04-13 15:51:42.000000000 +0200 @@ -3,7 +3,8 @@ import colorlog handler = colorlog.StreamHandler() - handler.setFormatter(colorlog.ColoredFormatter( - '%(log_color)s%(levelname)s:%(name)s:%(message)s')) - logger = colorlog.getLogger('example') + handler.setFormatter( + colorlog.ColoredFormatter("%(log_color)s%(levelname)s:%(name)s:%(message)s") + ) + logger = colorlog.getLogger("example") logger.addHandler(handler) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/colorlog/tests/test_exports.py new/colorlog-5.0.1/colorlog/tests/test_exports.py --- old/colorlog-4.7.2/colorlog/tests/test_exports.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/colorlog/tests/test_exports.py 2021-04-13 15:51:42.000000000 +0200 @@ -5,7 +5,18 @@ def test_exports(): assert { - 'ColoredFormatter', 'default_log_colors', 'escape_codes', - 'basicConfig', 'root', 'getLogger', 'debug', 'info', 'warning', - 'error', 'exception', 'critical', 'log', 'exception' + "ColoredFormatter", + "default_log_colors", + "escape_codes", + "basicConfig", + "root", + "getLogger", + "debug", + "info", + "warning", + "error", + "exception", + "critical", + "log", + "exception", } < set(globals()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/colorlog.egg-info/PKG-INFO new/colorlog-5.0.1/colorlog.egg-info/PKG-INFO --- old/colorlog-4.7.2/colorlog.egg-info/PKG-INFO 2021-01-14 13:47:40.000000000 +0100 +++ new/colorlog-5.0.1/colorlog.egg-info/PKG-INFO 2021-04-13 15:51:46.000000000 +0200 @@ -1,7 +1,7 @@ Metadata-Version: 2.1 Name: colorlog -Version: 4.7.2 -Summary: Log formatting with colors! +Version: 5.0.1 +Summary: Add colours to the output of Python's logging module. Home-page: https://github.com/borntyping/python-colorlog Author: Sam Clements Author-email: s...@borntyping.co.uk @@ -13,12 +13,31 @@ [](https://pypi.org/project/colorlog/) [](https://travis-ci.org/borntyping/python-colorlog) - `colorlog.ColoredFormatter` is a formatter for use with Python's `logging` - module that outputs records using terminal colors. + Add colours to the output of Python's `logging` module. * [Source on GitHub](https://github.com/borntyping/python-colorlog) * [Packages on PyPI](https://pypi.org/pypi/colorlog/) - * [Builds on Travis CI](https://travis-ci.org/borntyping/python-colorlog) + + Status + ------ + + colorlog currently requires Python 3.5 or higher. Older versions (below 5.x.x) + support Python 2.6 and above. + + * colorlog 6.x requires Python 3.5 or higher. + * colorlog 5.x is an interim version that will warn Python 2 users to downgrade. + * colorlog 4.x is the final version supporting Python 2. + + [colorama] is included as a required dependency and initialised when using + colorlog on Windows. + + This library is almost a decade old and supported a wide set of Python versions + for most of its life, which has made it a difficult library to add new features + to. colorlog 6 may break backwards compatibility so that newer features + can be added more easily, but may still not accept all changes or feature + requests. colorlog 4 might accept essential bugfixes but should not be + considered actively maintained and will not accept any major changes or new + features. Installation ------------ @@ -181,27 +200,16 @@ logger.log(TRACE, 'a message using a custom level') ``` - Compatibility - ------------- - - colorlog works on Python 2.6 and above, including Python 3. - - On Windows, [colorama] is required for `colorlog` to work properly. It will - automatically be included when installing `colorlog` on windows. - Tests ----- Tests similar to the above examples are found in `tests/test_colorlog.py`. - [`tox`][tox] will run the tests under all compatible python versions. - - Status ------ - colorlog is in maintainance mode. I try and ensure bugfixes are published, - but compatibility with Python 2.6+ and Python 3+ makes this a difficult + colorlog is in maintenance mode. I try and ensure bugfixes are published, + but compatibility with Python 2.6+ and Python 3+ makes this a difficult codebase to add features to. Any changes that might break backwards compatibility for existing users will not be considered. @@ -225,7 +233,7 @@ Licence ------- - Copyright (c) 2012-2020 Sam Clements <s...@borntyping.co.uk> + Copyright (c) 2012-2021 Sam Clements <s...@borntyping.co.uk> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -252,7 +260,7 @@ [Arch AUR]: https://aur.archlinux.org/packages/python-colorlog/ [BSD ports]: https://www.freshports.org/devel/py-colorlog/ [colorama]: https://pypi.python.org/pypi/colorama - [Conda]: https://anaconda.org/auto/colorlog + [Conda]: https://anaconda.org/conda-forge/colorlog [Counterparty]: https://counterparty.io/ [Debian]: https://packages.debian.org/jessie/python-colorlog [Errbot]: http://errbot.io/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/doc/custom_level.py new/colorlog-5.0.1/doc/custom_level.py --- old/colorlog-4.7.2/doc/custom_level.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/doc/custom_level.py 2021-04-13 15:51:42.000000000 +0200 @@ -2,22 +2,22 @@ from colorlog import ColoredFormatter -logging.addLevelName(5, 'TRACE') +logging.addLevelName(5, "TRACE") def main(): """Create and use a logger.""" - formatter = ColoredFormatter(log_colors={'TRACE': 'yellow'}) + formatter = ColoredFormatter(log_colors={"TRACE": "yellow"}) handler = logging.StreamHandler() handler.setFormatter(formatter) - logger = logging.getLogger('example') + logger = logging.getLogger("example") logger.addHandler(handler) - logger.setLevel('TRACE') + logger.setLevel("TRACE") - logger.log(5, 'a message using a custom level') + logger.log(5, "a message using a custom level") -if __name__ == '__main__': +if __name__ == "__main__": main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/doc/example.py new/colorlog-5.0.1/doc/example.py --- old/colorlog-4.7.2/doc/example.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/doc/example.py 2021-04-13 15:51:42.000000000 +0200 @@ -12,15 +12,15 @@ datefmt=None, reset=True, log_colors={ - 'DEBUG': 'cyan', - 'INFO': 'green', - 'WARNING': 'yellow', - 'ERROR': 'red', - 'CRITICAL': 'red', - } + "DEBUG": "cyan", + "INFO": "green", + "WARNING": "yellow", + "ERROR": "red", + "CRITICAL": "red", + }, ) - logger = logging.getLogger('example') + logger = logging.getLogger("example") handler = logging.StreamHandler() handler.setFormatter(formatter) logger.addHandler(handler) @@ -33,12 +33,12 @@ """Create and use a logger.""" logger = setup_logger() - logger.debug('a debug message') - logger.info('an info message') - logger.warning('a warning message') - logger.error('an error message') - logger.critical('a critical message') + logger.debug("a debug message") + logger.info("an info message") + logger.warning("a warning message") + logger.error("an error message") + logger.critical("a critical message") -if __name__ == '__main__': +if __name__ == "__main__": main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/doc/yaml_example.py new/colorlog-5.0.1/doc/yaml_example.py --- old/colorlog-4.7.2/doc/yaml_example.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/doc/yaml_example.py 2021-04-13 15:51:42.000000000 +0200 @@ -17,11 +17,11 @@ Configure `logging` from a YAML file. You might adjust this function to provide the configuration path as an argument. """ - path = pathlib.Path(__file__).with_suffix('.yaml') + path = pathlib.Path(__file__).with_suffix(".yaml") logging.config.dictConfig(yaml.safe_load(path.read_text())) -if __name__ == '__main__': +if __name__ == "__main__": config() root = logging.getLogger() @@ -31,21 +31,21 @@ root.error("Root logs error") root.critical("Root logs critical") - unknown = logging.getLogger('unknown') + unknown = logging.getLogger("unknown") unknown.debug("Unknown logs debug example") unknown.info("Unknown logs propagated to root logger") unknown.warning("Unknown logs warning") unknown.error("Unknown logs error") unknown.critical("Unknown logs critical") - application = logging.getLogger('application') + application = logging.getLogger("application") application.debug("Application logs debug filtered by log level") application.info("Application logs written to console and file") application.warning("Application logs not propagated to the root logger") application.error("Application logs error example") application.critical("Application logs critical example") - example = logging.getLogger('example') + example = logging.getLogger("example") example.debug("Example logs debug filtered by log level") example.info("Example logs configured to write to file") example.warning("Example logs propagated to the root logger") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/setup.cfg new/colorlog-5.0.1/setup.cfg --- old/colorlog-4.7.2/setup.cfg 2021-01-14 13:47:40.983046000 +0100 +++ new/colorlog-5.0.1/setup.cfg 2021-04-13 15:51:46.355711500 +0200 @@ -6,7 +6,8 @@ [flake8] exclude = colorlog/tests -ignore = D203,D412,D413 +ignore = W503 +max-line-length = 88 [egg_info] tag_build = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorlog-4.7.2/setup.py new/colorlog-5.0.1/setup.py --- old/colorlog-4.7.2/setup.py 2021-01-14 13:47:39.000000000 +0100 +++ new/colorlog-5.0.1/setup.py 2021-04-13 15:51:42.000000000 +0200 @@ -1,48 +1,34 @@ from setuptools import setup setup( - name='colorlog', - version='4.7.2', - - description='Log formatting with colors!', - long_description=open('README.md').read(), - long_description_content_type='text/markdown', - - author='Sam Clements', - author_email='s...@borntyping.co.uk', - url='https://github.com/borntyping/python-colorlog', - license='MIT License', - - packages=[ - 'colorlog' - ], - - setup_requires=[ - 'setuptools>=38.6.0' - ], - - extras_require={ - ':sys_platform=="win32"': [ - 'colorama' - ] - }, - + name="colorlog", + version="5.0.1", + description="Add colours to the output of Python's logging module.", + long_description=open("README.md").read(), + long_description_content_type="text/markdown", + author="Sam Clements", + author_email="s...@borntyping.co.uk", + url="https://github.com/borntyping/python-colorlog", + license="MIT License", + packages=["colorlog"], + setup_requires=["setuptools>=38.6.0"], + extras_require={':sys_platform=="win32"': ["colorama"]}, classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Topic :: Terminals', - 'Topic :: Utilities', + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Topic :: Terminals", + "Topic :: Utilities", ], )