From bbfffd31efeb7e42f1db6d842ed52d1f422f1423 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Mon, 11 Nov 2024 14:12:13 +0100 Subject: [PATCH 1/8] Workaround incompatibility with Python 3.14 Using NotImplemented in a boolean context will now raise a TypeError. It had previously raised a DeprecationWarning since Python 3.9. Fixes: https://github.com/bastikr/boolean.py/issues/121 --- boolean/boolean.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/boolean/boolean.py b/boolean/boolean.py index eeffbc4..cd4bdbe 100644 --- a/boolean/boolean.py +++ b/boolean/boolean.py @@ -866,7 +866,12 @@ def __lt__(self, other): def __gt__(self, other): lt = other.__lt__(self) if lt is NotImplemented: - return not self.__lt__(other) + self_lt = self.__lt__(other) + if self_lt is NotImplemented: + # `return not NotImplemented`` no longer works in Python 3.14 + return False + else: + return not self_lt return lt def __and__(self, other): From a31d286592f5d98fd788c4a7959b4d3bc2edb882 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Mon, 18 Nov 2024 07:40:05 +0100 Subject: [PATCH 2/8] Update testing configuration - Add new Pythons and drop the old ones in tox and CI. - Split testing dependencies between testing and linting. - Do not use deprecated `setup.py test`. - Use the same pytest command in tox and CI. --- .github/workflows/test-and-build.yml | 2 +- setup.py | 6 +++--- tox.ini | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index 2c62dbb..74b0166 100644 --- a/.github/workflows/test-and-build.yml +++ b/.github/workflows/test-and-build.yml @@ -59,7 +59,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04, macos-11, windows-2022] - python: ["3.6", "3.7", "3.8", "3.9", "3.10"] + python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev"] steps: - name: Set up Python diff --git a/setup.py b/setup.py index 438b1a4..f6ea6ff 100644 --- a/setup.py +++ b/setup.py @@ -35,8 +35,6 @@ packages=find_packages(), include_package_data=True, zip_safe=False, - test_loader="unittest:TestLoader", - test_suite="boolean.test_boolean", keywords="boolean expression, boolean algebra, logic, expression parser", classifiers=[ "Development Status :: 5 - Production/Stable", @@ -54,7 +52,9 @@ [ "pytest >= 6, != 7.0.0", "pytest-xdist >= 2", - "twine", + ], + "linting": + [ "black", "isort", "pycodestyle", diff --git a/tox.ini b/tox.ini index 5134012..c19d5ac 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,5 @@ [tox] -envlist=py36,py37,py38,py39,310 +envlist=py39,py310,py311,py312,py313,py314 [testenv] -commands=python setup.py test \ No newline at end of file +extras=testing +commands=pytest -vvs boolean \ No newline at end of file From 44555f652c585a19a45acd829b388d17a4d1bc32 Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Thu, 3 Apr 2025 11:09:55 +0200 Subject: [PATCH 3/8] Keep twine in a dev extra Signed-off-by: Philippe Ombredanne --- setup.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup.py b/setup.py index f6ea6ff..ac3ec4d 100644 --- a/setup.py +++ b/setup.py @@ -53,6 +53,10 @@ "pytest >= 6, != 7.0.0", "pytest-xdist >= 2", ], + "dev": + [ + "twine", + ], "linting": [ "black", From 5b88ee391e5178220811b4e494725b94600a2dea Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Thu, 3 Apr 2025 11:28:47 +0200 Subject: [PATCH 4/8] Bump action versions in CI Also add small updates and refinements Signed-off-by: Philippe Ombredanne --- .github/workflows/pypi-release.yml | 19 ++++++++++--------- .github/workflows/test-and-build.yml | 18 +++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml index a7fdb79..39c20c1 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/pypi-release.yml @@ -7,20 +7,21 @@ on: jobs: build-and-publish-to-pypi: name: Build and publish library to PyPI - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@master + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: 3.9 - - name: Install pypa/build - run: python -m pip install build --user + python-version: 3.12 + - name: Install pypa/build and twine + run: python -m pip install build twine --user - name: Build a binary wheel and a source tarball - run: python -m build --sdist --wheel --outdir dist/ - . + run: python -m build --sdist --wheel --outdir dist/ . + - name: Check wheel and sdist with twine + run: python -m twine check dist/* - name: Publish distribution to PyPI if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index 74b0166..719900f 100644 --- a/.github/workflows/test-and-build.yml +++ b/.github/workflows/test-and-build.yml @@ -29,10 +29,10 @@ on: [push, pull_request, workflow_dispatch] jobs: build: name: Build source distribution - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Checkout and install reqs run: | @@ -44,7 +44,7 @@ jobs: twine check dist/* - name: Collect built sdist - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: path: dist/*.tar.gz @@ -58,16 +58,16 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, macos-11, windows-2022] + os: [ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, windows-2019, windows-2022, windows-2024] python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev"] steps: - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: "${{ matrix.python }}" - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install run: pip install -e . -r requirements-dev.txt @@ -77,10 +77,10 @@ jobs: docs: name: Generate docs - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Checkout and install reqs run: | @@ -91,6 +91,6 @@ jobs: make -C docs html - name: Collect docs - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: path: docs/build/ From 09bb89c12f6979f1487fc21e142312d83fce378a Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Thu, 3 Apr 2025 11:33:48 +0200 Subject: [PATCH 5/8] Use correct windows version Signed-off-by: Philippe Ombredanne --- .github/workflows/test-and-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index 719900f..b2e15e1 100644 --- a/.github/workflows/test-and-build.yml +++ b/.github/workflows/test-and-build.yml @@ -58,7 +58,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, windows-2019, windows-2022, windows-2024] + os: [ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, windows-2019, windows-2022, windows-2025] python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev"] steps: From 383220be08b9e6994202e59d8886fab026d59cb4 Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Thu, 3 Apr 2025 11:44:52 +0200 Subject: [PATCH 6/8] Streamline build tests Signed-off-by: Philippe Ombredanne --- .github/workflows/test-and-build.yml | 4 ++-- setup.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index b2e15e1..42b1651 100644 --- a/.github/workflows/test-and-build.yml +++ b/.github/workflows/test-and-build.yml @@ -40,8 +40,8 @@ jobs: - name: Build sdist run: | - python setup.py sdist bdist_wheel - twine check dist/* + python -m build --sdist --wheel + python -m twine check dist/* - name: Collect built sdist uses: actions/upload-artifact@v4 diff --git a/setup.py b/setup.py index ac3ec4d..049fbcd 100644 --- a/setup.py +++ b/setup.py @@ -56,6 +56,7 @@ "dev": [ "twine", + "build", ], "linting": [ From 32c0471a3f27382acccd196566885a86af47a5b3 Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Thu, 3 Apr 2025 11:52:57 +0200 Subject: [PATCH 7/8] Force packaging upgrade Work around a bug in twine Also apply cosmetic formatings and refine commands Reference: https://github.com/pypa/twine/issues/1216#issuecomment-2606531615 Signed-off-by: Philippe Ombredanne --- .github/workflows/pypi-release.yml | 7 ++++++- .github/workflows/test-and-build.yml | 7 +++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml index 39c20c1..3888f07 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/pypi-release.yml @@ -10,16 +10,21 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 + - name: Set up Python uses: actions/setup-python@v5 with: python-version: 3.12 + - name: Install pypa/build and twine - run: python -m pip install build twine --user + run: python -m pip install --user --upgrade build twine packaging pip setuptools + - name: Build a binary wheel and a source tarball run: python -m build --sdist --wheel --outdir dist/ . + - name: Check wheel and sdist with twine run: python -m twine check dist/* + - name: Publish distribution to PyPI if: startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index 42b1651..5be7aa0 100644 --- a/.github/workflows/test-and-build.yml +++ b/.github/workflows/test-and-build.yml @@ -35,18 +35,17 @@ jobs: - uses: actions/checkout@v4 - name: Checkout and install reqs - run: | - pip install --upgrade --user build twine pip setuptools + run: python -m pip install --user --upgrade build twine packaging pip setuptools - name: Build sdist run: | python -m build --sdist --wheel python -m twine check dist/* - - name: Collect built sdist + - name: Collect built sdist and wheel uses: actions/upload-artifact@v4 with: - path: dist/*.tar.gz + path: dist/* test_on_many_oses: name: Run tests ${{ matrix.python }} on ${{ matrix.os }} From d23f7bea7f76811701d5b6af2cff694a32acdbe8 Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Thu, 3 Apr 2025 12:00:47 +0200 Subject: [PATCH 8/8] Use distinct names for artifacts Signed-off-by: Philippe Ombredanne --- .github/workflows/test-and-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index 5be7aa0..d2c85ad 100644 --- a/.github/workflows/test-and-build.yml +++ b/.github/workflows/test-and-build.yml @@ -45,6 +45,7 @@ jobs: - name: Collect built sdist and wheel uses: actions/upload-artifact@v4 with: + name: boolean-build path: dist/* test_on_many_oses: @@ -92,4 +93,5 @@ jobs: - name: Collect docs uses: actions/upload-artifact@v4 with: + name: boolean-documentation path: docs/build/