From 8390e7504612a5e44d9229b5d29dd2ca0c0f6f99 Mon Sep 17 00:00:00 2001 From: Sam Clements Date: Mon, 29 Aug 2022 15:53:21 +0100 Subject: [PATCH 1/7] Use pypa/gh-action-pypi-publish@release/v1 The `@master` version is deprecated. https://github.com/pypa/gh-action-pypi-publish#-master-branch-sunset- --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10fa74d..57c8e62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,7 @@ jobs: - name: "🐍 Build a binary wheel and a source tarball" run: "python setup.py sdist bdist_wheel" - name: "📦 Publish distribution to PyPI" - uses: "pypa/gh-action-pypi-publish@master" + uses: "pypa/gh-action-pypi-publish@release/v1" if: "startsWith(github.ref, 'refs/tags')" with: password: "${{ secrets.pypi_password }}" From f2ac5d20c5684d4c28a54b2fc5b811d0fdc8d739 Mon Sep 17 00:00:00 2001 From: gopackgo90 Date: Sun, 4 Dec 2022 17:44:32 -0600 Subject: [PATCH 2/7] Remove universal wheel, python 2 is unsupported --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 126d585..58b285e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,3 @@ -[bdist_wheel] -universal = 1 - [flake8] exclude = .tox,.venv ignore = W503 From f2a927cebef158a763121867faf5d5fb2419aeb7 Mon Sep 17 00:00:00 2001 From: Sam Clements Date: Sat, 2 Dec 2023 16:30:12 +0000 Subject: [PATCH 3/7] Drop tests on EOL Python versions, add tests on 3.11 and 3.12 --- .github/workflows/ci.yml | 6 +++--- tox.ini | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57c8e62..455a92e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: strategy: matrix: python-version: - - "3.10" + - "3.12" steps: - uses: "actions/checkout@master" - name: "🐍 Set up Python ${{ matrix.python-version }}" @@ -30,11 +30,11 @@ jobs: strategy: matrix: python-version: - - "3.6" - - "3.7" - "3.8" - "3.9" - "3.10" + - "3.11" + - "3.12" dependencies: - "" - "colorama" diff --git a/tox.ini b/tox.ini index 34dece3..db99cc7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = black,flake8,mypy,py36,py37,py38,py39,py310 +envlist = black,flake8,mypy,py38,py39,py310,py311,py312 [testenv] deps = pytest From 83b292b80bba0976aee75c25ea32ba50ead66954 Mon Sep 17 00:00:00 2001 From: Sam Clements Date: Sat, 2 Dec 2023 16:31:05 +0000 Subject: [PATCH 4/7] Fix new flake8 linter errors --- colorlog/tests/test_colorlog.py | 2 +- colorlog/tests/test_config.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/colorlog/tests/test_colorlog.py b/colorlog/tests/test_colorlog.py index db9d46c..82d6b6e 100644 --- a/colorlog/tests/test_colorlog.py +++ b/colorlog/tests/test_colorlog.py @@ -17,7 +17,7 @@ def test_custom_colors(create_and_test_logger): 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 line: line.endswith("\x1b[0m")) def test_no_reset(create_and_test_logger): diff --git a/colorlog/tests/test_config.py b/colorlog/tests/test_config.py index e6f281f..332dcf4 100644 --- a/colorlog/tests/test_config.py +++ b/colorlog/tests/test_config.py @@ -12,7 +12,7 @@ def path(filename): 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 line: ":test_config.ini" in line) def test_build_from_dictionary(test_logger): @@ -40,4 +40,4 @@ def test_build_from_dictionary(test_logger): }, } ) - test_logger(logging.getLogger(), lambda l: ":dict" in l) + test_logger(logging.getLogger(), lambda line: ":dict" in line) From 6a14458f8e9bfff8810e547ae5babf229648b199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 24 Nov 2023 16:45:42 +0100 Subject: [PATCH 5/7] Fix running tests in environment with NO_COLOR=1 Fix running the test suite when pytest is run with NO_COLOR=1 set in the environment. An fixture is autoused to ensure that the variables are removed for the scope of the test, while they are respected e.g. by pytest itself. --- colorlog/tests/conftest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/colorlog/tests/conftest.py b/colorlog/tests/conftest.py index 65fd6d4..52ccec8 100644 --- a/colorlog/tests/conftest.py +++ b/colorlog/tests/conftest.py @@ -28,6 +28,12 @@ def assert_log_message(capsys, log_function, message, *args): return err +@pytest.fixture(autouse=True) +def clean_env(monkeypatch): + monkeypatch.delenv("FORCE_COLOR", raising=False) + monkeypatch.delenv("NO_COLOR", raising=False) + + @pytest.fixture() def reset_loggers(): logging.root.handlers = list() From 079ec1cef8fc9289517e5ee546119cfe453fc4d6 Mon Sep 17 00:00:00 2001 From: Sam Clements Date: Sat, 2 Dec 2023 16:40:05 +0000 Subject: [PATCH 6/7] Publish with a Trusted Publisher --- .github/workflows/ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 455a92e..7f2b102 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,11 @@ jobs: run: "python -m pytest" publish: name: "📦 Publish Python distributions" + if: "startsWith(github.ref, 'refs/tags')" runs-on: "ubuntu-latest" + environment: "publish" + permissions: + id-token: write strategy: matrix: python-version: @@ -69,8 +73,5 @@ jobs: run: "python -m pip install wheel --user" - name: "🐍 Build a binary wheel and a source tarball" run: "python setup.py sdist bdist_wheel" - - name: "📦 Publish distribution to PyPI" + - name: "📦 Publish package distributions to PyPI" uses: "pypa/gh-action-pypi-publish@release/v1" - if: "startsWith(github.ref, 'refs/tags')" - with: - password: "${{ secrets.pypi_password }}" From ed17d6dc388864ca298b9d12a96aec44991a85ac Mon Sep 17 00:00:00 2001 From: Sam Clements Date: Sat, 2 Dec 2023 16:36:06 +0000 Subject: [PATCH 7/7] Bump version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bc90a19..66211da 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="colorlog", - version="6.7.0", + version="6.8.0", description="Add colours to the output of Python's logging module.", long_description=open("README.md").read(), long_description_content_type="text/markdown",