From c9c058bc13604797d7279f12555c221eef5ae228 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Sun, 23 Aug 2020 16:30:15 -0400 Subject: [PATCH 01/49] Allow numba to be replaced by pypy --- quaternionic/__init__.py | 2 +- quaternionic/algebra.py | 2 +- quaternionic/distance.py | 3 +-- quaternionic/utilities.py | 19 +++++++++++++------ tests/test_utilities.py | 2 ++ 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/quaternionic/__init__.py b/quaternionic/__init__.py index ec502d9..9c1a9bd 100644 --- a/quaternionic/__init__.py +++ b/quaternionic/__init__.py @@ -9,7 +9,7 @@ __version__ = importlib_metadata.version(__name__) -from .utilities import jit, guvectorize +from .utilities import jit, guvectorize, float64, boolean from . import algebra, properties, converters, distance, utilities algebra_ufuncs = type('AlgebraUfuncs', (object,), dict())() diff --git a/quaternionic/algebra.py b/quaternionic/algebra.py index 183ebfc..32114bf 100644 --- a/quaternionic/algebra.py +++ b/quaternionic/algebra.py @@ -36,7 +36,7 @@ import numpy as np -from numba import float64, boolean +from . import float64, boolean from .utilities import attach_typelist_and_signature diff --git a/quaternionic/distance.py b/quaternionic/distance.py index 1ce232b..e72ec61 100644 --- a/quaternionic/distance.py +++ b/quaternionic/distance.py @@ -3,8 +3,7 @@ # import numpy as np -from numba import float64 -from . import jit, guvectorize, algebra +from . import jit, guvectorize, algebra, float64 from .utilities import ndarray_args _divide = jit(algebra.divide) diff --git a/quaternionic/utilities.py b/quaternionic/utilities.py index 17f4ee1..aa3e8e8 100644 --- a/quaternionic/utilities.py +++ b/quaternionic/utilities.py @@ -2,17 +2,13 @@ # See LICENSE file for details: # -import functools -import numba +import platform ufunc_attributes = [ 'nin', 'nout', 'nargs', 'ntypes', 'types', 'identity', 'signature', 'reduce', 'accumulate', 'reduceat', 'outer', 'at' ] -jit = functools.partial(numba.njit, cache=True) -guvectorize = functools.partial(numba.guvectorize, nopython=True, cache=True) - def type_self_return(f): """Decorate jitted functions to return with type of first argument""" @@ -133,7 +129,6 @@ def pyguvectorize(types, signature): """ import functools import numpy as np - import numba as nb inputs, output = signature.split('->') inputs = inputs.split(',') slice_a = slice(None) if inputs[0]=='()' else 0 @@ -196,3 +191,15 @@ def pyguvectorize_module_functions(module, obj): if isinstance(v, types.FunctionType) and hasattr(v, 'types') and hasattr(v, 'signature'): v_ufunc = pyguvectorize(v.types, v.signature)(v) setattr(obj, k, v_ufunc) + + +if platform.python_implementation() == 'PyPy': + float64, boolean = [float], [bool] + jit = lambda f: f + guvectorize = pyguvectorize +else: + import functools + import numba + from numba import float64, boolean + jit = functools.partial(numba.njit, cache=True) + guvectorize = functools.partial(numba.guvectorize, nopython=True, cache=True) diff --git a/tests/test_utilities.py b/tests/test_utilities.py index 2ee12e3..966ccce 100644 --- a/tests/test_utilities.py +++ b/tests/test_utilities.py @@ -1,3 +1,4 @@ +import platform import functools import numpy as np import quaternionic @@ -66,6 +67,7 @@ def f1(a, b, c): assert isinstance(d3, np.ndarray) and isinstance(d3, quaternionic.array) +@pytest.mark.skipif(platform.python_implementation() == 'PyPy', reason="No numba on pypy") def test_types_to_ftylist(): import numba types_to_ftylist = quaternionic.utilities.convert_numpy_ufunc_type_to_numba_ftylist From 3cbb9da5e6b61b023c4c19a2d8afcc1687e45a7d Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Sun, 23 Aug 2020 16:32:36 -0400 Subject: [PATCH 02/49] Try pypy on github --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea2dc93..bdfc389 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.6, 3.7, 3.8] + python-version: [3.6, 3.7, 3.8, pypy3] steps: - name: Check out code From 5adaa4675346ff20c9c76a90e7c170cf7ea645b6 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Sun, 23 Aug 2020 16:44:58 -0400 Subject: [PATCH 03/49] Lower implementation name, because apparently it's good form --- quaternionic/utilities.py | 2 +- tests/test_utilities.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/quaternionic/utilities.py b/quaternionic/utilities.py index aa3e8e8..958c36e 100644 --- a/quaternionic/utilities.py +++ b/quaternionic/utilities.py @@ -193,7 +193,7 @@ def pyguvectorize_module_functions(module, obj): setattr(obj, k, v_ufunc) -if platform.python_implementation() == 'PyPy': +if platform.python_implementation().lower() == 'pypy': float64, boolean = [float], [bool] jit = lambda f: f guvectorize = pyguvectorize diff --git a/tests/test_utilities.py b/tests/test_utilities.py index 966ccce..5d626e4 100644 --- a/tests/test_utilities.py +++ b/tests/test_utilities.py @@ -67,7 +67,7 @@ def f1(a, b, c): assert isinstance(d3, np.ndarray) and isinstance(d3, quaternionic.array) -@pytest.mark.skipif(platform.python_implementation() == 'PyPy', reason="No numba on pypy") +@pytest.mark.skipif(platform.python_implementation().lower() == 'pypy', reason="No numba on pypy") def test_types_to_ftylist(): import numba types_to_ftylist = quaternionic.utilities.convert_numpy_ufunc_type_to_numba_ftylist From 683f5c783d7dd91b57a1a588cf6452d5c9b9c4a7 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Sun, 23 Aug 2020 16:45:12 -0400 Subject: [PATCH 04/49] Switch to poetry-core; specify cpython for some deps --- pyproject.toml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a936758..27daebf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,17 +11,17 @@ homepage = "https://github.com/moble/quaternionic" python = "^3.6" numpy = "^1.13" scipy = "^1.0" -numba = "^0.50" +numba = {version = "^0.50", implementation_name == "cpython"} importlib-metadata = {version = "^1.0", python = "<3.8"} -mkdocs = {version = "^1.1.2", optional = true} -mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true} +mkdocs = {version = "^1.1.2", optional = true, implementation_name == "cpython"} +mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, implementation_name == "cpython"} [tool.poetry.dev-dependencies] pytest = "^6.0" pytest-cov = "^2.10.1" -mkdocs = "^1.1.2" -mktheapidocs = {extras = ["plugin"], version = "^0.2.0"} -black = "^19.10b0" +mkdocs = {version = "^1.1.2", implementation_name == "cpython"} +mktheapidocs = {extras = ["plugin"], version = "^0.2.0", implementation_name == "cpython"} +black = {version = "^19.10b0", implementation_name == "cpython"} [tool.poetry.extras] mkdocs = ["mkdocs"] @@ -37,6 +37,10 @@ norecursedirs = ".* build dist *.egg-info install ENV" junit_family="xunit2" addopts = "-v --tb=short --doctest-glob='' --cov --cov-branch --cov-report xml" +# [build-system] +# requires = ["poetry>=1.0.10"] +# build-backend = "poetry.masonry.api" + [build-system] -requires = ["poetry>=1.0.10"] -build-backend = "poetry.masonry.api" +requires = ["poetry-core>=1.0.0a6"] +build-backend = "poetry.core.masonry.api" From 0234d16559daf967cf9be3ca3c5c5f308b4aecd6 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Sun, 23 Aug 2020 16:53:27 -0400 Subject: [PATCH 05/49] Remove silly syntax error --- pyproject.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 27daebf..8e15834 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,17 +11,17 @@ homepage = "https://github.com/moble/quaternionic" python = "^3.6" numpy = "^1.13" scipy = "^1.0" -numba = {version = "^0.50", implementation_name == "cpython"} +numba = {version = "^0.50", implementation_name = "cpython"} importlib-metadata = {version = "^1.0", python = "<3.8"} -mkdocs = {version = "^1.1.2", optional = true, implementation_name == "cpython"} -mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, implementation_name == "cpython"} +mkdocs = {version = "^1.1.2", optional = true, implementation_name = "cpython"} +mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, implementation_name = "cpython"} [tool.poetry.dev-dependencies] pytest = "^6.0" pytest-cov = "^2.10.1" -mkdocs = {version = "^1.1.2", implementation_name == "cpython"} -mktheapidocs = {extras = ["plugin"], version = "^0.2.0", implementation_name == "cpython"} -black = {version = "^19.10b0", implementation_name == "cpython"} +mkdocs = {version = "^1.1.2", implementation_name = "cpython"} +mktheapidocs = {extras = ["plugin"], version = "^0.2.0", implementation_name = "cpython"} +black = {version = "^19.10b0", implementation_name = "cpython"} [tool.poetry.extras] mkdocs = ["mkdocs"] From 1c8dea37979623f15c19d5064283df4c95bc00af Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Sun, 23 Aug 2020 17:00:10 -0400 Subject: [PATCH 06/49] Ensure the correct python is being used for pip --- .github/workflows/build.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bdfc389..34bc47b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,8 +26,9 @@ jobs: shell: bash -l {0} run: | python -m pip install --upgrade pip - #pip install poetry # Only install poetry like this in containers - pip install --no-warn-script-location --user --pre poetry -U # Temporary: https://github.com/python-poetry/poetry/issues/2711 + #python -m pip install poetry # Only install poetry like this in containers + python -m pip install --no-warn-script-location --user --pre poetry -U # Temporary: https://github.com/python-poetry/poetry/issues/2711 + python -m pip install --no-warn-script-location --user --pre poetry-core -U # Temporary: https://github.com/python-poetry/poetry/issues/2711 - name: Run poetry shell: bash -l {0} @@ -62,9 +63,9 @@ jobs: shell: bash -l {0} run: | python -m pip install --upgrade pip - pip install toml - #pip install poetry # Only install poetry like this in containers - pip install --no-warn-script-location --user --pre poetry -U # Temporary: https://github.com/python-poetry/poetry/issues/2711 + python -m pip install toml + #python -m pip install poetry # Only install poetry like this in containers + python -m pip install --no-warn-script-location --user --pre poetry -U # Temporary: https://github.com/python-poetry/poetry/issues/2711 python -m poetry build python -m poetry install From 33ea45230812ded493a73cbfd2b323bfc2b0ef07 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 09:57:09 -0400 Subject: [PATCH 07/49] Correct format for environment markers --- pyproject.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8e15834..d80bb76 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,17 +11,17 @@ homepage = "https://github.com/moble/quaternionic" python = "^3.6" numpy = "^1.13" scipy = "^1.0" -numba = {version = "^0.50", implementation_name = "cpython"} +numba = {version = "^0.50", markers = "implementation_name = 'cpython'"} importlib-metadata = {version = "^1.0", python = "<3.8"} -mkdocs = {version = "^1.1.2", optional = true, implementation_name = "cpython"} -mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, implementation_name = "cpython"} +mkdocs = {version = "^1.1.2", optional = true, markers = "implementation_name = 'cpython'"} +mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "implementation_name = 'cpython'"} [tool.poetry.dev-dependencies] pytest = "^6.0" pytest-cov = "^2.10.1" -mkdocs = {version = "^1.1.2", implementation_name = "cpython"} -mktheapidocs = {extras = ["plugin"], version = "^0.2.0", implementation_name = "cpython"} -black = {version = "^19.10b0", implementation_name = "cpython"} +mkdocs = {version = "^1.1.2", markers = "implementation_name = 'cpython'"} +mktheapidocs = {extras = ["plugin"], version = "^0.2.0", markers = "implementation_name = 'cpython'"} +black = {version = "^19.10b0", markers = "implementation_name = 'cpython'"} [tool.poetry.extras] mkdocs = ["mkdocs"] From e15c2636884c748f70827334e2e202b2c848d71a Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 10:00:31 -0400 Subject: [PATCH 08/49] Fix rookie mistake --- pyproject.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d80bb76..6f419aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,17 +11,17 @@ homepage = "https://github.com/moble/quaternionic" python = "^3.6" numpy = "^1.13" scipy = "^1.0" -numba = {version = "^0.50", markers = "implementation_name = 'cpython'"} +numba = {version = "^0.50", markers = "implementation_name == 'cpython'"} importlib-metadata = {version = "^1.0", python = "<3.8"} -mkdocs = {version = "^1.1.2", optional = true, markers = "implementation_name = 'cpython'"} -mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "implementation_name = 'cpython'"} +mkdocs = {version = "^1.1.2", optional = true, markers = "implementation_name == 'cpython'"} +mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "implementation_name == 'cpython'"} [tool.poetry.dev-dependencies] pytest = "^6.0" pytest-cov = "^2.10.1" -mkdocs = {version = "^1.1.2", markers = "implementation_name = 'cpython'"} -mktheapidocs = {extras = ["plugin"], version = "^0.2.0", markers = "implementation_name = 'cpython'"} -black = {version = "^19.10b0", markers = "implementation_name = 'cpython'"} +mkdocs = {version = "^1.1.2", markers = "implementation_name == 'cpython'"} +mktheapidocs = {extras = ["plugin"], version = "^0.2.0", markers = "implementation_name == 'cpython'"} +black = {version = "^19.10b0", markers = "implementation_name == 'cpython'"} [tool.poetry.extras] mkdocs = ["mkdocs"] From 0beebdc2e2321500f6e1bb13afb03d0eeb9a9d16 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 10:30:34 -0400 Subject: [PATCH 09/49] Debug pypy version --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 34bc47b..b0bb736 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,14 +28,15 @@ jobs: python -m pip install --upgrade pip #python -m pip install poetry # Only install poetry like this in containers python -m pip install --no-warn-script-location --user --pre poetry -U # Temporary: https://github.com/python-poetry/poetry/issues/2711 - python -m pip install --no-warn-script-location --user --pre poetry-core -U # Temporary: https://github.com/python-poetry/poetry/issues/2711 - name: Run poetry shell: bash -l {0} run: | python -m poetry build python -m poetry install - python -m poetry run pytest --cov --cov-branch --cov-report=xml + echo "Python version: $(python --version)" # Debug + echo "Poetry python version: $(python -m poetry run python --version)" # Debug + python -m poetry run python -m pytest --cov --cov-branch --cov-report=xml - name: Upload coverage if: "matrix.python-version == 3.8 && matrix.os == 'ubuntu-latest'" From 2460b9f8c82e6232b8711e3b52669636f55d281a Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 10:30:44 -0400 Subject: [PATCH 10/49] Try to hack pypy jit a little more --- quaternionic/utilities.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/quaternionic/utilities.py b/quaternionic/utilities.py index 958c36e..4dd229b 100644 --- a/quaternionic/utilities.py +++ b/quaternionic/utilities.py @@ -194,7 +194,12 @@ def pyguvectorize_module_functions(module, obj): if platform.python_implementation().lower() == 'pypy': - float64, boolean = [float], [bool] + float64 = type('nbfloat64', (object,), { + 'name': 'float64', 'dtype': self, '__getitem__': lambda self, *args: self + }) + boolean = type('nbboolean', (object,), { + 'name': 'boolean', 'dtype': self, '__getitem__': lambda self, *args: return self + }) jit = lambda f: f guvectorize = pyguvectorize else: From d7db1abdd6aa4fcbcf36ed6234e853816b1405f2 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 10:33:49 -0400 Subject: [PATCH 11/49] Remove errant return --- quaternionic/utilities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quaternionic/utilities.py b/quaternionic/utilities.py index 4dd229b..452591a 100644 --- a/quaternionic/utilities.py +++ b/quaternionic/utilities.py @@ -198,7 +198,7 @@ def pyguvectorize_module_functions(module, obj): 'name': 'float64', 'dtype': self, '__getitem__': lambda self, *args: self }) boolean = type('nbboolean', (object,), { - 'name': 'boolean', 'dtype': self, '__getitem__': lambda self, *args: return self + 'name': 'boolean', 'dtype': self, '__getitem__': lambda self, *args: self }) jit = lambda f: f guvectorize = pyguvectorize From ba19bd0fc0419d0465d62640b64d7ba1780c3817 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 10:49:45 -0400 Subject: [PATCH 12/49] Remove pypy from build matrix; add py27 and py35 --- .github/workflows/build.yml | 4 ++-- pyproject.toml | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0bb736..79124a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.6, 3.7, 3.8, pypy3] + python-version: [2.7, 3.5, 3.6, 3.7, 3.8] steps: - name: Check out code @@ -36,7 +36,7 @@ jobs: python -m poetry install echo "Python version: $(python --version)" # Debug echo "Poetry python version: $(python -m poetry run python --version)" # Debug - python -m poetry run python -m pytest --cov --cov-branch --cov-report=xml + python -m poetry run pytest --cov --cov-branch --cov-report=xml - name: Upload coverage if: "matrix.python-version == 3.8 && matrix.os == 'ubuntu-latest'" diff --git a/pyproject.toml b/pyproject.toml index 6f419aa..97d58f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,19 +9,22 @@ homepage = "https://github.com/moble/quaternionic" [tool.poetry.dependencies] python = "^3.6" +importlib-metadata = {version = "^1.0", python = "<3.8"} numpy = "^1.13" scipy = "^1.0" -numba = {version = "^0.50", markers = "implementation_name == 'cpython'"} -importlib-metadata = {version = "^1.0", python = "<3.8"} +numba = [ + {version = ">=0.50", python = ">=3.6", markers = "implementation_name == 'cpython'"}, + {version = "<0.49", python = "<3.6", markers = "implementation_name == 'cpython'"} +] mkdocs = {version = "^1.1.2", optional = true, markers = "implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "implementation_name == 'cpython'"} [tool.poetry.dev-dependencies] pytest = "^6.0" pytest-cov = "^2.10.1" -mkdocs = {version = "^1.1.2", markers = "implementation_name == 'cpython'"} -mktheapidocs = {extras = ["plugin"], version = "^0.2.0", markers = "implementation_name == 'cpython'"} -black = {version = "^19.10b0", markers = "implementation_name == 'cpython'"} +mkdocs = {version = "^1.1.2", python = ">=3.6", markers = "implementation_name == 'cpython'"} +mktheapidocs = {extras = ["plugin"], python = ">=3.6", version = "^0.2.0", markers = "implementation_name == 'cpython'"} +black = {version = "^19.10b0", python = ">=3.6", markers = "implementation_name == 'cpython'"} [tool.poetry.extras] mkdocs = ["mkdocs"] From be2fce38f2e7c026845d5e7aa9748172511bd1c5 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 11:03:18 -0400 Subject: [PATCH 13/49] Create FakeNumbaType for pypy --- quaternionic/utilities.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/quaternionic/utilities.py b/quaternionic/utilities.py index 452591a..038b293 100644 --- a/quaternionic/utilities.py +++ b/quaternionic/utilities.py @@ -194,12 +194,16 @@ def pyguvectorize_module_functions(module, obj): if platform.python_implementation().lower() == 'pypy': - float64 = type('nbfloat64', (object,), { - 'name': 'float64', 'dtype': self, '__getitem__': lambda self, *args: self - }) - boolean = type('nbboolean', (object,), { - 'name': 'boolean', 'dtype': self, '__getitem__': lambda self, *args: self - }) + class _FakeNumbaType(object): + def __init__(self, name): + self.name = name + @property + def dtype(self): + return self + def __getitem__(self, *args, **kwargs): + return self + float64 = _FakeNumbaType('float64') + boolean = _FakeNumbaType('boolean') jit = lambda f: f guvectorize = pyguvectorize else: From c58419a5c6de6b2dd0cf7e49da9690c52f83ebce Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 11:03:51 -0400 Subject: [PATCH 14/49] Move python dependency inside environment markers --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 97d58f8..6d48f3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,13 +8,13 @@ authors = ["Michael Boyle "] homepage = "https://github.com/moble/quaternionic" [tool.poetry.dependencies] -python = "^3.6" +#python = "^3.6" importlib-metadata = {version = "^1.0", python = "<3.8"} numpy = "^1.13" scipy = "^1.0" numba = [ - {version = ">=0.50", python = ">=3.6", markers = "implementation_name == 'cpython'"}, - {version = "<0.49", python = "<3.6", markers = "implementation_name == 'cpython'"} + {version = ">=0.50", markers = "python_version >= '3.6' and implementation_name == 'cpython'"}, + {version = "<0.49", markers = "python_version < '3.6' and implementation_name == 'cpython'"} ] mkdocs = {version = "^1.1.2", optional = true, markers = "implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "implementation_name == 'cpython'"} From 45881b98e9e7f496cdcbc2c43a0cd6495a4784a4 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 11:03:58 -0400 Subject: [PATCH 15/49] Run on everything --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 79124a4..4a0315a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [2.7, 3.5, 3.6, 3.7, 3.8] + python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] steps: - name: Check out code From 3d82274c0122a776ee626102fc9744382a51a4b5 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 11:06:54 -0400 Subject: [PATCH 16/49] Show python version in job name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a0315a..f4d9728 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: build: - name: Build and test on ${{ matrix.os }} + name: Test on ${{ matrix.os }} python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')" strategy: From 889b628900abd5aca6803ec3e2decd15c8dbedaa Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 11:10:03 -0400 Subject: [PATCH 17/49] Add python_version markers for mk*docs --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6d48f3c..c74e343 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,15 +16,15 @@ numba = [ {version = ">=0.50", markers = "python_version >= '3.6' and implementation_name == 'cpython'"}, {version = "<0.49", markers = "python_version < '3.6' and implementation_name == 'cpython'"} ] -mkdocs = {version = "^1.1.2", optional = true, markers = "implementation_name == 'cpython'"} -mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "implementation_name == 'cpython'"} +mkdocs = {version = "^1.1.2", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} +mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} [tool.poetry.dev-dependencies] pytest = "^6.0" pytest-cov = "^2.10.1" -mkdocs = {version = "^1.1.2", python = ">=3.6", markers = "implementation_name == 'cpython'"} -mktheapidocs = {extras = ["plugin"], python = ">=3.6", version = "^0.2.0", markers = "implementation_name == 'cpython'"} -black = {version = "^19.10b0", python = ">=3.6", markers = "implementation_name == 'cpython'"} +mkdocs = {version = "^1.1.2", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} +mktheapidocs = {extras = ["plugin"], version = "^0.2.0", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} +black = {version = "^19.10b0", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} [tool.poetry.extras] mkdocs = ["mkdocs"] From ebebd4a82d74de586ee29f93468d83af3dd7b7f3 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 11:18:55 -0400 Subject: [PATCH 18/49] Show info about python versions --- .github/workflows/test_python_versions.yml | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/test_python_versions.yml diff --git a/.github/workflows/test_python_versions.yml b/.github/workflows/test_python_versions.yml new file mode 100644 index 0000000..d7d1b6c --- /dev/null +++ b/.github/workflows/test_python_versions.yml @@ -0,0 +1,27 @@ +name: test_python_versions + +on: [push, pull_request] + +jobs: + build: + name: Test on ${{ matrix.os }} python ${{ matrix.python-version }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] + + steps: + - name: Set up python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Check versions + shell: bash -l {0} + run: | + python --version + python -c 'import sys; print(sys.implementation.name)' + type -a python + find -L $(echo $PATH | tr ":" " ") -iname 'python*' -type f \(-perm -001 -or \( -perm -100 -and -user $(whoami)\) \) -print From 80bb90ddd9d1477a323acacad680bb1f73029957 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 11:26:20 -0400 Subject: [PATCH 19/49] Disable momentarily --- .github/workflows/build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4d9728..a19b8b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,8 @@ name: tests -on: [push, pull_request] +on: + branch: notmaster +# on: [push, pull_request] jobs: build: @@ -12,6 +14,11 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] + # exclude: + # - os: macos-latest + # python-version: 3.8 + # - os: windows-latest + # python-version: 3.6 steps: - name: Check out code From ec5e68288de067e82d64f3728005fea064c3bcf6 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 11:26:29 -0400 Subject: [PATCH 20/49] Test more ways of calling python --- .github/workflows/test_python_versions.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_python_versions.yml b/.github/workflows/test_python_versions.yml index d7d1b6c..bd82421 100644 --- a/.github/workflows/test_python_versions.yml +++ b/.github/workflows/test_python_versions.yml @@ -18,10 +18,24 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Check versions + - name: Check versions without bash + run: | + echo "Without bash:" + python --version + python -c 'import platform; print(platform.python_implementation())' + + - name: Check versions without login + shell: bash + run: | + echo "Without login:" + python --version + python -c 'import platform; print(platform.python_implementation())' + type -a python + + - name: Check versions with login shell: bash -l {0} run: | + echo "With login:" python --version - python -c 'import sys; print(sys.implementation.name)' + python -c 'import platform; print(platform.python_implementation())' type -a python - find -L $(echo $PATH | tr ":" " ") -iname 'python*' -type f \(-perm -001 -or \( -perm -100 -and -user $(whoami)\) \) -print From 92890ed34be5c8c99f1c339be03519273a84dea5 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 11:47:48 -0400 Subject: [PATCH 21/49] Remove -l {0} from bash commmand --- .github/workflows/build.yml | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a19b8b7..c894ab8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,8 @@ name: tests -on: - branch: notmaster -# on: [push, pull_request] +# on: +# branch: notmaster +on: [push, pull_request] jobs: build: @@ -15,10 +15,8 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] # exclude: - # - os: macos-latest - # python-version: 3.8 # - os: windows-latest - # python-version: 3.6 + # python-version: pypy3 steps: - name: Check out code @@ -30,24 +28,20 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install poetry - shell: bash -l {0} run: | python -m pip install --upgrade pip #python -m pip install poetry # Only install poetry like this in containers python -m pip install --no-warn-script-location --user --pre poetry -U # Temporary: https://github.com/python-poetry/poetry/issues/2711 - name: Run poetry - shell: bash -l {0} run: | python -m poetry build python -m poetry install - echo "Python version: $(python --version)" # Debug - echo "Poetry python version: $(python -m poetry run python --version)" # Debug python -m poetry run pytest --cov --cov-branch --cov-report=xml - name: Upload coverage if: "matrix.python-version == 3.8 && matrix.os == 'ubuntu-latest'" - shell: bash -l {0} + shell: bash run: | bash <(curl -s https://codecov.io/bash) @@ -68,7 +62,6 @@ jobs: python-version: 3.8 - name: Install poetry and this package - shell: bash -l {0} run: | python -m pip install --upgrade pip python -m pip install toml @@ -78,7 +71,7 @@ jobs: python -m poetry install - name: Bump version - shell: bash -l {0} + shell: bash run: | export version_bump_rule=$(echo ${{ github.event.head_commit.message }} | python .github/scripts/parse_bump_rule.py ) echo "version_bump_rule: '${version_bump_rule}'" @@ -88,7 +81,7 @@ jobs: echo "::set-env name=new_version_tag::v${new_version}" # Save env variable for later steps - name: Tag and push new version - shell: bash -l {0} + shell: bash run: | git config user.name github-actions git config user.email github-actions@github.com @@ -112,10 +105,9 @@ jobs: - name: Publish to PyPI if: "!contains(github.event.head_commit.message, '[no pypi]')" - shell: bash -l {0} env: - # Get key from https://pypi.org/manage/account/token/, and - # copy it to Github > repo > Settings > Secrets + # 1) Get key from https://pypi.org/manage/account/token/ + # 2) Copy it to Github > repo > Settings > Secrets POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} run: | python -m poetry build From 7c0359ed23da073046b3901d780e1e797aff80f9 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 11:47:58 -0400 Subject: [PATCH 22/49] Show PATH --- .github/workflows/test_python_versions.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_python_versions.yml b/.github/workflows/test_python_versions.yml index bd82421..788edc7 100644 --- a/.github/workflows/test_python_versions.yml +++ b/.github/workflows/test_python_versions.yml @@ -20,22 +20,21 @@ jobs: - name: Check versions without bash run: | - echo "Without bash:" python --version python -c 'import platform; print(platform.python_implementation())' - name: Check versions without login shell: bash run: | - echo "Without login:" python --version python -c 'import platform; print(platform.python_implementation())' type -a python + echo "PATH=${PATH}" - name: Check versions with login shell: bash -l {0} run: | - echo "With login:" python --version python -c 'import platform; print(platform.python_implementation())' type -a python + echo "PATH=${PATH}" From 594d9b6c0440f725952d613c2227b6f04718a6aa Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 12:16:22 -0400 Subject: [PATCH 23/49] Require older pytest for older pythons --- pyproject.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c74e343..d2b2906 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,8 +20,11 @@ mkdocs = {version = "^1.1.2", optional = true, markers = "python_version >= '3.6 mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} [tool.poetry.dev-dependencies] -pytest = "^6.0" -pytest-cov = "^2.10.1" +pytest = [ + {version = "<6.0", python = "<3.6"}, + {version = ">=6.0", python = ">=3.6"} +] +pytest-cov = ">=2.10.1" mkdocs = {version = "^1.1.2", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} black = {version = "^19.10b0", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} From bdd6f4ee4facdca4cec178f783c8c7d969aa1230 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 12:16:51 -0400 Subject: [PATCH 24/49] Shorten build names so I can see python version --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c894ab8..47ada48 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,12 +1,13 @@ name: tests # on: -# branch: notmaster +# branch: notarealbranch # To disable temporarily + on: [push, pull_request] jobs: build: - name: Test on ${{ matrix.os }} python ${{ matrix.python-version }} + name: ${{ matrix.os }} python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')" strategy: From 29ec0df8ad9e1987d4d8b26db9e0c6b1a19909ae Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 12:27:13 -0400 Subject: [PATCH 25/49] Fail on unexpected python version --- .github/workflows/test_python_versions.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_python_versions.yml b/.github/workflows/test_python_versions.yml index 788edc7..da41239 100644 --- a/.github/workflows/test_python_versions.yml +++ b/.github/workflows/test_python_versions.yml @@ -13,7 +13,7 @@ jobs: python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] steps: - - name: Set up python ${{ matrix.python-version }} + - name: ${{ matrix.os }} python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} @@ -38,3 +38,11 @@ jobs: python -c 'import platform; print(platform.python_implementation())' type -a python echo "PATH=${PATH}" + + - name: Bubble problems up to github actions + shell: bash -l {0} + run: | + py_ver="${{ matrix.python-version }}" + if [ $py_ver == "pypy2" ]; then py_ver="2.7"; fi + if [ $py_ver == "pypy3" ]; then py_ver="3.6"; fi + (echo 'import sys'; echo 'if "{0}.{1}".format(sys.version_info.major, sys.version_info.minor)!="${py_ver}": raise ValueError()') | python From 26103b2180bb0de0028983ad7134efe15fe7886b Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 12:35:15 -0400 Subject: [PATCH 26/49] Show os and python version --- .github/workflows/test_python_versions.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_python_versions.yml b/.github/workflows/test_python_versions.yml index da41239..cfadd7b 100644 --- a/.github/workflows/test_python_versions.yml +++ b/.github/workflows/test_python_versions.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: build: - name: Test on ${{ matrix.os }} python ${{ matrix.python-version }} + name: ${{ matrix.os }} python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -13,7 +13,7 @@ jobs: python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] steps: - - name: ${{ matrix.os }} python ${{ matrix.python-version }} + - name: Install python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} @@ -45,4 +45,4 @@ jobs: py_ver="${{ matrix.python-version }}" if [ $py_ver == "pypy2" ]; then py_ver="2.7"; fi if [ $py_ver == "pypy3" ]; then py_ver="3.6"; fi - (echo 'import sys'; echo 'if "{0}.{1}".format(sys.version_info.major, sys.version_info.minor)!="${py_ver}": raise ValueError()') | python + (echo "from sys import version_info as vi"; echo "v='{0}.{1}'.format(vi.major, vi.minor)"; echo "if v!='${py_ver}': raise ValueError(v)") | python From 9d5a80182f3f2cb404a4e64701b97182b8024e9b Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 12:41:42 -0400 Subject: [PATCH 27/49] Just use which to check path --- .github/workflows/test_python_versions.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test_python_versions.yml b/.github/workflows/test_python_versions.yml index cfadd7b..a388763 100644 --- a/.github/workflows/test_python_versions.yml +++ b/.github/workflows/test_python_versions.yml @@ -38,11 +38,5 @@ jobs: python -c 'import platform; print(platform.python_implementation())' type -a python echo "PATH=${PATH}" - - - name: Bubble problems up to github actions - shell: bash -l {0} - run: | - py_ver="${{ matrix.python-version }}" - if [ $py_ver == "pypy2" ]; then py_ver="2.7"; fi - if [ $py_ver == "pypy3" ]; then py_ver="3.6"; fi - (echo "from sys import version_info as vi"; echo "v='{0}.{1}'.format(vi.major, vi.minor)"; echo "if v!='${py_ver}': raise ValueError(v)") | python + which python + if [[ $(which python) != *"hostedtoolcache"* ]]; then exit 1; fi From e6dd51820e9a18f334c16129f417a1ed0758cb54 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 12:46:56 -0400 Subject: [PATCH 28/49] Simplify testing python versions --- .github/workflows/test_python_versions.yml | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test_python_versions.yml b/.github/workflows/test_python_versions.yml index a388763..7966647 100644 --- a/.github/workflows/test_python_versions.yml +++ b/.github/workflows/test_python_versions.yml @@ -18,25 +18,10 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Check versions without bash - run: | - python --version - python -c 'import platform; print(platform.python_implementation())' - - - name: Check versions without login - shell: bash - run: | - python --version - python -c 'import platform; print(platform.python_implementation())' - type -a python - echo "PATH=${PATH}" - - name: Check versions with login shell: bash -l {0} run: | python --version - python -c 'import platform; print(platform.python_implementation())' - type -a python - echo "PATH=${PATH}" - which python - if [[ $(which python) != *"hostedtoolcache"* ]]; then exit 1; fi + echo "which python = $(which python)" + echo "RUNNER_TOOL_CACHE = ${RUNNER_TOOL_CACHE}" + if [[ $(which python) != *"${RUNNER_TOOL_CACHE}"* ]]; then exit 1; fi From 90640ba9204a787249a273cd45426654c8b3f220 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 12:48:18 -0400 Subject: [PATCH 29/49] Workaround for windows --- .github/workflows/test_python_versions.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test_python_versions.yml b/.github/workflows/test_python_versions.yml index 7966647..e736530 100644 --- a/.github/workflows/test_python_versions.yml +++ b/.github/workflows/test_python_versions.yml @@ -23,5 +23,4 @@ jobs: run: | python --version echo "which python = $(which python)" - echo "RUNNER_TOOL_CACHE = ${RUNNER_TOOL_CACHE}" - if [[ $(which python) != *"${RUNNER_TOOL_CACHE}"* ]]; then exit 1; fi + if [[ $(which python) != *"hostedtoolcache"* ]]; then exit 1; fi From 7e0f53a67e1916985cd49ddb7e2acddb7aa2bfd2 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 13:10:45 -0400 Subject: [PATCH 30/49] Remove old comment --- .github/workflows/build.yml | 3 --- .github/workflows/test_python_versions.yml | 26 ---------------------- 2 files changed, 29 deletions(-) delete mode 100644 .github/workflows/test_python_versions.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 47ada48..c36dd39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,5 @@ name: tests -# on: -# branch: notarealbranch # To disable temporarily - on: [push, pull_request] jobs: diff --git a/.github/workflows/test_python_versions.yml b/.github/workflows/test_python_versions.yml deleted file mode 100644 index e736530..0000000 --- a/.github/workflows/test_python_versions.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: test_python_versions - -on: [push, pull_request] - -jobs: - build: - name: ${{ matrix.os }} python ${{ matrix.python-version }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] - - steps: - - name: Install python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Check versions with login - shell: bash -l {0} - run: | - python --version - echo "which python = $(which python)" - if [[ $(which python) != *"hostedtoolcache"* ]]; then exit 1; fi From 88816324af224a84556173bc6303d418d9134212 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 13:17:52 -0400 Subject: [PATCH 31/49] Specify more constraints for old pythons --- pyproject.toml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d2b2906..8c750ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,8 +10,14 @@ homepage = "https://github.com/moble/quaternionic" [tool.poetry.dependencies] #python = "^3.6" importlib-metadata = {version = "^1.0", python = "<3.8"} -numpy = "^1.13" -scipy = "^1.0" +numpy = [ + {version = ">=1.13,<=1.16", python = "<3.6"}, + {version = ">=1.13", python = ">=3.6"} +] +scipy = [ + {version = ">=1.0,<=1.2", python = "<3.6"}, + {version = ">=1.0", python = ">=3.6"} +] numba = [ {version = ">=0.50", markers = "python_version >= '3.6' and implementation_name == 'cpython'"}, {version = "<0.49", markers = "python_version < '3.6' and implementation_name == 'cpython'"} From beb1a2e13d4fedf4e360958d9470383da314ff1e Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 13:23:11 -0400 Subject: [PATCH 32/49] Run poetry update for compatibility on older pythons --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c36dd39..bf365fd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,6 +33,7 @@ jobs: - name: Run poetry run: | + python -m poetry update python -m poetry build python -m poetry install python -m poetry run pytest --cov --cov-branch --cov-report=xml From dbab31060a09905c2078296fcea8fe29266f1c16 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 13:27:30 -0400 Subject: [PATCH 33/49] Drop python 3.4; remove multiple-constraint deps --- pyproject.toml | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8c750ba..3f6b5c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,29 +8,17 @@ authors = ["Michael Boyle "] homepage = "https://github.com/moble/quaternionic" [tool.poetry.dependencies] -#python = "^3.6" +python = ">=2.7,<2.8 || >=3.5" importlib-metadata = {version = "^1.0", python = "<3.8"} -numpy = [ - {version = ">=1.13,<=1.16", python = "<3.6"}, - {version = ">=1.13", python = ">=3.6"} -] -scipy = [ - {version = ">=1.0,<=1.2", python = "<3.6"}, - {version = ">=1.0", python = ">=3.6"} -] -numba = [ - {version = ">=0.50", markers = "python_version >= '3.6' and implementation_name == 'cpython'"}, - {version = "<0.49", markers = "python_version < '3.6' and implementation_name == 'cpython'"} -] +numpy = ">=1.13" +scipy = ">=1.0" +numba mkdocs = {version = "^1.1.2", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} [tool.poetry.dev-dependencies] -pytest = [ - {version = "<6.0", python = "<3.6"}, - {version = ">=6.0", python = ">=3.6"} -] -pytest-cov = ">=2.10.1" +pytest +pytest-cov mkdocs = {version = "^1.1.2", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} black = {version = "^19.10b0", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} From 81482a9125445c0bb2142349c196631af4533701 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 13:29:32 -0400 Subject: [PATCH 34/49] Include * versions for poetry --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3f6b5c7..d7fcd0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,13 +12,13 @@ python = ">=2.7,<2.8 || >=3.5" importlib-metadata = {version = "^1.0", python = "<3.8"} numpy = ">=1.13" scipy = ">=1.0" -numba +numba = "*" mkdocs = {version = "^1.1.2", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} [tool.poetry.dev-dependencies] -pytest -pytest-cov +pytest = "*" +pytest-cov = "*" mkdocs = {version = "^1.1.2", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} black = {version = "^19.10b0", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} From dc8a823ac8cdb19a3675998634028613a513b904 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 13:40:13 -0400 Subject: [PATCH 35/49] Restrict numba again for older pythons --- pyproject.toml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d7fcd0b..437fc18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,10 @@ python = ">=2.7,<2.8 || >=3.5" importlib-metadata = {version = "^1.0", python = "<3.8"} numpy = ">=1.13" scipy = ">=1.0" -numba = "*" +numba = [ + {version = "<0.49.0", python = "<3.6"}, + {version = ">=0.50.0", python = ">=3.6"}, +] mkdocs = {version = "^1.1.2", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} @@ -37,10 +40,6 @@ norecursedirs = ".* build dist *.egg-info install ENV" junit_family="xunit2" addopts = "-v --tb=short --doctest-glob='' --cov --cov-branch --cov-report xml" -# [build-system] -# requires = ["poetry>=1.0.10"] -# build-backend = "poetry.masonry.api" - [build-system] requires = ["poetry-core>=1.0.0a6"] build-backend = "poetry.core.masonry.api" From 6d07ec92cbaa65a5cf53e5796dad12aed7242bef Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 13:47:34 -0400 Subject: [PATCH 36/49] Specify llvmlite versions for older pythons --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 437fc18..59ec189 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,10 @@ numba = [ {version = "<0.49.0", python = "<3.6"}, {version = ">=0.50.0", python = ">=3.6"}, ] +llvmlite = [ + {version = "<0.32.0", python = "<3.6"}, + {version = "*", python = ">=3.6"}, +] mkdocs = {version = "^1.1.2", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} From b8786722ad714a96139a2f01eac78905b18600d0 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 13:48:05 -0400 Subject: [PATCH 37/49] Temporarily skip working builds --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf365fd..82f0a6b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] + python-version: [2.7, 3.5, pypy2] #, 3.6, 3.7, 3.8, pypy2, pypy3] # exclude: # - os: windows-latest # python-version: pypy3 From 9229613dcffaca69c59174207a507706876b8f2d Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 13:52:32 -0400 Subject: [PATCH 38/49] Remove poetry.lock, in case that's what screws up the solver --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 82f0a6b..486eec6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,7 +33,7 @@ jobs: - name: Run poetry run: | - python -m poetry update + rm poetry.lock python -m poetry build python -m poetry install python -m poetry run pytest --cov --cov-branch --cov-report=xml From b33b68edff90f77e7d0be4286b5e271a813a1b67 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 13:57:48 -0400 Subject: [PATCH 39/49] Allow any version of numba; keep restricted versions of llvmlite --- pyproject.toml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 59ec189..bbec6bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,13 +12,10 @@ python = ">=2.7,<2.8 || >=3.5" importlib-metadata = {version = "^1.0", python = "<3.8"} numpy = ">=1.13" scipy = ">=1.0" -numba = [ - {version = "<0.49.0", python = "<3.6"}, - {version = ">=0.50.0", python = ">=3.6"}, -] +numba = "*" llvmlite = [ {version = "<0.32.0", python = "<3.6"}, - {version = "*", python = ">=3.6"}, + {version = "*", python = ">=3.6"} ] mkdocs = {version = "^1.1.2", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} From 71c673892c85e520a073bb34f786a35011b34d13 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 14:06:17 -0400 Subject: [PATCH 40/49] Remove a few f-strings; they're the only py36 feature and don't matter that much --- quaternionic/arrays.py | 14 ++++++++------ tests/test_array.py | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/quaternionic/arrays.py b/quaternionic/arrays.py index 63b762f..593afcb 100644 --- a/quaternionic/arrays.py +++ b/quaternionic/arrays.py @@ -78,7 +78,7 @@ def __new__(cls, input_array, *args, **kwargs): raise ValueError("len(input_array.shape) == 0") if input_array.shape[-1] != 4: raise ValueError( - f"\nInput array has shape {input_array.shape} when viewed as a float array.\n" + "\nInput array has shape {0} when viewed as a float array.\n".format(input_array.shape) + "Its last dimension should have size 4, representing the components of a quaternion." ) obj = input_array.view(cls) @@ -95,7 +95,7 @@ def __getitem__(self, i): def __array_finalize__(self, obj): if self.shape[-1] != 4: raise ValueError( - f"\nArray to finalize has shape {self.shape}; " + "\nArray to finalize has shape {0}; ".format(self.shape) + "last dimension should have size 4 to represent a quaternion.\n" "If you are trying to slice the quaternions, you should append `.ndarray` before slicing.\n" "For example, instead of `q[..., 2:]`, you must use `q.ndarray[..., 2:]` to return a\n" @@ -111,10 +111,12 @@ def __array_ufunc__(self, ufunc, method, *args, **kwargs): # We will not be supporting any more ufunc keywords beyond `out` if kwargs: - raise NotImplementedError(f"Unrecognized arguments to {type(self).__name__}.__array_ufunc__: {kwargs}") + raise NotImplementedError( + "Unrecognized arguments to {0}.__array_ufunc__: {1}".format(type(self).__name__, kwargs) + ) if method in ["reduce", "accumulate", "reduceat", "outer", "at"]: - raise NotImplementedError(f"Only __call__ method works for quaternionic arrays") + raise NotImplementedError("Only __call__ method works for quaternionic arrays") this_type = lambda o: isinstance(o, type(self)) @@ -146,7 +148,7 @@ def __array_ufunc__(self, ufunc, method, *args, **kwargs): result = result[0] if isinstance(result, type(self)): result = result.view(np.ndarray) - getattr(algebra, f"{ufunc.__name__}_scalar")(a1, a2.ndarray, result) + getattr(algebra, "{0}_scalar".format(ufunc.__name__))(a1, a2.ndarray, result) result = type(self)(result) # float64[4](float64[4], float64) @@ -160,7 +162,7 @@ def __array_ufunc__(self, ufunc, method, *args, **kwargs): result = result[0] if isinstance(result, type(self)): result = result.view(np.ndarray) - getattr(algebra, f"scalar_{ufunc.__name__}")(a1.ndarray, a2, result) + getattr(algebra, "scalar_{0}".format(ufunc.__name__))(a1.ndarray, a2, result) result = type(self)(result) else: return NotImplemented diff --git a/tests/test_array.py b/tests/test_array.py index 6d90adf..bebbb2a 100644 --- a/tests/test_array.py +++ b/tests/test_array.py @@ -196,7 +196,7 @@ def test_array_ufunc(array): with pytest.raises(TypeError): attr(p, q) else: # pragma: no cover - raise ValueError(f"Unexpected number of input arguments for {k}") + raise ValueError("Unexpected number of input arguments for {0}".format(k)) def test_repr(array): From 118dab899f8b3b627d386773f452538d804455ff Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 14:07:04 -0400 Subject: [PATCH 41/49] Remove one more py36 feature that doesn't matter --- quaternionic/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quaternionic/__init__.py b/quaternionic/__init__.py index 9c1a9bd..e678b7f 100644 --- a/quaternionic/__init__.py +++ b/quaternionic/__init__.py @@ -4,7 +4,7 @@ try: import importlib.metadata as importlib_metadata -except ModuleNotFoundError: # pragma: no cover +except ImportError: # pragma: no cover import importlib_metadata __version__ = importlib_metadata.version(__name__) From 7327db4dd46b031a10a52f1c4f27605a3323284d Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 14:08:53 -0400 Subject: [PATCH 42/49] Restrict llmvlite and numba to cpython --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bbec6bd..ea8b573 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,10 +12,10 @@ python = ">=2.7,<2.8 || >=3.5" importlib-metadata = {version = "^1.0", python = "<3.8"} numpy = ">=1.13" scipy = ">=1.0" -numba = "*" +numba = {version = "*", markers = "implementation_name == 'cpython'"} llvmlite = [ - {version = "<0.32.0", python = "<3.6"}, - {version = "*", python = ">=3.6"} + {version = "<0.32.0", markers = "python_version < '3.6' and implementation_name == 'cpython'"}, + {version = "*", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} ] mkdocs = {version = "^1.1.2", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} From 8ee39f5aaf019faa86c615bba1cf3fbe36b7d280 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 14:18:17 -0400 Subject: [PATCH 43/49] Specify encoding for python 2 --- quaternionic/__init__.py | 2 ++ quaternionic/algebra.py | 2 ++ quaternionic/arrays.py | 2 ++ quaternionic/converters.py | 2 ++ quaternionic/distance.py | 2 ++ quaternionic/properties.py | 2 ++ quaternionic/time_series.py | 2 ++ quaternionic/utilities.py | 2 ++ 8 files changed, 16 insertions(+) diff --git a/quaternionic/__init__.py b/quaternionic/__init__.py index e678b7f..b74e7e7 100644 --- a/quaternionic/__init__.py +++ b/quaternionic/__init__.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright (c) 2020, Michael Boyle # See LICENSE file for details: # diff --git a/quaternionic/algebra.py b/quaternionic/algebra.py index 32114bf..979e8f2 100644 --- a/quaternionic/algebra.py +++ b/quaternionic/algebra.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright (c) 2020, Michael Boyle # See LICENSE file for details: # diff --git a/quaternionic/arrays.py b/quaternionic/arrays.py index 593afcb..ebe7fe3 100644 --- a/quaternionic/arrays.py +++ b/quaternionic/arrays.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright (c) 2020, Michael Boyle # See LICENSE file for details: # diff --git a/quaternionic/converters.py b/quaternionic/converters.py index 836018f..73f5cd3 100644 --- a/quaternionic/converters.py +++ b/quaternionic/converters.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright (c) 2020, Michael Boyle # See LICENSE file for details: # diff --git a/quaternionic/distance.py b/quaternionic/distance.py index e72ec61..f978ba5 100644 --- a/quaternionic/distance.py +++ b/quaternionic/distance.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright (c) 2020, Michael Boyle # See LICENSE file for details: # diff --git a/quaternionic/properties.py b/quaternionic/properties.py index b9e7ef5..65eab92 100644 --- a/quaternionic/properties.py +++ b/quaternionic/properties.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright (c) 2020, Michael Boyle # See LICENSE file for details: # diff --git a/quaternionic/time_series.py b/quaternionic/time_series.py index 48a7744..9034a5d 100644 --- a/quaternionic/time_series.py +++ b/quaternionic/time_series.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright (c) 2020, Michael Boyle # See LICENSE file for details: # diff --git a/quaternionic/utilities.py b/quaternionic/utilities.py index 038b293..e15f795 100644 --- a/quaternionic/utilities.py +++ b/quaternionic/utilities.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright (c) 2020, Michael Boyle # See LICENSE file for details: # From b7be4edd47ffee307e13fc0a4e7714e69839272f Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 14:21:18 -0400 Subject: [PATCH 44/49] Change 10_000 to 10000 --- tests/test_array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_array.py b/tests/test_array.py index bebbb2a..0b60373 100644 --- a/tests/test_array.py +++ b/tests/test_array.py @@ -362,7 +362,7 @@ def test_quaternion_sqrt(Qs, Q_names, Q_conditions, array): assert np.allclose(np.sqrt(srq) * np.sqrt(srq), srq, rtol=sqrt_precision) # Test a huge batch of random quaternions np.random.seed(1234) - a = array(np.random.uniform(-10, 10, size=10_000*4).reshape((-1, 4))) + a = array(np.random.uniform(-10, 10, size=10000*4).reshape((-1, 4))) assert np.allclose(a, np.square(np.sqrt(a)), rtol=10*sqrt_precision, atol=0) # Test some edge cases _quaternion_resolution = 10 * np.finfo(float).resolution From 96ddef6b44f5d73600878c071bcbc9f0f0085da0 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 14:45:32 -0400 Subject: [PATCH 45/49] More conservative wraps decorator --- quaternionic/utilities.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/quaternionic/utilities.py b/quaternionic/utilities.py index e15f795..18d761d 100644 --- a/quaternionic/utilities.py +++ b/quaternionic/utilities.py @@ -12,9 +12,29 @@ ] +def update_wrapper(wrapper, wrapped, assigned=functools.WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES): + for attr in assigned: + try: + value = getattr(wrapped, attr) + except AttributeError: + pass + else: + if hasattr(wrapper, attr): + setattr(wrapper, attr, value) + for attr in updated: + if hasattr(wrapper, attr): + getattr(wrapper, attr).update(getattr(wrapped, attr, {})) + wrapper.__wrapped__ = wrapped + return wrapper + + +def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES): + return functools.partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated) + + def type_self_return(f): """Decorate jitted functions to return with type of first argument""" - @functools.wraps(f) + @wraps(f) def f_wrapped(*args, **kwargs): return_value = f(*args, **kwargs) return type(args[0])(return_value) @@ -26,7 +46,7 @@ def f_wrapped(*args, **kwargs): def ndarray_args(f): """Decorate jitted functions to accept quaternionic arrays""" - @functools.wraps(f) + @wraps(f) def f_wrapped(*args, **kwargs): args_ndarray = (arg if not hasattr(arg, 'ndarray') else arg.ndarray for arg in args) return f(*args_ndarray, **kwargs) @@ -38,7 +58,7 @@ def f_wrapped(*args, **kwargs): def ndarray_args_and_return(f): """Decorate jitted functions to accept and return quaternionic arrays""" - @functools.wraps(f) + @wraps(f) def f_wrapped(*args, **kwargs): args_ndarray = (arg if not hasattr(arg, 'ndarray') else arg.ndarray for arg in args) return type(args[0])(f(*args_ndarray, **kwargs)) @@ -147,7 +167,7 @@ def pyguvectorize(types, signature): dtype_c = np.dtype(types[0][-1].dtype.name) if len(inputs) == 1: def wrapper(f): - @functools.wraps(f) + @wraps(f) def f_wrapped(a): shape_c = a[..., slice_a].shape + last_axis_c c = np.empty(shape_c, dtype=dtype_c) @@ -163,7 +183,7 @@ def f_wrapped(a): return f_wrapped else: def wrapper(f): - @functools.wraps(f) + @wraps(f) def f_wrapped(a, b): shape_c = np.broadcast(a[..., slice_a], b[..., slice_b]).shape + last_axis_c c = np.empty(shape_c, dtype=dtype_c) From 66c178ec7360a93b470d70f4b7f3452b6f331fd3 Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 14:50:31 -0400 Subject: [PATCH 46/49] Install functools32 for pypy2 --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index ea8b573..7f24034 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,7 @@ llvmlite = [ {version = "<0.32.0", markers = "python_version < '3.6' and implementation_name == 'cpython'"}, {version = "*", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} ] +functools32 = {version = "*", markers = "python_version < '3.2' and implementation_name == 'pypy'"}, mkdocs = {version = "^1.1.2", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} From 887688aadf0d79131a4040e979382413cbf3bc9c Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 14:50:50 -0400 Subject: [PATCH 47/49] See how pypy3 is going --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 486eec6..a014318 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [2.7, 3.5, pypy2] #, 3.6, 3.7, 3.8, pypy2, pypy3] + python-version: [2.7, 3.5, pypy2, pypy3] #, 3.6, 3.7, 3.8, pypy2, pypy3] # exclude: # - os: windows-latest # python-version: pypy3 From f66d37f7e590da97fc74e20897611bade95064be Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 14:57:21 -0400 Subject: [PATCH 48/49] Use functools32 for oldest pythons --- pyproject.toml | 2 +- quaternionic/converters.py | 5 ++++- quaternionic/utilities.py | 4 ++++ tests/test_utilities.py | 1 - 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7f24034..7be7e2e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ llvmlite = [ {version = "<0.32.0", markers = "python_version < '3.6' and implementation_name == 'cpython'"}, {version = "*", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} ] -functools32 = {version = "*", markers = "python_version < '3.2' and implementation_name == 'pypy'"}, +functools32 = {version = "*", markers = "python_version < '3.2'"}, mkdocs = {version = "^1.1.2", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} diff --git a/quaternionic/converters.py b/quaternionic/converters.py index 73f5cd3..663fe69 100644 --- a/quaternionic/converters.py +++ b/quaternionic/converters.py @@ -110,7 +110,10 @@ def from_rotation_matrix(cls, rot, nonorthogonal=True): if nonorthogonal: from operator import mul - from functools import reduce + try: + from functools import reduce + except ImportError: + from functools32 import reduce K3 = np.empty(shape+(4, 4), dtype=rot.dtype) K3[..., 0, 0] = (rot[..., 0, 0] - rot[..., 1, 1] - rot[..., 2, 2])/3 diff --git a/quaternionic/utilities.py b/quaternionic/utilities.py index 18d761d..ce625d7 100644 --- a/quaternionic/utilities.py +++ b/quaternionic/utilities.py @@ -5,6 +5,10 @@ # import platform +try: + import functools +except ImportError: + import functools32 as functools ufunc_attributes = [ 'nin', 'nout', 'nargs', 'ntypes', 'types', 'identity', 'signature', diff --git a/tests/test_utilities.py b/tests/test_utilities.py index 5d626e4..493ee61 100644 --- a/tests/test_utilities.py +++ b/tests/test_utilities.py @@ -1,5 +1,4 @@ import platform -import functools import numpy as np import quaternionic import pytest From 2ff9a5db474c0db439f399e4fd7bdace41fd0c9c Mon Sep 17 00:00:00 2001 From: Michael Boyle Date: Mon, 24 Aug 2020 14:58:01 -0400 Subject: [PATCH 49/49] Remove errant comma --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7be7e2e..f3846e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ llvmlite = [ {version = "<0.32.0", markers = "python_version < '3.6' and implementation_name == 'cpython'"}, {version = "*", markers = "python_version >= '3.6' and implementation_name == 'cpython'"} ] -functools32 = {version = "*", markers = "python_version < '3.2'"}, +functools32 = {version = "*", markers = "python_version < '3.2'"} mkdocs = {version = "^1.1.2", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"} mktheapidocs = {extras = ["plugin"], version = "^0.2.0", optional = true, markers = "python_version >= '3.6' and implementation_name == 'cpython'"}