From 2f814d7ae8346f963d276c72ba9e6a67c255e62f Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Fri, 11 Aug 2023 14:55:21 -0400 Subject: [PATCH 01/21] Add github actions CI --- .circleci/config.yml | 155 --------------------------------------- .github/workflows/ci.yml | 105 ++++++++++++++++++++++++++ README.md | 2 +- circle-build-package | 22 ------ galgebra/lt.py | 4 +- galgebra/mv.py | 2 +- setup.py | 4 +- test/README.md | 4 +- test_requirements.txt | 1 + 9 files changed, 115 insertions(+), 184 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yml delete mode 100755 circle-build-package diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 2af1e62f..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,155 +0,0 @@ -version: 2.0 - -defaults: &defaults - working_directory: ~/galgebra - steps: - - checkout - - run: - name: Install - command: | - sudo pip install -r test_requirements.txt - sudo pip install -e . - if [ -n "$PIP_EXTRA_INSTALLATION" ]; then - # deliberately not quoted - sudo pip install $PIP_EXTRA_INSTALLATION - fi - sudo pip check - - run: - name: Test - command: | - # we can't pass lists of arguments with spaces through environment - # variables, so reassemble the list here - PYTEST_ARGS=(); - - PYTEST_ARGS+=(-n 2 --dist loadscope); - - if [[ ! -z "$PYTEST_K_FILTER" ]]; then - PYTEST_ARGS+=(-k "$PYTEST_K_FILTER"); - fi; - - mkdir -p test-reports/pytest - pytest \ - --cov=galgebra \ - --nbval examples/ipython/ \ - test \ - --current-env \ - --sanitize-with test/.nbval_sanitize.cfg \ - --junitxml=test-reports/pytest/results.xml \ - "${PYTEST_ARGS[@]}" - - run: - name: Coverage - when: on_success - command: | - sudo pip install codecov - codecov - - store_test_results: - path: test-reports - - store_artifacts: - path: test-reports - -jobs: - "flake8": - steps: - - checkout - - run: - name: Install - command: | - sudo pip install flake8 flake8_formatter_junit_xml - - run: - name: Lint - command: | - mkdir -p test-reports/flake8 - flake8 --format=junit-xml --output-file=test-reports/flake8/results.xml - - store_test_results: - path: test-reports - - docker: - - image: circleci/python:3.8 - - # symengine does not seem to install correctly with Python 3.8 yet - "python-3.7-symengine": - <<: *defaults - environment: - PIP_EXTRA_INSTALLATION: numpy symengine==0.5.0 - USE_SYMENGINE: 1 - docker: - - image: circleci/python:3.7 - # sympy 1.4 does not claim to support Python 3.8 - "python-3.7-sympy-1.4": - <<: *defaults - environment: - PIP_EXTRA_INSTALLATION: sympy==1.4 - docker: - - image: circleci/python:3.7 - - "python-3.8-sympy-master": - <<: *defaults - environment: - # use the archive url to prevent full git clone - PIP_EXTRA_INSTALLATION: https://github.com/sympy/sympy/archive/master.zip - docker: - - image: circleci/python:3.8 - - # make sure to keep setup.py in sync with these - "python-3.9": - <<: *defaults - docker: - - image: circleci/python:3.9 - "python-3.8": - <<: *defaults - docker: - - image: circleci/python:3.8 - "python-3.7": - <<: *defaults - docker: - - image: circleci/python:3.7 - "python-3.6": - <<: *defaults - docker: - - image: circleci/python:3.6 - - "publish": - docker: - - image: circleci/python:3.7 - steps: - - checkout - - run: - name: Upload to PyPi - command: | - ./circle-build-package - -workflows: - version: 2 - build: - jobs: - - "flake8": - filters: - tags: - only: /^v.*$/ - - - "python-3.9": - filters: - tags: - only: /^v.*$/ - requires: ["flake8"] - - "python-3.8": - requires: ["flake8"] - - "python-3.7": - requires: ["flake8"] - - "python-3.6": - requires: ["flake8"] - - "python-3.7-symengine": - requires: ["flake8"] - - "python-3.7-sympy-1.4": - requires: ["flake8"] - - "python-3.8-sympy-master": - requires: ["flake8"] - - - publish: - requires: - - "python-3.9" - filters: - branches: - ignore: /.*/ - tags: - only: /^v.*$/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..d2db8a44 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,105 @@ +name: Python CI + +on: + push: + branches: + - master + tags: ['*'] + pull_request: + +concurrency: + group: test-${{ github.head_ref }} + cancel-in-progress: true + +env: + PYTHONUNBUFFERED: "1" + FORCE_COLOR: "1" + +jobs: + build: + name: Python ${{ matrix.python-version }} ${{ matrix.extra-env }} + if: >- + !contains(github.event.head_commit.message, '[skip ci]') + && !contains(github.event.head_commit.message, '[skip tests]') + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11"] + include: + - python-version: "3.7" + - python-version: "3.7" + extra-env: "PIP_EXTRA_INSTALLATION='numpy symengine==0.5.0' USE_SYMENGINE=1" + - python-version: "3.7" + extra-env: "PIP_EXTRA_INSTALLATION='sympy==1.4'" + - python-version: "3.8" + extra-env: "PIP_EXTRA_INSTALLATION='https://github.com/sympy/sympy/archive/master.zip'" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install -r test_requirements.txt + python -m pip install -e . + if [ -n "$PIP_EXTRA_INSTALLATION" ]; then + # deliberately not quoted + python -m pip install $PIP_EXTRA_INSTALLATION + fi + python -m pip check + - name: Lint + run: | + python -m pip install flake8 flake8_formatter_junit_xml + mkdir -p test-reports/flake8 + flake8 -v + - name: Test + run: | + PYTEST_ARGS=(); + PYTEST_ARGS+=(-n 2 --dist loadscope); + if [[ ! -z "$PYTEST_K_FILTER" ]]; then + PYTEST_ARGS+=(-k "$PYTEST_K_FILTER"); + fi; + mkdir -p test-reports/pytest + pytest \ + --cov=galgebra \ + --nbval examples/ipython/ \ + test \ + --current-env \ + --sanitize-with test/.nbval_sanitize.cfg \ + --junitxml=test-reports/pytest/results.xml \ + "${PYTEST_ARGS[@]}" + - name: Upload coverage to Codecov + if: "matrix.python-version == '3.11'" + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + release: + name: Create release and send to PyPI + needs: build + if: >- + github.ref_type == 'tag' + && startsWith(github.ref, 'refs/tags/v') + && !contains(github.event.head_commit.message, '[skip ci]') + && !contains(github.event.head_commit.message, '[no release]') + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install dependencies + run: | + python -m pip install -r requirements.txt + - name: Build and upload package + if: success() + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* diff --git a/README.md b/README.md index 5d39f956..fb512d14 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Symbolic Geometric Algebra/Calculus package for SymPy. [![PyPI](https://img.shields.io/pypi/v/galgebra.svg)](https://pypi.org/project/galgebra/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/galgebra.svg)](https://pypi.org/project/galgebra/) -[![Build Status on CircleCI](https://circleci.com/gh/pygae/galgebra.svg?style=shield)](https://circleci.com/gh/pygae/galgebra) +[![Python CI](https://github.com/pygae/galgebra/actions/workflows/ci.yml/badge.svg)](https://github.com/pygae/galgebra/actions/workflows/ci.yml) [![Documentation Status](https://readthedocs.org/projects/galgebra/badge/?version=latest)](https://galgebra.readthedocs.io/en/latest/?badge=latest) [![DOI](https://zenodo.org/badge/113447311.svg)](https://zenodo.org/badge/latestdoi/113447311) diff --git a/circle-build-package b/circle-build-package deleted file mode 100755 index f3fe1e58..00000000 --- a/circle-build-package +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -if [ -z "$CI" ]; then - echo "Will only continue on CI" - exit -fi - -# if [[ $CIRCLE_BRANCH != "master" ]]; then -# echo "Will only continue for master builds" -# exit -# fi - -# build package and upload to private pypi index -echo "[distutils]" >> ~/.pypirc -echo "index-servers = pypi-private" >> ~/.pypirc -echo "[pypi-private]" >> ~/.pypirc -echo "repository=https://$PYPI_HOST" >> ~/.pypirc -echo "username=$PYPI_USERNAME" >> ~/.pypirc -echo "password=$PYPI_PASSWORD" >> ~/.pypirc -python3 -m pip install --user --upgrade twine -python3 setup.py sdist bdist_wheel -python3 -m twine upload -r pypi-private dist/* diff --git a/galgebra/lt.py b/galgebra/lt.py index 32c52e77..2bab210d 100644 --- a/galgebra/lt.py +++ b/galgebra/lt.py @@ -754,14 +754,14 @@ def __init__(self, f, Ga, nargs=None, fct=False): else: if isinstance(f, types.FunctionType): # Tensor defined by general multi-linear function - args, _varargs, _kwargs, _defaults = inspect.getargspec(f) + args = inspect.getfullargspec(f)[0] self.nargs = len(args) self.f = f Mlt.increment_slots(self.nargs, Ga) self.fvalue = f(*tuple(Ga._mlt_a[0:self.nargs])) else: # Tensor defined by component expression self.f = None - self.nargs = len(args) + self.nargs = 0 Mlt.increment_slots(self.nargs, Ga) self.fvalue = f diff --git a/galgebra/mv.py b/galgebra/mv.py index cc08db5c..ecec5dc3 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1252,7 +1252,7 @@ def inv(self) -> 'Mv': return (S.One/self_sq.obj)*self self_rev = self.rev() self_self_rev = self * self_rev - if(self_self_rev.is_scalar()): # self*self.rev() is a scalar + if self_self_rev.is_scalar(): # self*self.rev() is a scalar """ if self_self_rev.scalar() == S.Zero: raise ValueError('!!!!In multivector inverse A*A.rev() is zero!!!!') diff --git a/setup.py b/setup.py index f80b7f9c..014d61dc 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ package_dir={'galgebra': 'galgebra'}, # Sympy 1.4 is needed for printing tests to pass, but 1.3 will still work install_requires=['sympy'], - python_requires='>=3.6.*', + python_requires='>=3.6', long_description=long_description, long_description_content_type='text/markdown', classifiers=[ @@ -37,6 +37,8 @@ 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', ], diff --git a/test/README.md b/test/README.md index 9a6a761a..d0ca23df 100644 --- a/test/README.md +++ b/test/README.md @@ -16,7 +16,7 @@ We are primarily using [nbval](https://github.com/computationalmodelling/nbval) The test notebooks are used as a recorder of outputs (plain text, color ANSI console output, LaTeX), the author of the test notebook will need to visually inspect the outputs in Jupyter or [nbviewer](https://nbviewer.jupyter.org/) to confirm that GAlgebra is working as expected. -Then `nbval` will be run as a plugin of `pytest` in the CI environment for various versions of Python or even of dependencies to ensure the behavior is identical by checking the actual outputs with the recorded outputs. See `.circleci/config.yml` for up-to-date instructions to run them in CI. +Then `nbval` will be run as a plugin of `pytest` in the CI environment for various versions of Python or even of dependencies to ensure the behavior is identical by checking the actual outputs with the recorded outputs. See `.github/workflows/ci.yml` for up-to-date instructions to run them in CI. ### How to maintain the examples @@ -68,4 +68,4 @@ These notebooks are to demonstrate individual scenarios of interest and they are - `inner_product.ipynb` - Demo for the definition and semantics of Hestenes' inner product adopted in GAlgebra - `verify_doc_python.ipynb` - - Unfinished verification for examples in `doc/python/` \ No newline at end of file + - Unfinished verification for examples in `doc/python/` diff --git a/test_requirements.txt b/test_requirements.txt index 61e99ca8..c7aa73d3 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,4 +1,5 @@ # requirements for CI +wheel sympy == 1.7 pytest-cov ipython == 5.8.0; python_version == "2.7" From 64963c3a46754ae08de7ce6e0f3cfb005ae76baf Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Mon, 14 Aug 2023 14:21:48 -0400 Subject: [PATCH 02/21] Simplify CI * Streamline matrix to avoid old special cases * Skip archiving flake8 output, because it is now in stdout * Skip archiving pytest output, because it appears in stdout * Temporarily run on pushes to any branch --- .github/workflows/ci.yml | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2db8a44..8234da14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: Python CI on: push: branches: - - master + - '*' tags: ['*'] pull_request: @@ -23,15 +23,7 @@ jobs: && !contains(github.event.head_commit.message, '[skip tests]') strategy: matrix: - python-version: ["3.9", "3.10", "3.11"] - include: - - python-version: "3.7" - - python-version: "3.7" - extra-env: "PIP_EXTRA_INSTALLATION='numpy symengine==0.5.0' USE_SYMENGINE=1" - - python-version: "3.7" - extra-env: "PIP_EXTRA_INSTALLATION='sympy==1.4'" - - python-version: "3.8" - extra-env: "PIP_EXTRA_INSTALLATION='https://github.com/sympy/sympy/archive/master.zip'" + python-version: ["3.8", "3.9", "3.10", "3.11"] runs-on: ubuntu-latest steps: - name: Checkout @@ -44,15 +36,10 @@ jobs: run: | python -m pip install -r test_requirements.txt python -m pip install -e . - if [ -n "$PIP_EXTRA_INSTALLATION" ]; then - # deliberately not quoted - python -m pip install $PIP_EXTRA_INSTALLATION - fi python -m pip check - name: Lint run: | - python -m pip install flake8 flake8_formatter_junit_xml - mkdir -p test-reports/flake8 + python -m pip install flake8 flake8 -v - name: Test run: | @@ -61,14 +48,12 @@ jobs: if [[ ! -z "$PYTEST_K_FILTER" ]]; then PYTEST_ARGS+=(-k "$PYTEST_K_FILTER"); fi; - mkdir -p test-reports/pytest pytest \ --cov=galgebra \ --nbval examples/ipython/ \ test \ --current-env \ --sanitize-with test/.nbval_sanitize.cfg \ - --junitxml=test-reports/pytest/results.xml \ "${PYTEST_ARGS[@]}" - name: Upload coverage to Codecov if: "matrix.python-version == '3.11'" From 7e55a5979073427b69014bfa95212b005eeed7d8 Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Mon, 14 Aug 2023 14:24:34 -0400 Subject: [PATCH 03/21] Raise an error rather than return possibly incorrect results --- galgebra/lt.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/galgebra/lt.py b/galgebra/lt.py index 2bab210d..936b7933 100644 --- a/galgebra/lt.py +++ b/galgebra/lt.py @@ -760,10 +760,11 @@ def __init__(self, f, Ga, nargs=None, fct=False): Mlt.increment_slots(self.nargs, Ga) self.fvalue = f(*tuple(Ga._mlt_a[0:self.nargs])) else: # Tensor defined by component expression - self.f = None - self.nargs = 0 - Mlt.increment_slots(self.nargs, Ga) - self.fvalue = f + raise NotImplementedError + # self.f = None + # self.nargs = len(args) # args isn't defined, which is why we raise NotImplementedError + # Mlt.increment_slots(self.nargs, Ga) + # self.fvalue = f def __call__(self, *args): """ From 6fab48054cac0b391d781725401b0e4de47b3156 Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Mon, 14 Aug 2023 14:36:46 -0400 Subject: [PATCH 04/21] Run CI on pushes to master only [skip ci] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8234da14..c030d594 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: Python CI on: push: branches: - - '*' + - master tags: ['*'] pull_request: From c4898991eb5e8b7fc08f0c318d1761b9c97d3705 Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 10:03:28 -0400 Subject: [PATCH 05/21] Don't use old version of sphinx; required feature should be present --- doc/readthedocs-pip-requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/readthedocs-pip-requirements.txt b/doc/readthedocs-pip-requirements.txt index 8196cd85..ebc50e19 100644 --- a/doc/readthedocs-pip-requirements.txt +++ b/doc/readthedocs-pip-requirements.txt @@ -3,9 +3,9 @@ ipython matplotlib scipy -# an unreleased commit that will eventually make the 3.1.0 release, with -# type annotations which work on cached_property --e git+https://git@github.com/sphinx-doc/sphinx.git@5460ad6925199b57b27b7d059825d3560872edbb#egg=sphinx +## an unreleased commit that will eventually make the 3.1.0 release, with +## type annotations which work on cached_property +#-e git+https://git@github.com/sphinx-doc/sphinx.git@5460ad6925199b57b27b7d059825d3560872edbb#egg=sphinx ipykernel nbsphinx From cc0f983614f7cde5b03ac74cd6f6ac424eb9ccda Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 10:05:12 -0400 Subject: [PATCH 06/21] Update RTD config file format --- .readthedocs.yaml | 9 +++++++++ readthedocs.yml | 10 ---------- 2 files changed, 9 insertions(+), 10 deletions(-) create mode 100644 .readthedocs.yaml delete mode 100644 readthedocs.yml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..4d332b5b --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,9 @@ +version: 2 +build: + os: "ubuntu-22.04" + tools: + python: "3.11" + +python: + install: + - requirements: docs/readthedocs-pip-requirements.txt diff --git a/readthedocs.yml b/readthedocs.yml deleted file mode 100644 index 29a09b25..00000000 --- a/readthedocs.yml +++ /dev/null @@ -1,10 +0,0 @@ -python: - version: 3 - -python: - pip_install: true - -requirements_file: doc/readthedocs-pip-requirements.txt - -# Don't build any extra formats -formats: [] \ No newline at end of file From 71e8d7c5d130085e56afba1348f78f952d2b8b48 Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 10:09:18 -0400 Subject: [PATCH 07/21] Don't pin sympy version in tests --- test_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_requirements.txt b/test_requirements.txt index c7aa73d3..41a7ff5e 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,6 +1,6 @@ # requirements for CI wheel -sympy == 1.7 +sympy pytest-cov ipython == 5.8.0; python_version == "2.7" nbval From 93ee9fb92955c03f598fb4658f302f06ccc4ce3d Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 14 Aug 2023 22:01:57 +0100 Subject: [PATCH 08/21] Update CircleCI docker images to the recommended replacements See https://discuss.circleci.com/t/legacy-convenience-image-deprecation/41034 --- .circleci/config.yml | 155 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..055d20bd --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,155 @@ +version: 2.0 + +defaults: &defaults + working_directory: ~/galgebra + steps: + - checkout + - run: + name: Install + command: | + sudo pip install -r test_requirements.txt + sudo pip install -e . + if [ -n "$PIP_EXTRA_INSTALLATION" ]; then + # deliberately not quoted + sudo pip install $PIP_EXTRA_INSTALLATION + fi + sudo pip check + - run: + name: Test + command: | + # we can't pass lists of arguments with spaces through environment + # variables, so reassemble the list here + PYTEST_ARGS=(); + + PYTEST_ARGS+=(-n 2 --dist loadscope); + + if [[ ! -z "$PYTEST_K_FILTER" ]]; then + PYTEST_ARGS+=(-k "$PYTEST_K_FILTER"); + fi; + + mkdir -p test-reports/pytest + pytest \ + --cov=galgebra \ + --nbval examples/ipython/ \ + test \ + --current-env \ + --sanitize-with test/.nbval_sanitize.cfg \ + --junitxml=test-reports/pytest/results.xml \ + "${PYTEST_ARGS[@]}" + - run: + name: Coverage + when: on_success + command: | + sudo pip install codecov + codecov + - store_test_results: + path: test-reports + - store_artifacts: + path: test-reports + +jobs: + "flake8": + steps: + - checkout + - run: + name: Install + command: | + sudo pip install flake8 flake8_formatter_junit_xml + - run: + name: Lint + command: | + mkdir -p test-reports/flake8 + flake8 --format=junit-xml --output-file=test-reports/flake8/results.xml + - store_test_results: + path: test-reports + + docker: + - image: cimg/python:3.8 + + # symengine does not seem to install correctly with Python 3.8 yet + "python-3.7-symengine": + <<: *defaults + environment: + PIP_EXTRA_INSTALLATION: numpy symengine==0.5.0 + USE_SYMENGINE: 1 + docker: + - image: cimg/python:3.7 + # sympy 1.4 does not claim to support Python 3.8 + "python-3.7-sympy-1.4": + <<: *defaults + environment: + PIP_EXTRA_INSTALLATION: sympy==1.4 + docker: + - image: cimg/python:3.7 + + "python-3.8-sympy-master": + <<: *defaults + environment: + # use the archive url to prevent full git clone + PIP_EXTRA_INSTALLATION: https://github.com/sympy/sympy/archive/master.zip + docker: + - image: cimg/python:3.8 + + # make sure to keep setup.py in sync with these + "python-3.9": + <<: *defaults + docker: + - image: cimg/python:3.9 + "python-3.8": + <<: *defaults + docker: + - image: cimg/python:3.8 + "python-3.7": + <<: *defaults + docker: + - image: cimg/python:3.7 + "python-3.6": + <<: *defaults + docker: + - image: cimg/python:3.6 + + "publish": + docker: + - image: cimg/python:3.7 + steps: + - checkout + - run: + name: Upload to PyPi + command: | + ./circle-build-package + +workflows: + version: 2 + build: + jobs: + - "flake8": + filters: + tags: + only: /^v.*$/ + + - "python-3.9": + filters: + tags: + only: /^v.*$/ + requires: ["flake8"] + - "python-3.8": + requires: ["flake8"] + - "python-3.7": + requires: ["flake8"] + - "python-3.6": + requires: ["flake8"] + - "python-3.7-symengine": + requires: ["flake8"] + - "python-3.7-sympy-1.4": + requires: ["flake8"] + - "python-3.8-sympy-master": + requires: ["flake8"] + + - publish: + requires: + - "python-3.9" + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*$/ From 7b1ed8dfffed50a0c398f93902d838a635233efc Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 14 Aug 2023 22:14:04 +0100 Subject: [PATCH 09/21] Remove `sudo` from circleCI config `pip` is now only on the user path, not the system path --- .circleci/config.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 055d20bd..f1260b4b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,13 +7,13 @@ defaults: &defaults - run: name: Install command: | - sudo pip install -r test_requirements.txt - sudo pip install -e . + pip install -r test_requirements.txt + pip install -e . if [ -n "$PIP_EXTRA_INSTALLATION" ]; then # deliberately not quoted - sudo pip install $PIP_EXTRA_INSTALLATION + pip install $PIP_EXTRA_INSTALLATION fi - sudo pip check + pip check - run: name: Test command: | @@ -40,7 +40,7 @@ defaults: &defaults name: Coverage when: on_success command: | - sudo pip install codecov + pip install codecov codecov - store_test_results: path: test-reports @@ -54,7 +54,7 @@ jobs: - run: name: Install command: | - sudo pip install flake8 flake8_formatter_junit_xml + pip install flake8 flake8_formatter_junit_xml - run: name: Lint command: | From 9408e25e8efbfda7fffb39ce6fece907f9b09210 Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 10:14:31 -0400 Subject: [PATCH 10/21] python setup.py should work without pre-installing anything --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c030d594..1f0960b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,9 +77,6 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.11" - - name: Install dependencies - run: | - python -m pip install -r requirements.txt - name: Build and upload package if: success() env: From f62a1cbf6bcb5dc63b80e4552d3f0e9ea3c07d60 Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 10:38:28 -0400 Subject: [PATCH 11/21] Fix path to requirements file --- .readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 4d332b5b..fa2081f9 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -6,4 +6,4 @@ build: python: install: - - requirements: docs/readthedocs-pip-requirements.txt + - requirements: doc/readthedocs-pip-requirements.txt From 0e4c3e8b6744736db6a9d0022aa08fcda33b401e Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 10:39:58 -0400 Subject: [PATCH 12/21] Remove explicit installation of wheel and sympy --- .github/workflows/ci.yml | 6 ++++-- test_requirements.txt | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f0960b5..3c8cb1e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: Python CI on: push: branches: - - master + - '*' tags: ['*'] pull_request: @@ -39,7 +39,6 @@ jobs: python -m pip check - name: Lint run: | - python -m pip install flake8 flake8 -v - name: Test run: | @@ -77,6 +76,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.11" + - name: Install wheel + run: | + python -m pip install wheel - name: Build and upload package if: success() env: diff --git a/test_requirements.txt b/test_requirements.txt index 41a7ff5e..af41c77f 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,6 +1,5 @@ # requirements for CI -wheel -sympy +flake8 pytest-cov ipython == 5.8.0; python_version == "2.7" nbval From 90cfabbd3f887087e0582f79fce1b552089de0ec Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 10:50:16 -0400 Subject: [PATCH 13/21] Install galgebra as well --- .readthedocs.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index fa2081f9..9685daa1 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -5,5 +5,7 @@ build: python: "3.11" python: - install: - - requirements: doc/readthedocs-pip-requirements.txt + install: + - requirements: doc/readthedocs-pip-requirements.txt + - method: pip + path: . From f6622ed319a2c4a2d52f77713dde236ab3cc4529 Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 10:57:33 -0400 Subject: [PATCH 14/21] Revert to sympy 1.7 for output-comparison tests to pass --- test_requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test_requirements.txt b/test_requirements.txt index af41c77f..8b648c08 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,4 +1,5 @@ # requirements for CI +sympy == 1.7 flake8 pytest-cov ipython == 5.8.0; python_version == "2.7" From 823cb610bda2875e215dfb8f8988ebae1cdfc828 Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 12:21:21 -0400 Subject: [PATCH 15/21] Simplify releases_release_uri --- doc/conf.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 40ee44f1..493de323 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -21,7 +21,6 @@ import sphinx_rtd_theme import sphinx -import releases_hack # -- Project information ----------------------------------------------------- @@ -250,8 +249,8 @@ # If your project is hosted on Github, set the releases_github_path setting instead, # to e.g. account/project. Releases will then use an appropriate Github URL for both # releases and issues. -releases_github_path = 'pygae/galgebra' -releases_release_uri = releases_hack.release_uri(releases_github_path) +releases_github_path = "pygae/galgebra" +releases_release_uri = "https://github.com/pygae/galgebra/tree/v%s" # Need to specify 'v' # You may optionally set releases_debug = True to see debug output while building your docs. releases_debug = True From 214b95c7d46459d074818498a538d766738310bf Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 12:21:54 -0400 Subject: [PATCH 16/21] Skip tests on PR fork --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c8cb1e3..7a4f1c90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: Python CI on: push: branches: - - '*' + - master tags: ['*'] pull_request: From c495f928d2d92fc19ec2da51149ea3479ccfe24a Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 12:39:15 -0400 Subject: [PATCH 17/21] Fix releases_hack to work with releases>=2.0 --- doc/_sphinxext/releases_hack.py | 3 +++ doc/conf.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/_sphinxext/releases_hack.py b/doc/_sphinxext/releases_hack.py index 8eca8670..5574612a 100644 --- a/doc/_sphinxext/releases_hack.py +++ b/doc/_sphinxext/releases_hack.py @@ -9,6 +9,9 @@ class release_uri: def __init__(self, releases_github_path): self._path = releases_github_path + def __contains__(self, item): + return item in self._path + def __mod__(self, release): if release[0].isdigit(): release = "v" + release diff --git a/doc/conf.py b/doc/conf.py index 493de323..160cc2f5 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -21,6 +21,7 @@ import sphinx_rtd_theme import sphinx +import releases_hack # -- Project information ----------------------------------------------------- @@ -250,7 +251,7 @@ # to e.g. account/project. Releases will then use an appropriate Github URL for both # releases and issues. releases_github_path = "pygae/galgebra" -releases_release_uri = "https://github.com/pygae/galgebra/tree/v%s" # Need to specify 'v' +releases_release_uri = releases_hack.release_uri(releases_github_path) # You may optionally set releases_debug = True to see debug output while building your docs. releases_debug = True From 5710dc730854695d57ca188b88970aa55086061d Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 12:43:48 -0400 Subject: [PATCH 18/21] Fix releases_hack to work with releases>=2.0 --- doc/_sphinxext/releases_hack.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/_sphinxext/releases_hack.py b/doc/_sphinxext/releases_hack.py index 5574612a..407a0108 100644 --- a/doc/_sphinxext/releases_hack.py +++ b/doc/_sphinxext/releases_hack.py @@ -16,3 +16,6 @@ def __mod__(self, release): if release[0].isdigit(): release = "v" + release return 'https://github.com/%s/tree/%s' % (self._path, release) + + def format(self, release): + return self.__mod__(release) From b687783cae5e33e0973f65b330905866d1266ad3 Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 12:53:22 -0400 Subject: [PATCH 19/21] Correct behavior with kwarg --- doc/_sphinxext/releases_hack.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/_sphinxext/releases_hack.py b/doc/_sphinxext/releases_hack.py index 407a0108..afe044e3 100644 --- a/doc/_sphinxext/releases_hack.py +++ b/doc/_sphinxext/releases_hack.py @@ -10,12 +10,12 @@ def __init__(self, releases_github_path): self._path = releases_github_path def __contains__(self, item): - return item in self._path + return "%s" in "https://github.com/%s/tree/%s" def __mod__(self, release): if release[0].isdigit(): release = "v" + release return 'https://github.com/%s/tree/%s' % (self._path, release) - def format(self, release): - return self.__mod__(release) + def format(self, /, number): + return self.__mod__(number) From 3a10eecf118d6add3d844b453a26e48201d989c1 Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 13:03:29 -0400 Subject: [PATCH 20/21] Check if `wheel` is somehow changing circleci build --- test_requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test_requirements.txt b/test_requirements.txt index 8b648c08..750a22b3 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,4 +1,5 @@ # requirements for CI +wheel sympy == 1.7 flake8 pytest-cov From 025bae788c8c81e2c24e9bd1c70b491370b8f989 Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 15 Aug 2023 14:26:28 -0400 Subject: [PATCH 21/21] Remove publish step in favor of github actions --- .circleci/config.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f1260b4b..82101d9c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -108,15 +108,15 @@ jobs: docker: - image: cimg/python:3.6 - "publish": - docker: - - image: cimg/python:3.7 - steps: - - checkout - - run: - name: Upload to PyPi - command: | - ./circle-build-package + # "publish": + # docker: + # - image: cimg/python:3.7 + # steps: + # - checkout + # - run: + # name: Upload to PyPi + # command: | + # ./circle-build-package workflows: version: 2