From 21746fd78cb390fc6f1512a0c55c05e6196de3d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 19:35:43 +0300 Subject: [PATCH 01/15] Fix typo in issue template label name --- .github/ISSUE_TEMPLATE/question.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index 1a8a31c..40fe808 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -2,7 +2,7 @@ name: Question or consultation about: Ask anything about this project title: '' -labels: guestion +labels: question assignees: pomponchik --- From 51667b3bb9a6d821de248d1afc1770b7186bc2fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 19:48:17 +0300 Subject: [PATCH 02/15] Add Python 3.15.0-alpha.1 to lint and test workflows --- .github/workflows/lint.yml | 3 +-- .github/workflows/tests_and_coverage.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7de9d22..13b96bb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,8 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: - ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "3.15.0-alpha.1"] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/tests_and_coverage.yml b/.github/workflows/tests_and_coverage.yml index 510ef75..895ce07 100644 --- a/.github/workflows/tests_and_coverage.yml +++ b/.github/workflows/tests_and_coverage.yml @@ -8,8 +8,7 @@ jobs: strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] - python-version: - ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "3.15.0-alpha.1"] steps: - uses: actions/checkout@v4 From 98429301cf243c6f93d38031b58b93ad0aec0163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 19:48:59 +0300 Subject: [PATCH 03/15] Bump version to 0.0.6 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dd92185..4657e0a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'displayhooks' -version = '0.0.5' +version = '0.0.6' authors = [ { name='Evgeniy Blinov', email='zheni-b@yandex.ru' }, ] From 1f92f7258de62b1e985817fa872dd4e6893df038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 19:49:32 +0300 Subject: [PATCH 04/15] Add Python 3.15 to project classifiers --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 4657e0a..aad66ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ classifiers = [ 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', 'Programming Language :: Python :: 3.14', + 'Programming Language :: Python :: 3.15', 'License :: OSI Approved :: MIT License', 'Topic :: Software Development :: Libraries', 'Intended Audience :: Developers', From 00e91ae7b1ab19b2544e8e2a610acd883512dade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 19:49:46 +0300 Subject: [PATCH 05/15] Add Python Free Threading classifiers --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index aad66ff..83021cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,8 @@ classifiers = [ 'Programming Language :: Python :: 3.13', 'Programming Language :: Python :: 3.14', 'Programming Language :: Python :: 3.15', + 'Programming Language :: Python :: Free Threading', + 'Programming Language :: Python :: Free Threading :: 3 - Stable', 'License :: OSI Approved :: MIT License', 'Topic :: Software Development :: Libraries', 'Intended Audience :: Developers', From 4e88a4bd7c223974c0d35d82f45bf20475de94d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 19:51:41 +0300 Subject: [PATCH 06/15] Update ruff to version 0.14.6 --- requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index cfb8909..2bd2f13 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.14.5 +ruff==0.14.6 mypy==1.14.1 mutmut==3.2.3 full_match==0.0.3 From 969129d1a596e118767ee9501f5b07819b9bc9a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 19:56:02 +0300 Subject: [PATCH 07/15] Remove .ruff.toml and refactor imports to use consistent typing and formatting --- .ruff.toml | 1 - displayhooks/__init__.py | 10 ++++++--- displayhooks/autorestore.py | 3 +-- displayhooks/converter.py | 5 ++--- displayhooks/not_display.py | 2 +- pyproject.toml | 5 +++++ tests/test_converter.py | 42 ++++++++++++++++++------------------- tests/test_not_display.py | 20 +++++++++--------- 8 files changed, 47 insertions(+), 41 deletions(-) delete mode 100644 .ruff.toml diff --git a/.ruff.toml b/.ruff.toml deleted file mode 100644 index a0f883e..0000000 --- a/.ruff.toml +++ /dev/null @@ -1 +0,0 @@ -ignore = ['E501'] diff --git a/displayhooks/__init__.py b/displayhooks/__init__.py index 3186163..9c7086b 100644 --- a/displayhooks/__init__.py +++ b/displayhooks/__init__.py @@ -1,3 +1,7 @@ -from displayhooks.converter import converted_displayhook as converted_displayhook # noqa: F401 -from displayhooks.autorestore import autorestore_displayhook as autorestore_displayhook # noqa: F401 -from displayhooks.not_display import not_display as not_display # noqa: F401 +from displayhooks.autorestore import ( + autorestore_displayhook as autorestore_displayhook, +) +from displayhooks.converter import ( + converted_displayhook as converted_displayhook, +) +from displayhooks.not_display import not_display as not_display diff --git a/displayhooks/autorestore.py b/displayhooks/autorestore.py index a6d76fb..04f432f 100644 --- a/displayhooks/autorestore.py +++ b/displayhooks/autorestore.py @@ -5,9 +5,8 @@ else: from typing_extensions import ParamSpec # pragma: no cover -from typing import TypeVar, Callable from functools import wraps - +from typing import Callable, TypeVar FunctionParameters = ParamSpec('FunctionParameters') ReturningValue = TypeVar('ReturningValue') diff --git a/displayhooks/converter.py b/displayhooks/converter.py index 836744f..251bd0e 100644 --- a/displayhooks/converter.py +++ b/displayhooks/converter.py @@ -1,8 +1,7 @@ import sys -from typing import Callable, Any -from threading import Lock from functools import wraps - +from threading import Lock +from typing import Any, Callable lock = Lock() diff --git a/displayhooks/not_display.py b/displayhooks/not_display.py index cf1f463..a126761 100644 --- a/displayhooks/not_display.py +++ b/displayhooks/not_display.py @@ -1,4 +1,4 @@ -from typing import Type, Any +from typing import Any, Type from displayhooks.converter import converted_displayhook diff --git a/pyproject.toml b/pyproject.toml index 83021cd..2e63cdc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,11 @@ keywords = [ paths_to_mutate="displayhooks" runner="pytest" +[tool.ruff] +lint.ignore = ['E501', 'E712', 'PTH123', 'PTH118', 'PLR2004', 'PTH107', 'SIM105', 'SIM102', 'RET503', 'PLR0912', 'C901'] +lint.select = ["ERA001", "YTT", "ASYNC", "BLE", "B", "A", "COM", "INP", "PIE", "T20", "PT", "RSE", "RET", "SIM", "SLOT", "TID252", "ARG", "PTH", "I", "C90", "N", "E", "W", "D201", "D202", "D419", "F", "PL", "PLE", "PLR", "PLW", "RUF", "TRY201", "TRY400", "TRY401"] +format.quote-style = "single" + [project.urls] 'Source' = 'https://github.com/pomponchik/displayhooks' 'Tracker' = 'https://github.com/pomponchik/displayhooks/issues' diff --git a/tests/test_converter.py b/tests/test_converter.py index dbcc797..6f11c8f 100644 --- a/tests/test_converter.py +++ b/tests/test_converter.py @@ -5,16 +5,16 @@ import pytest -from displayhooks import converted_displayhook, autorestore_displayhook +from displayhooks import autorestore_displayhook, converted_displayhook @pytest.mark.parametrize( - ['value'], + 'value', [ - ('kek',), - ('lol',), - (1,), - (1.5,), + 'kek', + 'lol', + 1, + 1.5, ], ) @autorestore_displayhook @@ -29,7 +29,7 @@ def new_displayhook(value: Any) -> Any: output = buffer.getvalue() - assert output == f'{repr(value)}\n' + assert output == f'{value!r}\n' @autorestore_displayhook @@ -48,18 +48,18 @@ def new_displayhook(value: Any) -> Any: @pytest.mark.parametrize( - ['value'], + 'value', [ - ('kek',), - ('lol',), - (1,), - (1.5,), + 'kek', + 'lol', + 1, + 1.5, ], ) @autorestore_displayhook def test_elliminating_convertion(value): @converted_displayhook - def new_displayhook(value: Any) -> Any: + def new_displayhook(value: Any) -> Any: # noqa: ARG001 return None buffer = io.StringIO() @@ -74,7 +74,7 @@ def new_displayhook(value: Any) -> Any: @autorestore_displayhook def test_elliminating_convertion_with_none(): @converted_displayhook - def new_displayhook(value: Any) -> Any: + def new_displayhook(value: Any) -> Any: # noqa: ARG001 return None buffer = io.StringIO() @@ -87,18 +87,18 @@ def new_displayhook(value: Any) -> Any: @pytest.mark.parametrize( - ['value'], + 'value', [ - ('kek',), - ('lol',), - (1,), - (1.5,), + 'kek', + 'lol', + 1, + 1.5, ], ) @autorestore_displayhook def test_real_convertion(value): @converted_displayhook - def new_displayhook(value: Any) -> Any: + def new_displayhook(value: Any) -> Any: # noqa: ARG001 return 'cheburek' buffer = io.StringIO() @@ -107,4 +107,4 @@ def new_displayhook(value: Any) -> Any: output = buffer.getvalue() - assert output == f'{repr("cheburek")}\n' + assert output == f'{"cheburek"!r}\n' diff --git a/tests/test_not_display.py b/tests/test_not_display.py index 31fecea..83a46a3 100644 --- a/tests/test_not_display.py +++ b/tests/test_not_display.py @@ -4,7 +4,7 @@ import pytest -from displayhooks import not_display, autorestore_displayhook +from displayhooks import autorestore_displayhook, not_display @autorestore_displayhook @@ -19,21 +19,21 @@ def display_something(something): return buffer.getvalue() assert display_something(5) == '' - assert display_something('kek') == f'{repr("kek")}\n' + assert display_something('kek') == f'{"kek"!r}\n' @pytest.mark.parametrize( - ['callable'], + 'some_callable', [ - (lambda: not_display(int, float),), - (lambda: [not_display(int), not_display(float)],), # type: ignore[func-returns-value] - (lambda: not_display(float, int),), - (lambda: [not_display(float), not_display(int)],), # type: ignore[func-returns-value] + lambda: not_display(int, float), + lambda: [not_display(int), not_display(float)], # type: ignore[func-returns-value] + lambda: not_display(float, int), + lambda: [not_display(float), not_display(int)], # type: ignore[func-returns-value] ], ) @autorestore_displayhook -def test_not_display_ints_and_floats(callable): - callable() +def test_not_display_ints_and_floats(some_callable): + some_callable() def display_something(something): buffer = io.StringIO() @@ -44,4 +44,4 @@ def display_something(something): assert display_something(5) == '' assert display_something(5.5) == '' - assert display_something('kek') == f'{repr("kek")}\n' + assert display_something('kek') == f'{"kek"!r}\n' From 79eb5fccf257e95b5aca9f32161eb9c70078a2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 19:57:14 +0300 Subject: [PATCH 08/15] Update repository URLs and badges to reflect new org name "mutating" --- README.md | 8 ++++---- pyproject.toml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b2bd17d..404104e 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ [![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) -[![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) +[![Coverage Status](https://coveralls.io/repos/github/mutating/displayhooks/badge.svg?branch=main)](https://coveralls.io/github/mutating/displayhooks?branch=main) +[![Lines of code](https://sloc.xyz/github/mutating/displayhooks/?category=code)](https://github.com/boyter/scc/) +[![Hits-of-Code](https://hitsofcode.com/github/mutating/displayhooks?branch=main)](https://hitsofcode.com/github/mutating/displayhooks/view?branch=main) +[![Test-Package](https://github.com/mutating/displayhooks/actions/workflows/tests_and_coverage.yml/badge.svg)](https://github.com/mutating/metronomes/actions/workflows/tests_and_coverage.yml) [![Python versions](https://img.shields.io/pypi/pyversions/displayhooks.svg)](https://pypi.python.org/pypi/displayhooks) [![PyPI version](https://badge.fury.io/py/displayhooks.svg)](https://badge.fury.io/py/displayhooks) [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) diff --git a/pyproject.toml b/pyproject.toml index 2e63cdc..de750ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,5 +52,5 @@ lint.select = ["ERA001", "YTT", "ASYNC", "BLE", "B", "A", "COM", "INP", "PIE", " format.quote-style = "single" [project.urls] -'Source' = 'https://github.com/pomponchik/displayhooks' -'Tracker' = 'https://github.com/pomponchik/displayhooks/issues' +'Source' = 'https://github.com/mutating/displayhooks' +'Tracker' = 'https://github.com/mutating/displayhooks/issues' From dfbaf2eee8345e1960cd270b3ce5207ffaf15e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 19:40:50 +0300 Subject: [PATCH 09/15] Remove .ruff.toml and update pyproject.toml with Ruff configuration --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index de750ec..54d7934 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ paths_to_mutate="displayhooks" runner="pytest" [tool.ruff] -lint.ignore = ['E501', 'E712', 'PTH123', 'PTH118', 'PLR2004', 'PTH107', 'SIM105', 'SIM102', 'RET503', 'PLR0912', 'C901'] +lint.ignore = ['E501', 'E712', 'PTH123', 'PTH118', 'PLR2004', 'PTH107', 'SIM105', 'SIM102', 'RET503', 'PLR0912', 'C901', 'RUF001'] lint.select = ["ERA001", "YTT", "ASYNC", "BLE", "B", "A", "COM", "INP", "PIE", "T20", "PT", "RSE", "RET", "SIM", "SLOT", "TID252", "ARG", "PTH", "I", "C90", "N", "E", "W", "D201", "D202", "D419", "F", "PL", "PLE", "PLR", "PLW", "RUF", "TRY201", "TRY400", "TRY401"] format.quote-style = "single" From b6c76d013a61513740c22782b56f6f4f0efcf844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 20:07:42 +0300 Subject: [PATCH 10/15] Now ruff's check is the first one in the lint workflow --- .github/workflows/lint.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 13b96bb..46df12f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,14 +25,6 @@ jobs: shell: bash run: pip install . - - name: Run mypy - shell: bash - run: mypy displayhooks --strict - - - name: Run mypy for tests - shell: bash - run: mypy tests - - name: Run ruff shell: bash run: ruff check displayhooks @@ -40,3 +32,11 @@ jobs: - name: Run ruff for tests shell: bash run: ruff check tests + + - name: Run mypy + shell: bash + run: mypy --strict displayhooks + + - name: Run mypy for tests + shell: bash + run: mypy tests From afdbb8290da82def247d3eeb45ce3dbda6fdef34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 20:11:26 +0300 Subject: [PATCH 11/15] Add DeepWiki badge to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 404104e..2f3d49a 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ [![PyPI version](https://badge.fury.io/py/displayhooks.svg)](https://badge.fury.io/py/displayhooks) [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) +[![DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/mutating/displayhooks) It's a micro library for manipulating [`sys.displayhook`](https://docs.python.org/3/library/sys.html#sys.displayhook). From 9a6cbece97b0785508d7b31c0184827dd16026ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 21:03:37 +0300 Subject: [PATCH 12/15] A new logo --- README.md | 2 + docs/assets/logo_1.svg | 476 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 478 insertions(+) create mode 100644 docs/assets/logo_1.svg diff --git a/README.md b/README.md index 2f3d49a..31c838f 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/mutating/displayhooks) +![logo](https://raw.githubusercontent.com/mutating/displayhooks/develop/docs/assets/logo_1.svg) + It's a micro library for manipulating [`sys.displayhook`](https://docs.python.org/3/library/sys.html#sys.displayhook). diff --git a/docs/assets/logo_1.svg b/docs/assets/logo_1.svg new file mode 100644 index 0000000..8273f72 --- /dev/null +++ b/docs/assets/logo_1.svg @@ -0,0 +1,476 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DISPLAYHOOKS + From d0aad274dcf22032ca540bb6f84a5fefe9023daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 21:05:06 +0300 Subject: [PATCH 13/15] Change the logo --- docs/assets/logo_2.svg | 476 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 476 insertions(+) create mode 100644 docs/assets/logo_2.svg diff --git a/docs/assets/logo_2.svg b/docs/assets/logo_2.svg new file mode 100644 index 0000000..72977e4 --- /dev/null +++ b/docs/assets/logo_2.svg @@ -0,0 +1,476 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DISPLAYHOOKS + From 7b4c8a09a786ecccd48f7d70c6aeab53801581ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 21:07:49 +0300 Subject: [PATCH 14/15] Add collapsible section to README with badges --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 31c838f..f269a0c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# displayhooks +
+ [![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) @@ -12,6 +13,8 @@ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/mutating/displayhooks) +
+ ![logo](https://raw.githubusercontent.com/mutating/displayhooks/develop/docs/assets/logo_1.svg) From 58697756cd5e790d936087c5b41501bac2ff3e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=91=D0=BB?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=B2?= Date: Fri, 20 Mar 2026 21:14:19 +0300 Subject: [PATCH 15/15] Customize sys.displayhook behavior with declarative transformers --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f269a0c..a486a11 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ ![logo](https://raw.githubusercontent.com/mutating/displayhooks/develop/docs/assets/logo_1.svg) -It's a micro library for manipulating [`sys.displayhook`](https://docs.python.org/3/library/sys.html#sys.displayhook). +It's a micro-library for customizing [`sys.displayhook`](https://docs.python.org/3/library/sys.html#sys.displayhook). -When you need to change the standard behavior of `displayhook`, with this library you will do it: +If you need to change the default behavior of `sys.displayhook`, this library lets you do it: - 💎 declaratively - 🫥 compactly @@ -30,7 +30,7 @@ When you need to change the standard behavior of `displayhook`, with this librar ## Table of contents - [**Quick start**](#quick-start) -- [**Change the displayed value**](#change-the-displayed-value) +- [**Transform displayed values**](#transform-displayed-values) - [**Prohibiting the display of certain types of values**](#prohibiting-the-display-of-certain-types-of-values) - [**Automatic recovery of the default hook**](#automatic-recovery-of-the-default-hook) @@ -43,7 +43,7 @@ Install it: pip install displayhooks ``` -And use: +Then use it: ```python import sys @@ -57,9 +57,9 @@ sys.displayhook(666) # [nothing!] ``` -## Change the displayed value +## Transform displayed values -You can declaratively declare a converter function for the printed values. What it returns will be used to call the original `displayhook` function. +You can declaratively define a converter function for displayed values. Its return value will be passed to the original `displayhook` function. ```python import sys @@ -73,8 +73,7 @@ sys.displayhook("What’s gone with that boy, I wonder? You TOM!") #> 'what’s gone with that boy, i wonder? you tom!' ``` -If your function returns `None`, nothing will be printed. - +If your function returns `None`, nothing is displayed. ## Prohibiting the display of certain types of values