From bef82947411032a55dab6533393752a0091190c7 Mon Sep 17 00:00:00 2001 From: pomponchik Date: Wed, 19 Nov 2025 18:44:21 +0700 Subject: [PATCH 01/12] Add Python 3.14 to the project's metadata --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index b049888..ac0d5ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,7 @@ classifiers = [ 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', + 'Programming Language :: Python :: 3.14', 'License :: OSI Approved :: MIT License', 'Topic :: Software Development :: Libraries', 'Intended Audience :: Developers', From dedbfe576c757c275953f8a4bf770ee0aa4fb8ac Mon Sep 17 00:00:00 2001 From: pomponchik Date: Wed, 19 Nov 2025 18:44:35 +0700 Subject: [PATCH 02/12] New version tag --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ac0d5ed..dd92185 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'displayhooks' -version = '0.0.4' +version = '0.0.5' authors = [ { name='Evgeniy Blinov', email='zheni-b@yandex.ru' }, ] From b51c52b4b2e081837fce414c384c9878dba1b095 Mon Sep 17 00:00:00 2001 From: pomponchik Date: Wed, 19 Nov 2025 18:45:55 +0700 Subject: [PATCH 03/12] Add Pythons 3.14 and 3.14t to CI --- .github/workflows/lint.yml | 51 +++++++++--------- .github/workflows/tests_and_coverage.yml | 69 ++++++++++++------------ 2 files changed, 59 insertions(+), 61 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0df31f9..efe7b82 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,44 +1,43 @@ name: Lint -on: - push +on: push jobs: build: - runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: + ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - shell: bash - run: pip install -r requirements_dev.txt + - name: Install dependencies + shell: bash + run: pip install -r requirements_dev.txt - - name: Install the library - shell: bash - run: pip install . + - name: Install the library + shell: bash + run: pip install . - - name: Run mypy - shell: bash - run: mypy displayhooks --strict + - name: Run mypy + shell: bash + run: mypy displayhooks --strict - - name: Run mypy for tests - shell: bash - run: mypy tests + - name: Run mypy for tests + shell: bash + run: mypy tests - - name: Run ruff - shell: bash - run: ruff check displayhooks + - name: Run ruff + shell: bash + run: ruff check displayhooks - - name: Run ruff for tests - shell: bash - run: ruff check tests + - name: Run ruff for tests + shell: bash + run: ruff check tests diff --git a/.github/workflows/tests_and_coverage.yml b/.github/workflows/tests_and_coverage.yml index becefc9..4fd3fef 100644 --- a/.github/workflows/tests_and_coverage.yml +++ b/.github/workflows/tests_and_coverage.yml @@ -1,48 +1,47 @@ name: Tests -on: - push +on: push jobs: build: - runs-on: ${{ matrix.os }} strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: + ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"] steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: python-version: ${{ matrix.python-version }} - - name: Install the library - shell: bash - run: pip install . - - - name: Install dependencies - shell: bash - run: pip install -r requirements_dev.txt - - - name: Print all libs - shell: bash - run: pip list - - - name: Run tests and show coverage on the command line - run: coverage run --source=displayhooks --omit="*tests*" -m pytest --cache-clear --assert=plain && coverage report -m --fail-under=100 - - - name: Upload reports to codecov - env: - CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} - if: runner.os == 'Linux' - run: | - curl -Os https://uploader.codecov.io/latest/linux/codecov - find . -iregex "codecov.*" - chmod +x codecov - ./codecov -t ${CODECOV_TOKEN} - - - name: Run tests and show the branch coverage on the command line - run: coverage run --branch --source=displayhooks --omit="*tests*" -m pytest --cache-clear --assert=plain && coverage report -m --fail-under=100 + - name: Install the library + shell: bash + run: pip install . + + - name: Install dependencies + shell: bash + run: pip install -r requirements_dev.txt + + - name: Print all libs + shell: bash + run: pip list + + - name: Run tests and show coverage on the command line + run: coverage run --source=displayhooks --omit="*tests*" -m pytest --cache-clear --assert=plain && coverage report -m --fail-under=100 + + - name: Upload reports to codecov + env: + CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} + if: runner.os == 'Linux' + run: | + curl -Os https://uploader.codecov.io/latest/linux/codecov + find . -iregex "codecov.*" + chmod +x codecov + ./codecov -t ${CODECOV_TOKEN} + + - name: Run tests and show the branch coverage on the command line + run: coverage run --branch --source=displayhooks --omit="*tests*" -m pytest --cache-clear --assert=plain && coverage report -m --fail-under=100 From afb5559c5032c762ee92f6e046cac37833385072 Mon Sep 17 00:00:00 2001 From: pomponchik Date: Wed, 19 Nov 2025 18:51:38 +0700 Subject: [PATCH 04/12] Change the coverage storage service to Coveralls --- .github/workflows/tests_and_coverage.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests_and_coverage.yml b/.github/workflows/tests_and_coverage.yml index 4fd3fef..dd2cd38 100644 --- a/.github/workflows/tests_and_coverage.yml +++ b/.github/workflows/tests_and_coverage.yml @@ -31,17 +31,18 @@ jobs: run: pip list - name: Run tests and show coverage on the command line - run: coverage run --source=displayhooks --omit="*tests*" -m pytest --cache-clear --assert=plain && coverage report -m --fail-under=100 + run: | + coverage run --source=displayhooks --omit="*tests*" -m pytest --cache-clear --assert=plain && coverage report -m --fail-under=100 + coverage xml - - name: Upload reports to codecov - env: - CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} + - name: Upload coverage to Coveralls if: runner.os == 'Linux' - run: | - curl -Os https://uploader.codecov.io/latest/linux/codecov - find . -iregex "codecov.*" - chmod +x codecov - ./codecov -t ${CODECOV_TOKEN} + env: + COVERALLS_REPO_TOKEN: ${{secrets.COVERALLS_REPO_TOKEN}} + uses: coverallsapp/github-action@v2 + with: + format: cobertura + file: coverage.xml - name: Run tests and show the branch coverage on the command line run: coverage run --branch --source=displayhooks --omit="*tests*" -m pytest --cache-clear --assert=plain && coverage report -m --fail-under=100 From f9686ec2b304dfa8f79acb6e554d00691aec3612 Mon Sep 17 00:00:00 2001 From: pomponchik Date: Wed, 19 Nov 2025 18:53:21 +0700 Subject: [PATCH 05/12] New CI actions versions --- .github/workflows/lint.yml | 4 ++-- .github/workflows/release.yml | 6 +++--- .github/workflows/tests_and_coverage.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index efe7b82..7de9d22 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,10 +11,10 @@ jobs: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd1689b..8b3e1df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,12 +15,12 @@ jobs: # IMPORTANT: this permission is mandatory for trusted publishing id-token: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.python-version }} - name: Install dependencies shell: bash diff --git a/.github/workflows/tests_and_coverage.yml b/.github/workflows/tests_and_coverage.yml index dd2cd38..510ef75 100644 --- a/.github/workflows/tests_and_coverage.yml +++ b/.github/workflows/tests_and_coverage.yml @@ -12,9 +12,9 @@ jobs: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} From e966a8d47c3936f8f63bd58e2f492fdff763416c Mon Sep 17 00:00:00 2001 From: pomponchik Date: Wed, 19 Nov 2025 18:55:07 +0700 Subject: [PATCH 06/12] New version of pytest --- requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index cbf572f..3c2f3da 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,4 +1,4 @@ -pytest==7.4.3 +pytest==9.0.1 pytest-timeout==2.2.0 coverage==7.6.1 twine==6.1.0 From 4e56fd4d7b6515fd86573b44eb6c4b460bd4b58e Mon Sep 17 00:00:00 2001 From: pomponchik Date: Wed, 19 Nov 2025 18:58:55 +0700 Subject: [PATCH 07/12] A bit more old version of pytest --- requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index 3c2f3da..2b98ee8 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,4 +1,4 @@ -pytest==9.0.1 +pytest==8.4.2 pytest-timeout==2.2.0 coverage==7.6.1 twine==6.1.0 From a7452838f76a0b33481f6f357729eb05688ded40 Mon Sep 17 00:00:00 2001 From: pomponchik Date: Wed, 19 Nov 2025 19:00:25 +0700 Subject: [PATCH 08/12] A bit more old version of pytest --- requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index 2b98ee8..4194067 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,4 +1,4 @@ -pytest==8.4.2 +pytest==8.3.5 pytest-timeout==2.2.0 coverage==7.6.1 twine==6.1.0 From 590c569e3f1cd349caeaebe8f39c6874c31049c3 Mon Sep 17 00:00:00 2001 From: pomponchik Date: Wed, 19 Nov 2025 19:01:55 +0700 Subject: [PATCH 09/12] New version of full_match --- requirements_dev.txt | 2 +- tests/test_autorestore.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index 4194067..c1848b1 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -7,4 +7,4 @@ build==1.2.2.post1 ruff==0.9.9 mypy==1.14.1 mutmut==3.2.3 -full_match==0.0.2 +full_match==0.0.3 diff --git a/tests/test_autorestore.py b/tests/test_autorestore.py index c05aed8..fae79e7 100644 --- a/tests/test_autorestore.py +++ b/tests/test_autorestore.py @@ -1,13 +1,14 @@ import sys import pytest -import full_match +from full_match import match from displayhooks import autorestore_displayhook def test_restore(): hook_before_declaration = sys.displayhook + @autorestore_displayhook def do_something(): sys.displayhook = 5 @@ -22,14 +23,15 @@ def do_something(): def test_restore_after_exception(): hook_before_declaration = sys.displayhook + @autorestore_displayhook def do_something(): sys.displayhook = 5 - raise ValueError('message') + raise ValueError("message") hook_before_calling = sys.displayhook - with pytest.raises(ValueError, match=full_match('message')): + with pytest.raises(ValueError, match=match("message")): do_something() assert hook_before_declaration is sys.displayhook From 5c17b53cf6692a373fa401375b4122093569a8c7 Mon Sep 17 00:00:00 2001 From: pomponchik Date: Wed, 19 Nov 2025 19:10:37 +0700 Subject: [PATCH 10/12] New version of Ruff --- requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index c1848b1..cfb8909 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -4,7 +4,7 @@ coverage==7.6.1 twine==6.1.0 wheel==0.41.2 build==1.2.2.post1 -ruff==0.9.9 +ruff==0.14.5 mypy==1.14.1 mutmut==3.2.3 full_match==0.0.3 From b5590215c970cf414dda8b031665e043eede6745 Mon Sep 17 00:00:00 2001 From: pomponchik Date: Wed, 19 Nov 2025 19:14:10 +0700 Subject: [PATCH 11/12] New coverage badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 520d8b0..561cbbf 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Downloads](https://static.pepy.tech/badge/displayhooks/month)](https://pepy.tech/project/displayhooks) [![Downloads](https://static.pepy.tech/badge/displayhooks)](https://pepy.tech/project/displayhooks) -[![codecov](https://codecov.io/gh/pomponchik/displayhooks/graph/badge.svg?token=UXXTj1AIcT)](https://codecov.io/gh/pomponchik/displayhooks) +[![Coverage Status](https://coveralls.io/repos/github/pomponchik/displayhooks/badge.svg?branch=main)](https://coveralls.io/github/pomponchik/displayhooks?branch=main) [![Lines of code](https://sloc.xyz/github/pomponchik/displayhooks/?category=code)](https://github.com/boyter/scc/) [![Hits-of-Code](https://hitsofcode.com/github/pomponchik/displayhooks?branch=main)](https://hitsofcode.com/github/pomponchik/displayhooks/view?branch=main) [![Test-Package](https://github.com/pomponchik/displayhooks/actions/workflows/tests_and_coverage.yml/badge.svg)](https://github.com/pomponchik/metronomes/actions/workflows/tests_and_coverage.yml) From c51e7cb637f4eff832cb539eea7ccd3774eec36c Mon Sep 17 00:00:00 2001 From: pomponchik Date: Wed, 19 Nov 2025 19:17:26 +0700 Subject: [PATCH 12/12] Some emodjies in the readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 561cbbf..b2bd17d 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ It's a micro library for manipulating [`sys.displayhook`](https://docs.python.or When you need to change the standard behavior of `displayhook`, with this library you will do it: -- declaratively -- compactly -- beautifully +- 💎 declaratively +- 🫥 compactly +- 🌞 beautifully ## Table of contents