From 4373d20c7a4626b21ff4f02325d8d6a1437ded2a Mon Sep 17 00:00:00 2001 From: Nyako Shigure Date: Mon, 28 Sep 2026 23:26:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20feat:=20Require=20Python=203.11?= =?UTF-8?q?=20and=20test=20Python=203.15/3.15t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/lint-and-fmt.yml | 2 +- .github/workflows/unit-test.yml | 20 +++++++++++++++++++- pyproject.toml | 6 +++--- tests/test_cli.py | 27 +++++++++++++++++++++++++++ uv.lock | 22 +--------------------- 5 files changed, 51 insertions(+), 26 deletions(-) create mode 100644 tests/test_cli.py diff --git a/.github/workflows/lint-and-fmt.yml b/.github/workflows/lint-and-fmt.yml index 8839d90..6281468 100644 --- a/.github/workflows/lint-and-fmt.yml +++ b/.github/workflows/lint-and-fmt.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: # Only run linter and formatter on minimum supported Python version - python-version: ['3.10'] + python-version: ['3.11'] architecture: ['x64'] name: lint and fmt - Python ${{ matrix.python-version }} on ${{ matrix.architecture }} steps: diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index af04acd..02df8db 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -12,9 +12,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] + python-version: ['3.11', '3.12', '3.13', '3.14', '3.15', '3.15t'] architecture: ['x64'] name: unittest - Python ${{ matrix.python-version }} on ${{ matrix.architecture }} + env: + UV_PYTHON: ${{ matrix.python-version }} steps: - name: Checkout uses: actions/checkout@v7 @@ -38,6 +40,22 @@ jobs: run: | just ci-install + - name: Verify test interpreter + run: | + uv run python - <<'PY' + import os + import sys + import sysconfig + + expected = os.environ['UV_PYTHON'] + assert sys.version_info[:2] == tuple(map(int, expected.rstrip('t').split('.'))), sys.version + free_threaded = expected.endswith('t') + assert bool(sysconfig.get_config_var('Py_GIL_DISABLED')) == free_threaded, sys.version + if free_threaded: + assert not sys._is_gil_enabled(), sys.version + print(sys.version) + PY + - name: unit test run: | just ci-test diff --git a/pyproject.toml b/pyproject.toml index 5a5865f..882b4ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "expr-simplifier" version = "0.1.1" description = "" readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.11" dependencies = ["typing-extensions>=4.12.2"] authors = [{ name = "Nyakku Shigure", email = "sigure.qaq@gmail.com" }] keywords = [] @@ -13,11 +13,11 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Programming Language :: Python :: Implementation :: CPython", ] @@ -40,7 +40,7 @@ dev = [ [tool.ruff] line-length = 120 -target-version = "py310" +target-version = "py311" [tool.ruff.lint] select = [ diff --git a/tests/test_cli.py b/tests/test_cli.py new file mode 100644 index 0000000..ca1d199 --- /dev/null +++ b/tests/test_cli.py @@ -0,0 +1,27 @@ +from __future__ import annotations + +import subprocess +import sys + +import pytest + + +@pytest.mark.parametrize( + ["args", "expected"], + [ + (["cse", "a * 4 + (a * 4)"], "(___t_0 := (a * 4)) + ___t_0"), + (["constant_folding", "(___x := 1 + 1) + ___x", "--max-iter=1"], "(___x := 2) + ___x"), + (["constant_folding", "(___x := 1 + 1) + ___x", "--max-iter=2"], "4"), + (["logical_simplification", "a and b and a"], "a and b"), + (["auto", "1 + 1"], "2"), + ], +) +def test_cli(args: list[str], expected: str) -> None: + result = subprocess.run( + [sys.executable, "-m", "expr_simplifier", *args], + check=True, + capture_output=True, + text=True, + ) + assert result.stdout.strip() == expected + assert result.stderr == "" diff --git a/uv.lock b/uv.lock index 5f7118d..f252d1e 100644 --- a/uv.lock +++ b/uv.lock @@ -1,6 +1,6 @@ version = 1 revision = 3 -requires-python = ">=3.10" +requires-python = ">=3.11" [[package]] name = "colorama" @@ -11,15 +11,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, ] -[[package]] -name = "exceptiongroup" -version = "1.2.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/09/35/2495c4ac46b980e4ca1f6ad6db102322ef3ad2410b79fdde159a4b0f3b92/exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc", size = 28883, upload-time = "2024-07-12T22:26:00.161Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/02/cc/b7e31358aac6ed1ef2bb790a9746ac2c69bcb3c8588b41616914eb106eaf/exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b", size = 16453, upload-time = "2024-07-12T22:25:58.476Z" }, -] - [[package]] name = "expr-simplifier" version = "0.1.1" @@ -89,12 +80,10 @@ version = "9.1.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "colorama", marker = "sys_platform == 'win32'" }, - { name = "exceptiongroup", marker = "python_full_version < '3.11'" }, { name = "iniconfig" }, { name = "packaging" }, { name = "pluggy" }, { name = "pygments" }, - { name = "tomli", marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/e4/47/b9efed96c114afcfa3c9d3fe98a76a1d14c74a9e266d397cf6eb64be5e01/pytest-9.1.1.tar.gz", hash = "sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313", size = 1636369, upload-time = "2026-06-19T10:58:32.857Z" } wheels = [ @@ -139,15 +128,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/fe/a0/50787329e4f20bf9dc9f6230015d46ec69c51a97ace5bc202dae4755365d/ruff-0.16.8-py3-none-win_arm64.whl", hash = "sha256:d075e820af612102ce217f07cc93e69f9490b10ec13ea85fa87bd03d996cef8a", size = 10386316, upload-time = "2026-09-16T15:54:43.332Z" }, ] -[[package]] -name = "tomli" -version = "2.0.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/35/b9/de2a5c0144d7d75a57ff355c0c24054f965b2dc3036456ae03a51ea6264b/tomli-2.0.2.tar.gz", hash = "sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed", size = 16096, upload-time = "2024-10-02T10:46:13.208Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/cf/db/ce8eda256fa131af12e0a76d481711abe4681b6923c27efb9a255c9e4594/tomli-2.0.2-py3-none-any.whl", hash = "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38", size = 13237, upload-time = "2024-10-02T10:46:11.806Z" }, -] - [[package]] name = "ty" version = "0.0.82" From 4b81d96cd7f849285e637cf03e14e3e517003c57 Mon Sep 17 00:00:00 2001 From: Nyako Shigure Date: Tue, 29 Sep 2026 00:44:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=A7=20chore:=20Minimize=20Python?= =?UTF-8?q?=20version=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/unit-test.yml | 16 ---------------- tests/test_cli.py | 27 --------------------------- 2 files changed, 43 deletions(-) delete mode 100644 tests/test_cli.py diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 02df8db..d85b576 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -40,22 +40,6 @@ jobs: run: | just ci-install - - name: Verify test interpreter - run: | - uv run python - <<'PY' - import os - import sys - import sysconfig - - expected = os.environ['UV_PYTHON'] - assert sys.version_info[:2] == tuple(map(int, expected.rstrip('t').split('.'))), sys.version - free_threaded = expected.endswith('t') - assert bool(sysconfig.get_config_var('Py_GIL_DISABLED')) == free_threaded, sys.version - if free_threaded: - assert not sys._is_gil_enabled(), sys.version - print(sys.version) - PY - - name: unit test run: | just ci-test diff --git a/tests/test_cli.py b/tests/test_cli.py deleted file mode 100644 index ca1d199..0000000 --- a/tests/test_cli.py +++ /dev/null @@ -1,27 +0,0 @@ -from __future__ import annotations - -import subprocess -import sys - -import pytest - - -@pytest.mark.parametrize( - ["args", "expected"], - [ - (["cse", "a * 4 + (a * 4)"], "(___t_0 := (a * 4)) + ___t_0"), - (["constant_folding", "(___x := 1 + 1) + ___x", "--max-iter=1"], "(___x := 2) + ___x"), - (["constant_folding", "(___x := 1 + 1) + ___x", "--max-iter=2"], "4"), - (["logical_simplification", "a and b and a"], "a and b"), - (["auto", "1 + 1"], "2"), - ], -) -def test_cli(args: list[str], expected: str) -> None: - result = subprocess.run( - [sys.executable, "-m", "expr_simplifier", *args], - check=True, - capture_output=True, - text=True, - ) - assert result.stdout.strip() == expected - assert result.stderr == ""