Skip to content

Commit bba73ba

Browse files
authored
Merge pull request #107 from bastikr/release-4.0
Release 4.0
2 parents 0a1e737 + 3830135 commit bba73ba

18 files changed

+1135
-859
lines changed

.github/workflows/pypi-release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release library as a PyPI wheel and sdist on tag
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-and-publish-to-pypi:
9+
name: Build and publish library to PyPI
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@master
13+
- name: Set up Python
14+
uses: actions/setup-python@v1
15+
with:
16+
python-version: 3.9
17+
- name: Install pypa/build
18+
run: python -m pip install build --user
19+
- name: Build a binary wheel and a source tarball
20+
run: python -m build --sdist --wheel --outdir dist/
21+
.
22+
- name: Publish distribution to PyPI
23+
if: startsWith(github.ref, 'refs/tags')
24+
uses: pypa/gh-action-pypi-publish@master
25+
with:
26+
password: ${{ secrets.PYPI_API_TOKEN }}
27+

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

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
2+
# Derived in part from https://github.com/google/brotli-wheels
3+
#
4+
# Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in
14+
# all copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
# THE SOFTWARE.
23+
24+
25+
name: Run tests and build wheel and sdist on all supported OS and Python
26+
27+
on: [push, pull_request, workflow_dispatch]
28+
29+
jobs:
30+
build:
31+
name: Build source distribution
32+
runs-on: ubuntu-20.04
33+
34+
steps:
35+
- uses: actions/checkout@v2
36+
37+
- name: Checkout and install reqs
38+
run: |
39+
pip install --upgrade --user build twine pip setuptools
40+
41+
- name: Build sdist
42+
run: |
43+
python setup.py sdist bdist_wheel
44+
twine check dist/*
45+
46+
- name: Collect built sdist
47+
uses: actions/upload-artifact@v2
48+
with:
49+
path: dist/*.tar.gz
50+
51+
test_on_many_oses:
52+
name: Run tests ${{ matrix.python }} on ${{ matrix.os }}
53+
runs-on: ${{ matrix.os }}
54+
defaults:
55+
run:
56+
shell: bash
57+
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
os: [ubuntu-20.04, macos-11, windows-2022]
62+
python: ["3.6", "3.7", "3.8", "3.9", "3.10"]
63+
64+
steps:
65+
- name: Set up Python
66+
uses: actions/setup-python@v2
67+
with:
68+
python-version: "${{ matrix.python }}"
69+
70+
- uses: actions/checkout@v2
71+
72+
- name: Install
73+
run: pip install -e . -r requirements-dev.txt
74+
75+
- name: Run tests
76+
run: pytest -vvs boolean

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
/.eggs/
99
/.pytest_cache/
1010
/.idea/
11-
.python-version
11+
.python-version
12+
/venv/

.travis.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

CHANGELOG.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ next
77
----
88

99

10+
4.0 (2022-04-02)
11+
----------------
12+
13+
* API changes
14+
15+
* Drop support for Python 2.
16+
* Test on Python 3.10
17+
* Make Expression.sort_order an instance attributes and not a class attribute
18+
19+
* Misc.
20+
21+
* Correct licensing documentation
22+
* Improve docstringf and apply minor refactorings
23+
* Adopt black code style and isort for imports
24+
* Drop Travis and use GitHub actions for CI
25+
26+
1027
3.8 (2020-06-10)
1128
----------------
1229

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2009-2020 Sebastian Kraemer, [email protected] and others
1+
Copyright (c) Sebastian Kraemer, [email protected] and others
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification,

MANIFEST.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
graft docs
22
graft boolean
3+
graft .github
4+
35

46
include .gitignore
5-
include .travis.yml
67
include CHANGELOG.rst
78
include LICENSE.txt
89
include MANIFEST.in
910
include README.rst
1011
include setup.py
1112
include setup.cfg
12-
include test-requirements.txt
13+
include requirements-dev.txt
1314
include tox.ini
1415

1516
global-exclude *.py[co] __pycache__

README.rst

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,41 @@ OR and NOT - other compositions like XOR and NAND are not implemented
88
but can be emulated with AND or and NOT. Expressions are constructed
99
from parsed strings or in Python.
1010

11-
It runs on Python 2.7 and Python 3.
11+
It runs on Python 3.6+
12+
You can use older version 3.x for Python 2.7+ support.
1213

1314
https://github.com/bastikr/boolean.py
1415

1516
Build status: |Build Status|
1617

18+
1719
Example
1820
-------
1921

2022
::
2123

22-
>>> import boolean
23-
>>> algebra = boolean.BooleanAlgebra()
24-
>>> expression1 = algebra.parse(u'apple and (oranges or banana) and not banana', simplify=False)
25-
>>> expression1
26-
AND(Symbol('apple'), OR(Symbol('oranges'), Symbol('banana')), NOT(Symbol('banana')))
24+
>>> import boolean
25+
>>> algebra = boolean.BooleanAlgebra()
26+
>>> expression1 = algebra.parse(u'apple and (oranges or banana) and not banana', simplify=False)
27+
>>> expression1
28+
AND(Symbol('apple'), OR(Symbol('oranges'), Symbol('banana')), NOT(Symbol('banana')))
29+
30+
>>> expression2 = algebra.parse('(oranges | banana) and not banana & apple', simplify=True)
31+
>>> expression2
32+
AND(Symbol('apple'), NOT(Symbol('banana')), Symbol('oranges'))
2733

28-
>>> expression2 = algebra.parse(u'(oranges | banana) and not banana & apple', simplify=True)
29-
>>> expression2
30-
AND(Symbol('apple'), NOT(Symbol('banana')), Symbol('oranges'))
34+
>>> expression1 == expression2
35+
False
36+
>>> expression1.simplify() == expression2
37+
True
3138

32-
>>> expression1 == expression2
33-
False
34-
>>> expression1.simplify() == expression2
35-
True
3639

3740
Documentation
3841
-------------
3942

4043
http://readthedocs.org/docs/booleanpy/en/latest/
4144

45+
4246
Installation
4347
------------
4448

@@ -55,20 +59,21 @@ You then only need to run the following command:
5559

5660
``pip install boolean.py``
5761

62+
5863
Installation via package managers
5964
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6065

6166
There are packages available for easy install on some operating systems.
6267
You are welcome to help us package this tool for more distributions!
6368

6469
- boolean.py has been packaged as Arch Linux, Fedora, openSus,
65-
nixpkgs, Guix, DragonFly and FreeBSD
70+
nixpkgs, Guix, DragonFly and FreeBSD
6671
`packages <https://repology.org/project/python:boolean.py/versions>`__ .
6772

6873
In particular:
6974

70-
- Arch Linux:
71-
`python-boolean.py <https://archlinux.org/packages/community/any/python-boolean.py/>`__
75+
- Arch Linux (AUR):
76+
`python-boolean.py <https://aur.archlinux.org/packages/python-boolean.py/>`__
7277
- Fedora:
7378
`python-boolean.py <https://apps.fedoraproject.org/packages/python-boolean.py>`__
7479
- openSUSE:
@@ -86,20 +91,23 @@ Test with all of the supported Python environments using ``tox``:
8691

8792
::
8893

89-
pip install -r test-requirements.txt
94+
pip install -r requirements-dev.txt
9095
tox
9196

9297
If ``tox`` throws ``InterpreterNotFound``, limit it to python
9398
interpreters that are actually installed on your machine:
9499

95100
::
96101

97-
tox -e py27,py36
102+
tox -e py36
103+
104+
Alternatively use pytest.
105+
98106

99107
License
100108
-------
101109

102-
Copyright (c) 2009-2020 Sebastian Kraemer, [email protected] and others
110+
Copyright (c) Sebastian Kraemer, [email protected] and others
103111
SPDX-License-Identifier: BSD-2-Clause
104112

105113
.. |Build Status| image:: https://travis-ci.org/bastikr/boolean.py.svg?branch=master

boolean/__init__.py

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,25 @@
66
look either into the docs directory or view it online, at
77
https://booleanpy.readthedocs.org/en/latest/.
88
9-
Copyright (c) 2009-2020 Sebastian Kraemer, [email protected] and others
9+
Copyright (c) Sebastian Kraemer, [email protected] and others
1010
SPDX-License-Identifier: BSD-2-Clause
1111
"""
1212

13-
from __future__ import absolute_import
14-
from __future__ import unicode_literals
15-
from __future__ import print_function
16-
17-
from boolean.boolean import BooleanAlgebra
18-
19-
from boolean.boolean import Expression
20-
from boolean.boolean import Symbol
21-
from boolean.boolean import ParseError
22-
from boolean.boolean import PARSE_ERRORS
23-
24-
from boolean.boolean import AND
25-
from boolean.boolean import NOT
26-
from boolean.boolean import OR
27-
28-
from boolean.boolean import TOKEN_TRUE
29-
from boolean.boolean import TOKEN_FALSE
30-
from boolean.boolean import TOKEN_SYMBOL
31-
32-
from boolean.boolean import TOKEN_AND
33-
from boolean.boolean import TOKEN_OR
34-
from boolean.boolean import TOKEN_NOT
35-
36-
from boolean.boolean import TOKEN_LPAR
37-
from boolean.boolean import TOKEN_RPAR
13+
from boolean.boolean import (
14+
AND,
15+
NOT,
16+
OR,
17+
PARSE_ERRORS,
18+
TOKEN_AND,
19+
TOKEN_FALSE,
20+
TOKEN_LPAR,
21+
TOKEN_NOT,
22+
TOKEN_OR,
23+
TOKEN_RPAR,
24+
TOKEN_SYMBOL,
25+
TOKEN_TRUE,
26+
BooleanAlgebra,
27+
Expression,
28+
ParseError,
29+
Symbol,
30+
)

0 commit comments

Comments
 (0)