Skip to content

Commit 8b23fda

Browse files
authored
Merge pull request #122 from frenzymadness/py314
Workaround incompatibility with Python 3.14 Signed-off-by: Philippe Ombredanne <[email protected]>
2 parents 228f005 + d23f7be commit 8b23fda

File tree

5 files changed

+48
-30
lines changed

5 files changed

+48
-30
lines changed

.github/workflows/pypi-release.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@ on:
77
jobs:
88
build-and-publish-to-pypi:
99
name: Build and publish library to PyPI
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-24.04
1111
steps:
12-
- uses: actions/checkout@master
12+
- uses: actions/checkout@v4
13+
1314
- name: Set up Python
14-
uses: actions/setup-python@v1
15+
uses: actions/setup-python@v5
1516
with:
16-
python-version: 3.9
17-
- name: Install pypa/build
18-
run: python -m pip install build --user
17+
python-version: 3.12
18+
19+
- name: Install pypa/build and twine
20+
run: python -m pip install --user --upgrade build twine packaging pip setuptools
21+
1922
- name: Build a binary wheel and a source tarball
20-
run: python -m build --sdist --wheel --outdir dist/
21-
.
23+
run: python -m build --sdist --wheel --outdir dist/ .
24+
25+
- name: Check wheel and sdist with twine
26+
run: python -m twine check dist/*
27+
2228
- name: Publish distribution to PyPI
2329
if: startsWith(github.ref, 'refs/tags')
24-
uses: pypa/gh-action-pypi-publish@master
30+
uses: pypa/gh-action-pypi-publish@release/v1
2531
with:
2632
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/test-and-build.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@ on: [push, pull_request, workflow_dispatch]
2929
jobs:
3030
build:
3131
name: Build source distribution
32-
runs-on: ubuntu-20.04
32+
runs-on: ubuntu-24.04
3333

3434
steps:
35-
- uses: actions/checkout@v2
35+
- uses: actions/checkout@v4
3636

3737
- name: Checkout and install reqs
38-
run: |
39-
pip install --upgrade --user build twine pip setuptools
38+
run: python -m pip install --user --upgrade build twine packaging pip setuptools
4039

4140
- name: Build sdist
4241
run: |
43-
python setup.py sdist bdist_wheel
44-
twine check dist/*
42+
python -m build --sdist --wheel
43+
python -m twine check dist/*
4544
46-
- name: Collect built sdist
47-
uses: actions/upload-artifact@v2
45+
- name: Collect built sdist and wheel
46+
uses: actions/upload-artifact@v4
4847
with:
49-
path: dist/*.tar.gz
48+
name: boolean-build
49+
path: dist/*
5050

5151
test_on_many_oses:
5252
name: Run tests ${{ matrix.python }} on ${{ matrix.os }}
@@ -58,16 +58,16 @@ jobs:
5858
strategy:
5959
fail-fast: false
6060
matrix:
61-
os: [ubuntu-20.04, macos-11, windows-2022]
62-
python: ["3.6", "3.7", "3.8", "3.9", "3.10"]
61+
os: [ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, windows-2019, windows-2022, windows-2025]
62+
python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev"]
6363

6464
steps:
6565
- name: Set up Python
66-
uses: actions/setup-python@v2
66+
uses: actions/setup-python@v5
6767
with:
6868
python-version: "${{ matrix.python }}"
6969

70-
- uses: actions/checkout@v2
70+
- uses: actions/checkout@v4
7171

7272
- name: Install
7373
run: pip install -e . -r requirements-dev.txt
@@ -77,10 +77,10 @@ jobs:
7777

7878
docs:
7979
name: Generate docs
80-
runs-on: ubuntu-20.04
80+
runs-on: ubuntu-24.04
8181

8282
steps:
83-
- uses: actions/checkout@v2
83+
- uses: actions/checkout@v4
8484

8585
- name: Checkout and install reqs
8686
run: |
@@ -91,6 +91,7 @@ jobs:
9191
make -C docs html
9292
9393
- name: Collect docs
94-
uses: actions/upload-artifact@v2
94+
uses: actions/upload-artifact@v4
9595
with:
96+
name: boolean-documentation
9697
path: docs/build/

boolean/boolean.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,12 @@ def __lt__(self, other):
866866
def __gt__(self, other):
867867
lt = other.__lt__(self)
868868
if lt is NotImplemented:
869-
return not self.__lt__(other)
869+
self_lt = self.__lt__(other)
870+
if self_lt is NotImplemented:
871+
# `return not NotImplemented`` no longer works in Python 3.14
872+
return False
873+
else:
874+
return not self_lt
870875
return lt
871876

872877
def __and__(self, other):

setup.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
packages=find_packages(),
3636
include_package_data=True,
3737
zip_safe=False,
38-
test_loader="unittest:TestLoader",
39-
test_suite="boolean.test_boolean",
4038
keywords="boolean expression, boolean algebra, logic, expression parser",
4139
classifiers=[
4240
"Development Status :: 5 - Production/Stable",
@@ -54,7 +52,14 @@
5452
[
5553
"pytest >= 6, != 7.0.0",
5654
"pytest-xdist >= 2",
55+
],
56+
"dev":
57+
[
5758
"twine",
59+
"build",
60+
],
61+
"linting":
62+
[
5863
"black",
5964
"isort",
6065
"pycodestyle",

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[tox]
2-
envlist=py36,py37,py38,py39,310
2+
envlist=py39,py310,py311,py312,py313,py314
33
[testenv]
4-
commands=python setup.py test
4+
extras=testing
5+
commands=pytest -vvs boolean

0 commit comments

Comments
 (0)