diff --git a/.ci/create-changes-html.sh b/.ci/create-changes-html.sh index 40322ca86b9..2dc3ca61a41 100755 --- a/.ci/create-changes-html.sh +++ b/.ci/create-changes-html.sh @@ -51,7 +51,7 @@ diffParagraphs.forEach(paragraph => { EOF echo '' >> CHANGES.html echo '' >> CHANGES.html -(cd $DOC_REPOSITORY && git diff $BASE_DOC_COMMIT -- *.html) > diff.txt +(cd $DOC_REPOSITORY && git diff $BASE_DOC_COMMIT -- "*.html") > diff.txt python3 - << EOF import os, re, html with open('diff.txt', 'r') as f: diff --git a/.ci/docker-exec-script.sh b/.ci/docker-exec-script.sh new file mode 100755 index 00000000000..60bbd70aee7 --- /dev/null +++ b/.ci/docker-exec-script.sh @@ -0,0 +1,14 @@ +#!/bin/sh -x +if [ $# -lt 3 ]; then + echo >&2 "usage: docker-exec-script.sh CONTAINER WORKDIR [VAR=VALUE...] SCRIPT" + exit 1 +fi +CONTAINER=$1 +WORKDIR=$2 +shift 2 +(echo "cd \"$WORKDIR\""; + while [ $# -gt 1 ]; do + echo "export \"$1\"" + shift + done; + cat "$1") | docker exec -i $CONTAINER bash -ex diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3eecd1a4666..e9703d30bfa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,192 +26,353 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +# +# The three workflows: +# +# - build.yml (with jobs test-new, test-mod, test-long), +# - doc-build.yml, +# - doc-build-pdf.yml +# +# each build Sage: +# +# - incrementally starting from a Docker image that ci-linux.yml +# publishes on each development release to ghcr.io, +# - orchestrated using a tox-generated Dockerfile, +# - using https://github.com/marketplace/actions/build-and-push-docker-images, +# - pushing the image to a local registry, +# - then executing a container loaded from that registry, +# +# and then run various tests or build the documentation. +# +# Without the use of a cache, this runs the same incremental rebuild of Sage +# multiple times; there is no interaction between these workflow and jobs. +# +# This baseline is transparently improved by our use of the GH Actions cache, +# see https://docs.docker.com/build/ci/github-actions/cache/#cache-backend-api. +# +# Jobs test-mod and test-long are only started after test-new completed; +# but the workflows doc-build.yml and doc-build-pdf.yml are started independently. +# +# - When nothing is cached and the 3 workflows are launched in parallel, +# they may each run the same incremental rebuild. +# +# - When there's congestion that leads to the workflows to be run serially, +# the 2nd and 3rd workflow will be able to use the cache from the 1st workflow. +# +# This elasticity may be helpful in reducing congestion. +# +# There is a rather small per-project limit of 10 GB for this cache. +# Use https://github.com/sagemath/sage/actions/caches to monitor the utilization +# of the cache. +# + +env: + # Adapted from docker.yml + TOX_ENV: "docker-${{ github.event.inputs.platform || 'ubuntu-jammy-standard' }}-incremental" + BUILD_IMAGE: "localhost:5000/${{ github.repository }}/sage-${{ github.event.inputs.platform || 'ubuntu-jammy-standard' }}-with-targets:ci" + FROM_DOCKER_REPOSITORY: "ghcr.io/sagemath/sage/" + FROM_DOCKER_TARGET: "with-targets" + FROM_DOCKER_TAG: ${{ github.event.inputs.docker_tag || 'dev'}} + EXTRA_CONFIGURE_ARGS: --enable-fat-binary + jobs: - get_ci_fixes: + test-new: runs-on: ubuntu-latest + services: + # https://docs.docker.com/build/ci/github-actions/local-registry/ + registry: + image: registry:2 + ports: + - 5000:5000 steps: + - name: Maximize build disk space + uses: easimon/maximize-build-space@v10 + with: + # need space in /var for Docker images + root-reserve-mb: 30000 + remove-dotnet: true + remove-android: true + remove-haskell: true + remove-codeql: true + remove-docker-images: true - name: Checkout id: checkout uses: actions/checkout@v4 + - name: Install test prerequisites + # From docker.yml + run: | + sudo DEBIAN_FRONTEND=noninteractive apt-get update + sudo DEBIAN_FRONTEND=noninteractive apt-get install tox + sudo apt-get clean + df -h - name: Merge CI fixes from sagemath/sage + # From docker.yml + # This step needs to happen after the commit sha is put in DOCKER_TAG + # so that multi-stage builds can work correctly. run: | mkdir -p upstream .ci/merge-fixes.sh 2>&1 | tee upstream/ci_fixes.log env: GH_TOKEN: ${{ github.token }} SAGE_CI_FIXES_FROM_REPOSITORIES: ${{ vars.SAGE_CI_FIXES_FROM_REPOSITORIES }} - - name: Store CI fixes in upstream artifact - run: | - if git format-patch --stdout test_base > ci_fixes.patch; then - cp ci_fixes.patch upstream/ - fi - - uses: actions/upload-artifact@v3 - with: - path: upstream - name: upstream - build: - runs-on: ubuntu-latest - container: ghcr.io/sagemath/sage/sage-${{ github.event.inputs.platform || 'ubuntu-jammy-standard' }}-with-targets:${{ github.event.inputs.docker_tag || 'dev'}} - needs: [get_ci_fixes] - steps: - - name: Checkout - id: checkout - uses: actions/checkout@v4 + # Building - - name: Update system packages - id: prepare + - name: Generate Dockerfile + # From docker.yml run: | - export PATH="build/bin:$PATH" - eval $(sage-print-system-package-command auto update) - eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git) + tox -e ${{ env.TOX_ENV }} + cp .tox/${{ env.TOX_ENV }}/Dockerfile . + env: + # Only generate the Dockerfile, do not run 'docker build' here + DOCKER_TARGETS: "" - - name: Add prebuilt tree as a worktree - id: worktree - run: | - set -ex - git config --global --add safe.directory $(pwd) - .ci/retrofit-worktree.sh worktree-image /sage + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver-opts: network=host - - name: Download upstream artifact - uses: actions/download-artifact@v3 + - name: Build Docker image + id: image + uses: docker/build-push-action@v5 with: - path: upstream - name: upstream + # push and load may not be set together at the moment + # + # We are using "push" (to the local registry) because it was + # more reliable than "load", for which we observed random failure + # conditions in which the built image could not be found. + # + push: true + load: false + context: . + tags: ${{ env.BUILD_IMAGE }} + target: with-targets + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + NUMPROC=6 + USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse + TARGETS_PRE=build/make/Makefile + TARGETS=ci-build-with-fallback - - name: Apply CI fixes from sagemath/sage - # After applying the fixes, make sure all changes are marked as uncommitted changes. + - name: Start container run: | - if [ -r upstream/ci_fixes.patch ]; then - (cd worktree-image && git commit -q -m "current changes" --allow-empty -a && git am; git reset --quiet old; git add -N .) < upstream/ci_fixes.patch - fi + docker run --name BUILD -dit \ + --mount type=bind,src=$(pwd),dst=$(pwd) \ + --workdir $(pwd) \ + ${{ env.BUILD_IMAGE }} /bin/sh - - name: Incremental build - id: incremental + # Testing + + - name: Check that all modules can be imported run: | - # Now re-bootstrap and build. The build is incremental because we were careful with the timestamps. - ./bootstrap && make build - working-directory: ./worktree-image - env: - MAKE: make -j4 --output-sync=recurse - SAGE_NUM_THREADS: 4 + # Increase the length of the lines in the "short summary" + export COLUMNS=120 + # The following command checks that all modules can be imported. + # The output also includes a long list of modules together with the number of tests in each module. + # This can be ignored. + ./sage -python -m pip install pytest-xdist + ./sage -python -m pytest -c tox.ini -qq --doctest --collect-only || true + shell: sh .ci/docker-exec-script.sh BUILD /sage {0} - - name: Build modularized distributions - if: (success() || failure()) && steps.worktree.outcome == 'success' - run: make V=0 tox && make SAGE_CHECK=no pypi-wheels - working-directory: ./worktree-image - env: - MAKE: make -j4 --output-sync=recurse - SAGE_NUM_THREADS: 4 + - name: Test changed files (sage -t --new) + run: | + export MAKE="make -j2 --output-sync=recurse" SAGE_NUM_THREADS=4 + # We run tests with "sage -t --new"; this only tests the uncommitted changes. + ./sage -t --new -p4 + shell: sh .ci/docker-exec-script.sh BUILD /sage {0} - - name: Static code check with pyright - if: (success() || failure()) && steps.worktree.outcome == 'success' - uses: jakebailey/pyright-action@v1 - with: - version: 1.1.332 - # Many warnings issued by pyright are not yet helpful because there is not yet enough type information. - no-comments: true - working-directory: ./worktree-image - env: - # To avoid out of memory errors - NODE_OPTIONS: --max-old-space-size=8192 - - - name: Static code check with pyright (annotated) - if: (success() || failure()) && steps.worktree.outcome == 'success' - uses: jakebailey/pyright-action@v1 + test-mod: + runs-on: ubuntu-latest + needs: [test-new] + services: + # https://docs.docker.com/build/ci/github-actions/local-registry/ + registry: + image: registry:2 + ports: + - 5000:5000 + strategy: + fail-fast: false + matrix: + targets: + - sagemath_categories-check + steps: + - name: Maximize build disk space + uses: easimon/maximize-build-space@v10 with: - version: 1.1.332 - # Issue errors - no-comments: false - level: error - working-directory: ./worktree-image + # need space in /var for Docker images + root-reserve-mb: 30000 + remove-dotnet: true + remove-android: true + remove-haskell: true + remove-codeql: true + remove-docker-images: true + - name: Checkout + id: checkout + uses: actions/checkout@v4 + - name: Install test prerequisites + # From docker.yml + run: | + sudo DEBIAN_FRONTEND=noninteractive apt-get update + sudo DEBIAN_FRONTEND=noninteractive apt-get install tox + sudo apt-get clean + df -h + - name: Merge CI fixes from sagemath/sage + # From docker.yml + # This step needs to happen after the commit sha is put in DOCKER_TAG + # so that multi-stage builds can work correctly. + run: | + .ci/merge-fixes.sh env: - # To avoid out of memory errors - NODE_OPTIONS: --max-old-space-size=8192 + GH_TOKEN: ${{ github.token }} + + # Building - - name: Clean (fallback to non-incremental) - id: clean - if: (success() || failure()) && steps.worktree.outcome == 'success' && steps.incremental.outcome != 'success' + - name: Generate Dockerfile + # From docker.yml run: | - set -ex - ./bootstrap && make doc-clean doc-uninstall sagelib-clean && git clean -fx src/sage && ./config.status - working-directory: ./worktree-image + tox -e ${{ env.TOX_ENV }} + cp .tox/${{ env.TOX_ENV }}/Dockerfile . env: - MAKE: make -j4 - SAGE_NUM_THREADS: 4 + # Only generate the Dockerfile, do not run 'docker build' here + DOCKER_TARGETS: "" - - name: Build - # This step is needed because building the modularized distributions installs some optional packages, - # so the editable install of sagelib needs to build the corresponding optional extension modules. - id: build - if: (success() || failure()) && (steps.incremental.outcome == 'success' || steps.clean.outcome == 'success') + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver-opts: network=host + + - name: Build Docker image + id: image + uses: docker/build-push-action@v5 + with: + push: true + load: false + context: . + tags: ${{ env.BUILD_IMAGE }} + target: with-targets + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + NUMPROC=6 + USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse + TARGETS_PRE=build/make/Makefile + TARGETS=ci-build-with-fallback + + - name: Start container run: | - make build - working-directory: ./worktree-image - env: - MAKE: make -j4 --output-sync=recurse - SAGE_NUM_THREADS: 4 + docker run --name BUILD -dit \ + --mount type=bind,src=$(pwd),dst=$(pwd) \ + --workdir $(pwd) \ + ${{ env.BUILD_IMAGE }} /bin/sh # Testing - - name: Test changed files (sage -t --new) - if: (success() || failure()) && steps.build.outcome == 'success' + - name: Test modularized distributions run: | - # We run tests with "sage -t --new"; this only tests the uncommitted changes. - ./sage -t --new -p2 - working-directory: ./worktree-image - env: - MAKE: make -j4 --output-sync=recurse - SAGE_NUM_THREADS: 4 + export MAKE="make -j2 --output-sync=recurse" SAGE_NUM_THREADS=4 + make V=0 tox-ensure && make ${{ matrix.targets }} + shell: sh .ci/docker-exec-script.sh BUILD /sage {0} - - name: Test modularized distributions - if: (success() || failure()) && steps.build.outcome == 'success' - run: make V=0 tox && make pypi-wheels-check - working-directory: ./worktree-image + test-long: + runs-on: ubuntu-latest + needs: [test-new] + services: + # https://docs.docker.com/build/ci/github-actions/local-registry/ + registry: + image: registry:2 + ports: + - 5000:5000 + steps: + - name: Maximize build disk space + uses: easimon/maximize-build-space@v10 + with: + # need space in /var for Docker images + root-reserve-mb: 30000 + remove-dotnet: true + remove-android: true + remove-haskell: true + remove-codeql: true + remove-docker-images: true + - name: Checkout + id: checkout + uses: actions/checkout@v4 + - name: Install test prerequisites + # From docker.yml + run: | + sudo DEBIAN_FRONTEND=noninteractive apt-get update + sudo DEBIAN_FRONTEND=noninteractive apt-get install tox + sudo apt-get clean + df -h + - name: Merge CI fixes from sagemath/sage + # From docker.yml + # This step needs to happen after the commit sha is put in DOCKER_TAG + # so that multi-stage builds can work correctly. + run: | + .ci/merge-fixes.sh env: - MAKE: make -j4 --output-sync=recurse - SAGE_NUM_THREADS: 4 + GH_TOKEN: ${{ github.token }} - - name: Check that all modules can be imported + # Building + + - name: Generate Dockerfile + # From docker.yml run: | - # The following command checks that all modules can be imported. - # The output also includes a long list of modules together with the number of tests in each module. - # This can be ignored. - ../sage -python -m pip install pytest-xdist - ../sage -python -m pytest -c tox.ini -qq --doctest --collect-only || true - working-directory: ./worktree-image/src + tox -e ${{ env.TOX_ENV }} + cp .tox/${{ env.TOX_ENV }}/Dockerfile . env: - # Increase the length of the lines in the "short summary" - COLUMNS: 120 + # Only generate the Dockerfile, do not run 'docker build' here + DOCKER_TARGETS: "" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver-opts: network=host + + - name: Build Docker image + id: image + uses: docker/build-push-action@v5 + with: + push: true + load: false + context: . + tags: ${{ env.BUILD_IMAGE }} + target: with-targets + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + NUMPROC=6 + USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse + TARGETS_PRE=build/make/Makefile + TARGETS=ci-build-with-fallback - - name: Pytest - if: contains(github.ref, 'pytest') + - name: Start container + id: container run: | - ../sage -python -m pip install coverage pytest-xdist - ../sage -python -m coverage run -m pytest -c tox.ini --doctest || true - working-directory: ./worktree-image/src - env: - # Increase the length of the lines in the "short summary" - COLUMNS: 120 + docker run --name BUILD -dit \ + --mount type=bind,src=$(pwd),dst=$(pwd) \ + --workdir $(pwd) \ + ${{ env.BUILD_IMAGE }} /bin/sh + + # Testing - name: Test all files (sage -t --all --long) - if: (success() || failure()) && steps.build.outcome == 'success' run: | ./sage -python -m pip install coverage - ./sage -python -m coverage run --rcfile=src/tox.ini src/bin/sage-runtests --all --long -p2 --format github --random-seed=286735480429121101562228604801325644303 - working-directory: ./worktree-image + ./sage -python -m coverage run --rcfile=src/tox.ini src/bin/sage-runtests --all --long -p4 --format github --random-seed=286735480429121101562228604801325644303 + shell: sh .ci/docker-exec-script.sh BUILD /sage {0} - - name: Prepare coverage results - if: (success() || failure()) && steps.build.outcome == 'success' + - name: Copy coverage results + if: (success() || failure()) && steps.container.outcome == 'success' run: | ./sage -python -m coverage combine --rcfile=src/tox.ini ./sage -python -m coverage xml --rcfile=src/tox.ini mkdir -p coverage-report mv coverage.xml coverage-report/ - working-directory: ./worktree-image + shell: sh .ci/docker-exec-script.sh BUILD /sage {0} - name: Upload coverage to codecov - if: (success() || failure()) && steps.build.outcome == 'success' + if: (success() || failure()) && steps.container.outcome == 'success' uses: codecov/codecov-action@v3 with: - directory: ./worktree-image/coverage-report + directory: ./coverage-report diff --git a/.github/workflows/ci-linux-incremental.yml b/.github/workflows/ci-linux-incremental.yml index 82b14472c55..4861ef1d1d0 100644 --- a/.github/workflows/ci-linux-incremental.yml +++ b/.github/workflows/ci-linux-incremental.yml @@ -19,7 +19,12 @@ on: pull_request: paths: - 'build/pkgs/**' - - 'pkgs/**' + - '!build/pkgs/sage_conf/**' + - '!build/pkgs/sage_docbuild/**' + - '!build/pkgs/sage_setup/**' + - '!build/pkgs/sage_sws2rst/**' + - '!build/pkgs/sagelib/**' + - '!build/pkgs/sagemath_*/**' workflow_dispatch: concurrency: diff --git a/.github/workflows/doc-build-pdf.yml b/.github/workflows/doc-build-pdf.yml index ee90f3a42fc..983455cacb0 100644 --- a/.github/workflows/doc-build-pdf.yml +++ b/.github/workflows/doc-build-pdf.yml @@ -20,13 +20,44 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +env: + # Same as in build.yml + TOX_ENV: "docker-${{ github.event.inputs.platform || 'ubuntu-jammy-standard' }}-incremental" + BUILD_IMAGE: "localhost:5000/${{ github.repository }}/sage-${{ github.event.inputs.platform || 'ubuntu-jammy-standard' }}-with-targets:ci" + FROM_DOCKER_REPOSITORY: "ghcr.io/sagemath/sage/" + FROM_DOCKER_TARGET: "with-targets" + FROM_DOCKER_TAG: ${{ github.event.inputs.docker_tag || 'dev'}} + EXTRA_CONFIGURE_ARGS: --enable-fat-binary + jobs: - get_ci_fixes: + build-docs-pdf: runs-on: ubuntu-latest + services: + # https://docs.docker.com/build/ci/github-actions/local-registry/ + registry: + image: registry:2 + ports: + - 5000:5000 steps: + - name: Maximize build disk space + uses: easimon/maximize-build-space@v8 + with: + # need space in /var for Docker images + root-reserve-mb: 30000 + remove-dotnet: true + remove-android: true + remove-haskell: true + remove-codeql: true + remove-docker-images: true - name: Checkout - id: checkout uses: actions/checkout@v4 + - name: Install test prerequisites + # From docker.yml + run: | + sudo DEBIAN_FRONTEND=noninteractive apt-get update + sudo DEBIAN_FRONTEND=noninteractive apt-get install tox + sudo apt-get clean + df -h - name: Merge CI fixes from sagemath/sage run: | mkdir -p upstream @@ -34,82 +65,64 @@ jobs: env: GH_TOKEN: ${{ github.token }} SAGE_CI_FIXES_FROM_REPOSITORIES: ${{ vars.SAGE_CI_FIXES_FROM_REPOSITORIES }} - - name: Store CI fixes in upstream artifact - run: | - if git format-patch --stdout test_base > ci_fixes.patch; then - cp ci_fixes.patch upstream/ - fi - - uses: actions/upload-artifact@v3 - with: - path: upstream - name: upstream - build-docs-pdf: - runs-on: ubuntu-latest - container: ghcr.io/sagemath/sage/sage-${{ github.event.inputs.platform || 'ubuntu-jammy-standard' }}-with-targets:${{ github.event.inputs.docker_tag || 'dev'}} - needs: [get_ci_fixes] - steps: - - name: Checkout - uses: actions/checkout@v4 + # Building - - name: Update system packages + - name: Generate Dockerfile + # From docker.yml run: | - export PATH="build/bin:$PATH" - eval $(sage-print-system-package-command auto update) - eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) - eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive texlive_luatex free_fonts xindy) + tox -e ${{ env.TOX_ENV }} + cp .tox/${{ env.TOX_ENV }}/Dockerfile . + env: + # Only generate the Dockerfile, do not run 'docker build' here + DOCKER_TARGETS: "" - - name: Add prebuilt tree as a worktree - id: worktree - run: | - git config --global --add safe.directory $(pwd) - git config --global user.email "ci-sage@example.com" - git config --global user.name "Build & Test workflow" - .ci/retrofit-worktree.sh worktree-image /sage + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver-opts: network=host - - name: Download upstream artifact - uses: actions/download-artifact@v3 + - name: Build Docker image + id: image + uses: docker/build-push-action@v5 with: - path: upstream - name: upstream + # push and load may not be set together at the moment + push: true + load: false + context: . + tags: ${{ env.BUILD_IMAGE }} + target: with-targets + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + NUMPROC=6 + USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse + TARGETS_PRE=build/make/Makefile + TARGETS=ci-build-with-fallback - - name: Apply CI fixes from sagemath/sage - # After applying the fixes, make sure all changes are marked as uncommitted changes. + - name: Start container run: | - if [ -r upstream/ci_fixes.patch ]; then - (cd worktree-image && git commit -q -m "current changes" --allow-empty -a && git am; git reset --quiet old; git add -N .) < upstream/ci_fixes.patch - fi + docker run --name BUILD -dit \ + --mount type=bind,src=$(pwd),dst=$(pwd) \ + --workdir $(pwd) \ + ${{ env.BUILD_IMAGE }} /bin/sh - - name: Incremental build - id: incremental - run: | - # Now re-bootstrap and build. The build is incremental because we were careful with the timestamps. - ./bootstrap && make build - working-directory: ./worktree-image - env: - MAKE: make -j4 --output-sync=recurse - SAGE_NUM_THREADS: 4 + # Docs - - name: Build (fallback to non-incremental) - id: build - if: (success() || failure()) && steps.worktree.outcome == 'success' && steps.incremental.outcome != 'success' + - name: Update system packages run: | - set -ex - make sagelib-clean && git clean -fx src/sage && ./config.status && make build - working-directory: ./worktree-image - env: - MAKE: make -j4 --output-sync=recurse - SAGE_NUM_THREADS: 4 + export PATH="build/bin:$PATH" + eval $(sage-print-system-package-command auto update) + eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) + eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive texlive_luatex free_fonts xindy) + shell: sh .ci/docker-exec-script.sh BUILD /sage {0} - name: Build docs (PDF) id: docbuild - if: (success() || failure()) && (steps.incremental.outcome == 'success' || steps.build.outcome == 'success') run: | + export MAKE="make -j5 --output-sync=recurse" SAGE_NUM_THREADS=5 make doc-clean doc-uninstall; make sagemath_doc_html-build-deps sagemath_doc_pdf-no-deps - working-directory: ./worktree-image - env: - MAKE: make -j4 --output-sync=recurse - SAGE_NUM_THREADS: 4 + shell: sh .ci/docker-exec-script.sh BUILD /sage {0} - name: Copy docs id: copy @@ -121,6 +134,7 @@ jobs: cp -r -L /sage/local/share/doc/sage/pdf ./docs # Zip everything for increased performance zip -r docs-pdf.zip docs + shell: sh .ci/docker-exec-script.sh BUILD /sage {0} - name: Upload docs if: (success() || failure()) && steps.copy.outcome == 'success' diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index b3c275d8e0a..a9a1ddece13 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -9,19 +9,59 @@ on: - develop workflow_dispatch: # Allow to run manually + inputs: + platform: + description: 'Platform' + required: true + default: 'ubuntu-jammy-standard' + docker_tag: + description: 'Docker tag' + required: true + default: 'dev' concurrency: # Cancel previous runs of this workflow for the same branch group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +env: + # Same as in build.yml + TOX_ENV: "docker-${{ github.event.inputs.platform || 'ubuntu-jammy-standard' }}-incremental" + BUILD_IMAGE: "localhost:5000/${{ github.repository }}/sage-${{ github.event.inputs.platform || 'ubuntu-jammy-standard' }}-with-targets:ci" + FROM_DOCKER_REPOSITORY: "ghcr.io/sagemath/sage/" + FROM_DOCKER_TARGET: "with-targets" + FROM_DOCKER_TAG: ${{ github.event.inputs.docker_tag || 'dev'}} + EXTRA_CONFIGURE_ARGS: --enable-fat-binary + jobs: - get_ci_fixes: + build-docs: runs-on: ubuntu-latest + services: + # https://docs.docker.com/build/ci/github-actions/local-registry/ + registry: + image: registry:2 + ports: + - 5000:5000 steps: + - name: Maximize build disk space + uses: easimon/maximize-build-space@v8 + with: + # need space in /var for Docker images + root-reserve-mb: 30000 + remove-dotnet: true + remove-android: true + remove-haskell: true + remove-codeql: true + remove-docker-images: true - name: Checkout - id: checkout uses: actions/checkout@v4 + - name: Install test prerequisites + # From docker.yml + run: | + sudo DEBIAN_FRONTEND=noninteractive apt-get update + sudo DEBIAN_FRONTEND=noninteractive apt-get install tox + sudo apt-get clean + df -h - name: Merge CI fixes from sagemath/sage run: | mkdir -p upstream @@ -29,120 +69,101 @@ jobs: env: GH_TOKEN: ${{ github.token }} SAGE_CI_FIXES_FROM_REPOSITORIES: ${{ vars.SAGE_CI_FIXES_FROM_REPOSITORIES }} - - name: Store CI fixes in upstream artifact + + # Building + + - name: Generate Dockerfile + # From docker.yml run: | - if git format-patch --stdout test_base > ci_fixes.patch; then - cp ci_fixes.patch upstream/ - fi - - uses: actions/upload-artifact@v3 - with: - path: upstream - name: upstream + tox -e ${{ env.TOX_ENV }} + cp .tox/${{ env.TOX_ENV }}/Dockerfile . + env: + # Only generate the Dockerfile, do not run 'docker build' here + DOCKER_TARGETS: "" - build-docs: - runs-on: ubuntu-latest - container: ghcr.io/sagemath/sage/sage-ubuntu-jammy-standard-with-targets:dev - needs: [get_ci_fixes] - steps: - - name: Checkout - uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver-opts: network=host - - name: Update system packages + - name: Build Docker image + id: image + uses: docker/build-push-action@v5 + with: + # push and load may not be set together at the moment + push: true + load: false + context: . + tags: ${{ env.BUILD_IMAGE }} + target: with-targets + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + NUMPROC=6 + USE_MAKEFLAGS=-k V=0 SAGE_NUM_THREADS=4 --output-sync=recurse + TARGETS_PRE=build/make/Makefile + TARGETS=ci-build-with-fallback + + - name: Start container run: | - apt-get update && apt-get install -y git zip + docker run --name BUILD -dit \ + --mount type=bind,src=$(pwd),dst=$(pwd) \ + --workdir $(pwd) \ + ${{ env.BUILD_IMAGE }} /bin/sh + + # Docs - - name: Add prebuilt tree as a worktree + - name: Store old docs id: worktree run: | git config --global --add safe.directory $(pwd) git config --global user.email "ci-sage@example.com" - git config --global user.name "Build & Test workflow" - # mathjax path in old doc - mathjax_path_from=$(SAGE_USE_CDNS=no /sage/sage -python -c "from sage_docbuild.conf import mathjax_path; print(mathjax_path)") - .ci/retrofit-worktree.sh worktree-image /sage + git config --global user.name "Build documentation workflow" + # mathjax path in old doc (regex) + mathjax_path_from="[-./A-Za-z_]*/tex-chtml[.]js?v=[0-9a-f]*" # mathjax path in new doc - mathjax_path_to=$(SAGE_USE_CDNS=yes /sage/sage -python -c "from sage_docbuild.conf import mathjax_path; print(mathjax_path)") - new_version=$(cat src/VERSION.txt) + mathjax_path_to=$(docker exec -e SAGE_USE_CDNS=yes BUILD /sage/sage -python -c "from sage_docbuild.conf import mathjax_path; print(mathjax_path)") + new_version=$(docker exec BUILD cat src/VERSION.txt) + mkdir -p docs/ + docker cp BUILD:/sage/local/share/doc/sage/html docs/ # Wipe out chronic diffs between old doc and new doc - (cd /sage/local/share/doc/sage/html && \ + (cd docs && \ find . -name "*.html" | xargs sed -i -e '/class="sidebar-brand-text"/ s/Sage [0-9a-z.]* /Sage '"$new_version"' /' \ -e 's;'"$mathjax_path_from"';'"$mathjax_path_to"';' \ -e '\;; d') # Create git repo from old doc - DOC_DIR=/sage/local/share/doc/sage/html - (cd $DOC_DIR && git init && \ + (cd docs && \ + git init && \ (echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && \ (echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; \ git add -A && git commit --quiet -m "old") - - name: Download upstream artifact - uses: actions/download-artifact@v3 - with: - path: upstream - name: upstream - - - name: Apply CI fixes from sagemath/sage - # After applying the fixes, make sure all changes are marked as uncommitted changes. - run: | - if [ -r upstream/ci_fixes.patch ]; then - (cd worktree-image && git commit -q -m "current changes" --allow-empty -a && git am; git reset --quiet old; git add -N .) < upstream/ci_fixes.patch - fi - - - name: Incremental build - id: incremental - run: | - # Now re-bootstrap and build. The build is incremental because we were careful with the timestamps. - ./bootstrap && make sagemath_doc_html-build-deps - working-directory: ./worktree-image - env: - MAKE: make -j4 --output-sync=recurse - SAGE_NUM_THREADS: 4 - - - name: Build (fallback to non-incremental) - id: build - if: (success() || failure()) && steps.worktree.outcome == 'success' && steps.incremental.outcome != 'success' - run: | - set -ex - make sagelib-clean && git clean -fx src/sage && ./config.status && make sagemath_doc_html-build-deps - working-directory: ./worktree-image - env: - MAKE: make -j4 --output-sync=recurse - SAGE_NUM_THREADS: 4 - - name: Build docs id: docbuild - if: (success() || failure()) && (steps.incremental.outcome == 'success' || steps.build.outcome == 'success') # Always non-incremental because of the concern that # incremental docbuild may introduce broken links (inter-file references) though build succeeds run: | - set -ex - DOC_DIR=/sage/local/share/doc/sage/html - mv $DOC_DIR/.git /sage/.git-doc + export MAKE="make -j5 --output-sync=recurse" SAGE_NUM_THREADS=5 make doc-clean doc-uninstall - mkdir -p $DOC_DIR/ && mv /sage/.git-doc $DOC_DIR/.git export SAGE_USE_CDNS=yes ./config.status && make sagemath_doc_html-no-deps - working-directory: ./worktree-image - env: - MAKE: make -j4 --output-sync=recurse - SAGE_NUM_THREADS: 4 + shell: sh .ci/docker-exec-script.sh BUILD /sage {0} - name: Copy docs id: copy if: (success() || failure()) && steps.docbuild.outcome == 'success' run: | set -ex - DOC_DIR=/sage/local/share/doc/sage/html - (cd $DOC_DIR && git commit -a -m 'new') - ls -l /sage/venv/bin - PATH=/sage/venv/bin:$PATH .ci/create-changes-html.sh $(cd $DOC_DIR; git rev-parse HEAD^) $DOC_DIR - (cd $DOC_DIR && rm -rf .git) # We copy everything to a local folder + docker cp BUILD:/sage/local/share/doc/sage/html docs + docker cp BUILD:/sage/local/share/doc/sage/index.html docs + (cd docs && git commit -a -m 'new') + .ci/create-changes-html.sh $(cd docs && git rev-parse HEAD^) docs + (cd docs && rm -rf .git) + mv CHANGES.html docs # We also need to replace the symlinks because netlify is not following them - mkdir -p ./docs - mv CHANGES.html ./docs - cp -r -L $DOC_DIR ./docs - cp $DOC_DIR/../index.html ./docs + # CHECK IF STILL NEEDED + #cp -r -L $DOC_DIR ./docs # Zip everything for increased performance zip -r docs.zip docs @@ -157,7 +178,7 @@ jobs: id: buildlivedoc if: (success() || failure()) && steps.copy.outcome == 'success' && github.repository == 'sagemath/sage' && github.ref == 'refs/heads/develop' run: | - set -ex + export MAKE="make -j5 --output-sync=recurse" SAGE_NUM_THREADS=5 export PATH="build/bin:$PATH" eval $(sage-print-system-package-command auto update) eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) @@ -167,21 +188,18 @@ jobs: export SAGE_JUPYTER_SERVER=binder:sagemath/sage-binder-env/dev make doc-clean doc-uninstall ./config.status && make sagemath_doc_html-no-deps sagemath_doc_pdf-no-deps - working-directory: ./worktree-image - env: - MAKE: make -j4 --output-sync=recurse - SAGE_NUM_THREADS: 4 + shell: sh .ci/docker-exec-script.sh BUILD ./worktree-image {0} - name: Copy live doc id: copylivedoc if: (success() || failure()) && steps.buildlivedoc.outcome == 'success' run: | - set -ex mkdir -p ./livedoc cp -r -L /sage/local/share/doc/sage/html ./livedoc cp -r -L /sage/local/share/doc/sage/pdf ./livedoc cp /sage/local/share/doc/sage/index.html ./livedoc zip -r livedoc.zip livedoc + shell: sh .ci/docker-exec-script.sh BUILD . {0} - name: Upload live doc if: (success() || failure()) && steps.copylivedoc.outcome == 'success' diff --git a/.github/workflows/pyright.yml b/.github/workflows/pyright.yml new file mode 100644 index 00000000000..cafe75db728 --- /dev/null +++ b/.github/workflows/pyright.yml @@ -0,0 +1,84 @@ +name: Static check with Pyright + +on: + pull_request: + merge_group: + push: + branches: + - master + - develop + workflow_dispatch: + # Allow to run manually + +concurrency: + # Cancel previous runs of this workflow for the same branch + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + pyright: + runs-on: ubuntu-latest + container: ghcr.io/sagemath/sage/sage-ubuntu-jammy-standard-with-targets:dev + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + + - name: Update system packages + id: prepare + run: | + export PATH="build/bin:$PATH" + eval $(sage-print-system-package-command auto update) + eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git) + + - name: Install GH CLI + uses: dev-hanz-ops/install-gh-cli-action@v0.1.0 + with: + gh-cli-version: 2.32.0 + + - name: Merge CI fixes from sagemath/sage + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + .ci/merge-fixes.sh + + - name: Add prebuilt tree as a worktree + id: worktree + run: | + set -ex + .ci/retrofit-worktree.sh worktree-image /sage + + - name: Incremental build (sagelib deps) + id: incremental + run: | + # Now re-bootstrap and build. The build is incremental because we were careful with the timestamps. + # pyright does not need a built sagelib; it only needs + # the libraries from which sagelib imports. + ./bootstrap && make sagelib-build-deps + working-directory: ./worktree-image + env: + MAKE: make -j2 --output-sync=recurse + SAGE_NUM_THREADS: 2 + + - name: Static code check with pyright + uses: jakebailey/pyright-action@v1 + with: + version: 1.1.332 + # Many warnings issued by pyright are not yet helpful because there is not yet enough type information. + no-comments: true + working-directory: ./worktree-image + env: + # To avoid out of memory errors + NODE_OPTIONS: --max-old-space-size=8192 + + - name: Static code check with pyright (annotated) + if: (success() || failure()) && steps.incremental.outcome == 'success' + uses: jakebailey/pyright-action@v1 + with: + version: 1.1.332 + # Issue errors + no-comments: false + level: error + working-directory: ./worktree-image + env: + # To avoid out of memory errors + NODE_OPTIONS: --max-old-space-size=8192 diff --git a/Makefile b/Makefile index 4dadbf823b8..799358d887b 100644 --- a/Makefile +++ b/Makefile @@ -87,6 +87,14 @@ download: dist: build/make/Makefile ./sage --sdist +ci-build-with-fallback: + $(MAKE) build && $(MAKE) SAGE_CHECK=no pypi-wheels; \ + if [ $$? != 0 ]; then \ + echo "Incremental build failed, falling back"; \ + $(MAKE) doc-clean doc-uninstall sagelib-clean; \ + $(MAKE) build && $(MAKE) SAGE_CHECK=no pypi-wheels; \ + fi + ############################################################################### # Cleaning up ############################################################################### diff --git a/build/bin/write-dockerfile.sh b/build/bin/write-dockerfile.sh index 3c62d6082e4..33518bdd4a6 100755 --- a/build/bin/write-dockerfile.sh +++ b/build/bin/write-dockerfile.sh @@ -33,7 +33,7 @@ echo "# to simplify writing scripts that customize this file" ADD="ADD $__CHOWN" RUN=RUN cat < /dev/null; then \ + (yes | unminimize) || echo "(ignored)"; \ + rm -f "$(command -v unminimize)"; \ + fi EOF if [ -n "$DIST_UPGRADE" ]; then cat <> .gitignore && \ + ./.ci/retrofit-worktree.sh worktree-image /sage); \ + else \ + for a in local logs; do \ + if [ -d /sage/\$a ]; then mv /sage/\$a /new/; fi; \ + done; \ + rm -rf /sage; \ + mv /new /sage; \ + fi; \ + else \ + mv /new /sage; \ + fi WORKDIR /sage -$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap bootstrap-conda configure.ac sage .homebrew-build-env tox.ini Pipfile.m4 ./ -$ADD config/config.rpath config/config.rpath -$ADD src/doc/bootstrap src/doc/bootstrap -$ADD src/bin src/bin -$ADD src/Pipfile.m4 src/pyproject.toml.m4 src/requirements.txt.m4 src/setup.cfg.m4 src/VERSION.txt src/ -$ADD m4 ./m4 -$ADD pkgs pkgs -$ADD build ./build -$ADD .upstream.d ./.upstream.d -ARG BOOTSTRAP=./bootstrap + +ARG BOOTSTRAP=${BOOTSTRAP-./bootstrap} $RUN sh -x -c "\${BOOTSTRAP}" $ENDRUN $THEN_SAVE_STATUS FROM bootstrapped as configured #:configuring: RUN $CHECK_STATUS_THEN mkdir -p logs/pkgs; rm -f config.log; ln -s logs/pkgs/config.log config.log -ARG EXTRA_CONFIGURE_ARGS="" +ARG EXTRA_CONFIGURE_ARGS="${CONFIGURE_ARGS}" EOF if [ ${WITH_SYSTEM_SPKG} = "force" ]; then cat <&2 "Error: failed to source $lib" + echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" + exit 1 + fi +done + export PIP_NO_INDEX=true export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS" -export TOX_PARALLEL_NO_SPINNER=1 +unset tox_args + wheel="$(sed -n '1s,.*@ file://,,p' $SAGE_SPKG_SCRIPTS/$PKG_BASE/spkg-requirements.txt)" -echo Running "tox -r -p auto -v --installpkg $wheel" -tox -r -p auto -v --installpkg "$wheel" +if [ -n "$wheel" ]; then + tox_envs=$(tox -l) + tox_args="-r -p auto -v --installpkg $wheel" +elif [ "$SAGE_EDITABLE" = yes ]; then + tox_envs=$(tox -l | sed s/norequirements/editable/) + # FIXME: Should use -r if sage_setup or another build requirement changes + tox_args="-r -v -v -v -v -e $(echo $tox_envs | sed 's/ /,/g')" +else + echo "Not testing the package because SAGE_WHEELS=$SAGE_WHEELS and SAGE_EDITABLE=$SAGE_EDITABLE" + exit 0 +fi + +export TOX_PARALLEL_NO_SPINNER=1 + +echo Running "tox $tox_args" +tox $tox_args status=$? case $status:$SAGE_CHECK:$([ -r known-test-failures.json ]; echo $?) in + 0:no:*) echo "Not testing the package because SAGE_CHECK=no";; 0:*:0) echo "Passed the test suite (modulo baseline known-test-failures*.json)";; 0:*:*) echo "Passed the test suite";; *:warn:0) echo "Warning: New failures (not in baseline known-test-failures*.json (ignored)"; status=0;; @@ -18,10 +48,12 @@ case $status:$SAGE_CHECK:$([ -r known-test-failures.json ]; echo $?) in *:yes:*) echo "Failures testing the package";; esac # Show summaries of failures (suppress lines ending with '[failed in baseline]') -for f in $(pwd)/.tox/sagepython-sagewheels-nopypi-norequirements*/log/*-command*.log; do - if [ -r "$f" ]; then - echo "$f" - grep '^sage -t.*#[^]]*$' "$f" - fi +for e in $tox_envs; do + for f in $(pwd)/.tox/$e/log/*-command*.log; do + if [ -r "$f" ]; then + echo "$f" + grep '^sage -t.*#[^]]*$' "$f" + fi + done done exit $status diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini index 1a88d2a7464..bcd55128882 100644 --- a/build/pkgs/setuptools/checksums.ini +++ b/build/pkgs/setuptools/checksums.ini @@ -1,5 +1,5 @@ tarball=setuptools-VERSION-py3-none-any.whl -sha1=4227225bb193e3a45542f45966caf777d4c913e8 -md5=f096ed836f4036a11aa277fa16dc09ff -cksum=263664173 +sha1=49841be6743b2d129d01d02d5fd339dd693c99dc +md5=1555b24e28b53f3342e557500dedf8f3 +cksum=3445997019 upstream_url=https://pypi.io/packages/py3/s/setuptools/setuptools-VERSION-py3-none-any.whl diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt index 2c021f541a8..2a93f495d25 100644 --- a/build/pkgs/setuptools/package-version.txt +++ b/build/pkgs/setuptools/package-version.txt @@ -1 +1 @@ -69.0.2 +69.5.1 diff --git a/build/pkgs/trove_classifiers/checksums.ini b/build/pkgs/trove_classifiers/checksums.ini index 7350f444667..8bd0eca4933 100644 --- a/build/pkgs/trove_classifiers/checksums.ini +++ b/build/pkgs/trove_classifiers/checksums.ini @@ -1,5 +1,5 @@ tarball=trove_classifiers-VERSION-py3-none-any.whl -sha1=c341abee77b5c87d913b86dc587e544553f0658c -md5=78e67f128f53b8417134429192810701 -cksum=3034057088 +sha1=36240d053d16400380aee01f0879785693008a96 +md5=02b3e7b2eb81c3656fa859a87482f120 +cksum=1500381935 upstream_url=https://pypi.io/packages/py3/t/trove_classifiers/trove_classifiers-VERSION-py3-none-any.whl diff --git a/build/pkgs/trove_classifiers/package-version.txt b/build/pkgs/trove_classifiers/package-version.txt index a33bd2f9968..c296ac66b65 100644 --- a/build/pkgs/trove_classifiers/package-version.txt +++ b/build/pkgs/trove_classifiers/package-version.txt @@ -1 +1 @@ -2023.11.29 +2024.4.10 diff --git a/build/pkgs/wheel/checksums.ini b/build/pkgs/wheel/checksums.ini index 4f2b8c5c534..6e28451ce44 100644 --- a/build/pkgs/wheel/checksums.ini +++ b/build/pkgs/wheel/checksums.ini @@ -1,5 +1,5 @@ tarball=wheel-VERSION-py3-none-any.whl -sha1=fcf4ad8d5d8216d661bc98eede0d9210cbc5b697 -md5=779d91395ceb12e15e3a585b30b53f9f -cksum=1421399426 +sha1=71a83a2237cb57ab45bdafed364564e36ca5dc95 +md5=e65b1197e1dfc6bbc8df362935f5943d +cksum=1664872683 upstream_url=https://pypi.io/packages/py3/w/wheel/wheel-VERSION-py3-none-any.whl diff --git a/build/pkgs/wheel/package-version.txt b/build/pkgs/wheel/package-version.txt index 787ffc30a81..8298bb08b2d 100644 --- a/build/pkgs/wheel/package-version.txt +++ b/build/pkgs/wheel/package-version.txt @@ -1 +1 @@ -0.42.0 +0.43.0 diff --git a/pkgs/sage-conf_pypi/tox.ini b/pkgs/sage-conf_pypi/tox.ini index fadf9a9cc6c..7160d4db678 100644 --- a/pkgs/sage-conf_pypi/tox.ini +++ b/pkgs/sage-conf_pypi/tox.ini @@ -1,6 +1,10 @@ [tox] envlist = py39, py310, py311, py39-user, py310-user, py311-user +requires = + # Because of https://github.com/tox-dev/tox/issues/3238, need <4.14.1 + tox<4.14.1 + [testenv:.pkg] basepython = py311 passenv = diff --git a/pkgs/sage-docbuild/tox.ini b/pkgs/sage-docbuild/tox.ini index 77da5a78ede..efa222028ff 100644 --- a/pkgs/sage-docbuild/tox.ini +++ b/pkgs/sage-docbuild/tox.ini @@ -8,6 +8,10 @@ # [tox] +requires = + # Because of https://github.com/tox-dev/tox/issues/3238, need <4.14.1 + tox<4.14.1 + [testenv] deps = -rrequirements.txt diff --git a/pkgs/sage-setup/tox.ini b/pkgs/sage-setup/tox.ini index fd935f2e978..e8a22f03101 100644 --- a/pkgs/sage-setup/tox.ini +++ b/pkgs/sage-setup/tox.ini @@ -12,6 +12,10 @@ # [tox] +requires = + # Because of https://github.com/tox-dev/tox/issues/3238, need <4.14.1 + tox<4.14.1 + [testenv] deps = -rrequirements.txt diff --git a/pkgs/sagemath-categories/known-test-failures.json b/pkgs/sagemath-categories/known-test-failures.json index ddae185a7d9..ab27f65ca8d 100644 --- a/pkgs/sagemath-categories/known-test-failures.json +++ b/pkgs/sagemath-categories/known-test-failures.json @@ -26,7 +26,7 @@ "ntests": 28 }, "sage.categories.affine_weyl_groups": { - "ntests": 14 + "ntests": 15 }, "sage.categories.algebra_ideals": { "failed": true, @@ -38,7 +38,7 @@ }, "sage.categories.algebras": { "failed": true, - "ntests": 20 + "ntests": 25 }, "sage.categories.algebras_with_basis": { "failed": true, @@ -126,7 +126,7 @@ }, "sage.categories.commutative_rings": { "failed": true, - "ntests": 39 + "ntests": 41 }, "sage.categories.complete_discrete_valuation": { "failed": true, @@ -148,15 +148,19 @@ }, "sage.categories.coxeter_groups": { "failed": true, - "ntests": 362 + "ntests": 392 }, "sage.categories.cw_complexes": { "failed": true, "ntests": 36 }, + "sage.categories.dedekind_domains": { + "failed": true, + "ntests": 30 + }, "sage.categories.discrete_valuation": { "failed": true, - "ntests": 23 + "ntests": 28 }, "sage.categories.distributive_magmas_and_additive_magmas": { "failed": true, @@ -169,9 +173,6 @@ "failed": true, "ntests": 7 }, - "sage.categories.drinfeld_modules": { - "ntests": 2 - }, "sage.categories.dual": { "failed": true, "ntests": 1 @@ -297,18 +298,18 @@ }, "sage.categories.filtered_modules_with_basis": { "failed": true, - "ntests": 65 + "ntests": 74 }, "sage.categories.finite_complex_reflection_groups": { "failed": true, - "ntests": 178 + "ntests": 189 }, "sage.categories.finite_coxeter_groups": { "ntests": 6 }, "sage.categories.finite_dimensional_algebras_with_basis": { "failed": true, - "ntests": 87 + "ntests": 91 }, "sage.categories.finite_dimensional_bialgebras_with_basis": { "failed": true, @@ -328,11 +329,11 @@ }, "sage.categories.finite_dimensional_lie_algebras_with_basis": { "failed": true, - "ntests": 34 + "ntests": 73 }, "sage.categories.finite_dimensional_modules_with_basis": { "failed": true, - "ntests": 55 + "ntests": 89 }, "sage.categories.finite_dimensional_nilpotent_lie_algebras_with_basis": { "failed": true, @@ -493,10 +494,6 @@ "failed": true, "ntests": 13 }, - "sage.categories.inner_product_spaces": { - "failed": true, - "ntests": 9 - }, "sage.categories.integral_domains": { "failed": true, "ntests": 22 @@ -530,7 +527,7 @@ }, "sage.categories.lie_algebras": { "failed": true, - "ntests": 125 + "ntests": 135 }, "sage.categories.lie_algebras_with_basis": { "ntests": 19 @@ -586,7 +583,7 @@ }, "sage.categories.modules_with_basis": { "failed": true, - "ntests": 221 + "ntests": 240 }, "sage.categories.monoid_algebras": { "failed": true, @@ -598,7 +595,7 @@ }, "sage.categories.morphism": { "failed": true, - "ntests": 99 + "ntests": 126 }, "sage.categories.number_fields": { "failed": true, @@ -668,14 +665,14 @@ }, "sage.categories.rings": { "failed": true, - "ntests": 141 + "ntests": 146 }, "sage.categories.rngs": { "ntests": 6 }, "sage.categories.schemes": { "failed": true, - "ntests": 23 + "ntests": 41 }, "sage.categories.semigroups": { "failed": true, @@ -711,7 +708,7 @@ }, "sage.categories.simplicial_sets": { "failed": true, - "ntests": 57 + "ntests": 98 }, "sage.categories.subobjects": { "ntests": 2 @@ -765,7 +762,7 @@ }, "sage.categories.unital_algebras": { "failed": true, - "ntests": 39 + "ntests": 37 }, "sage.categories.vector_spaces": { "failed": true, @@ -783,7 +780,7 @@ }, "sage.cpython.debug": { "failed": true, - "ntests": 14 + "ntests": 13 }, "sage.cpython.dict_del_by_value": { "failed": true, @@ -808,30 +805,28 @@ }, "sage.doctest.control": { "failed": true, - "ntests": 0 + "ntests": 230 }, "sage.doctest.external": { "ntests": 42 }, "sage.doctest.fixtures": { - "failed": true, "ntests": 59 }, "sage.doctest.forker": { "failed": true, - "ntests": 433 + "ntests": 413 }, "sage.doctest.parsing": { "failed": true, - "ntests": 321 + "ntests": 313 }, "sage.doctest.reporting": { - "failed": true, - "ntests": 124 + "ntests": 115 }, "sage.doctest.sources": { "failed": true, - "ntests": 378 + "ntests": 343 }, "sage.doctest.test": { "failed": true, @@ -846,7 +841,7 @@ "ntests": 41 }, "sage.features": { - "ntests": 145 + "ntests": 143 }, "sage.features.all": { "ntests": 14 @@ -865,17 +860,23 @@ }, "sage.features.databases": { "failed": true, - "ntests": 26 + "ntests": 38 }, "sage.features.dvipng": { "ntests": 4 }, + "sage.features.ecm": { + "ntests": 4 + }, "sage.features.ffmpeg": { "ntests": 4 }, "sage.features.four_ti_2": { "ntests": 6 }, + "sage.features.fricas": { + "ntests": 6 + }, "sage.features.gap": { "ntests": 6 }, @@ -901,7 +902,11 @@ "sage.features.internet": { "ntests": 5 }, + "sage.features.jmol": { + "ntests": 4 + }, "sage.features.join_feature": { + "failed": true, "ntests": 25 }, "sage.features.kenzo": { @@ -960,7 +965,7 @@ }, "sage.features.sagemath": { "failed": true, - "ntests": 147 + "ntests": 151 }, "sage.features.singular": { "ntests": 4 @@ -968,9 +973,16 @@ "sage.features.sphinx": { "ntests": 4 }, + "sage.features.symengine_py": { + "ntests": 4 + }, "sage.features.tdlib": { "ntests": 2 }, + "sage.features.threejs": { + "failed": true, + "ntests": 6 + }, "sage.misc.abstract_method": { "failed": true, "ntests": 33 @@ -1001,7 +1013,7 @@ }, "sage.misc.decorators": { "failed": true, - "ntests": 126 + "ntests": 125 }, "sage.misc.fast_methods": { "failed": true, @@ -1059,7 +1071,7 @@ }, "sage.misc.package_dir": { "failed": true, - "ntests": 29 + "ntests": 35 }, "sage.misc.persist": { "failed": true, @@ -1091,7 +1103,7 @@ }, "sage.misc.sageinspect": { "failed": true, - "ntests": 329 + "ntests": 322 }, "sage.misc.superseded": { "failed": true, @@ -1157,7 +1169,7 @@ }, "sage.repl.interpreter": { "failed": true, - "ntests": 118 + "ntests": 114 }, "sage.repl.ipython_extension": { "failed": true, @@ -1165,13 +1177,14 @@ }, "sage.repl.ipython_kernel.install": { "failed": true, - "ntests": 40 + "ntests": 35 }, "sage.repl.ipython_kernel.interact": { "failed": true, "ntests": 42 }, "sage.repl.ipython_kernel.kernel": { + "failed": true, "ntests": 12 }, "sage.repl.ipython_kernel.widgets": { @@ -1188,7 +1201,7 @@ }, "sage.repl.load": { "failed": true, - "ntests": 42 + "ntests": 38 }, "sage.repl.preparse": { "failed": true, @@ -1206,7 +1219,7 @@ }, "sage.repl.rich_output.backend_ipython": { "failed": true, - "ntests": 78 + "ntests": 75 }, "sage.repl.rich_output.buffer": { "failed": true, @@ -1214,7 +1227,7 @@ }, "sage.repl.rich_output.display_manager": { "failed": true, - "ntests": 88 + "ntests": 86 }, "sage.repl.rich_output.output_basic": { "ntests": 47 @@ -1251,7 +1264,7 @@ }, "sage.rings.ring": { "failed": true, - "ntests": 337 + "ntests": 298 }, "sage.sets.pythonclass": { "failed": true, @@ -1263,7 +1276,7 @@ }, "sage.structure.coerce": { "failed": true, - "ntests": 314 + "ntests": 310 }, "sage.structure.coerce_actions": { "failed": true, @@ -1298,7 +1311,7 @@ }, "sage.structure.factorization": { "failed": true, - "ntests": 203 + "ntests": 200 }, "sage.structure.factorization_integer": { "failed": true, @@ -1315,9 +1328,6 @@ "sage.structure.global_options": { "ntests": 145 }, - "sage.structure.graphics_file": { - "ntests": 8 - }, "sage.structure.indexed_generators": { "failed": true, "ntests": 90 @@ -1345,7 +1355,7 @@ }, "sage.structure.parent": { "failed": true, - "ntests": 300 + "ntests": 303 }, "sage.structure.parent_gens": { "failed": true, diff --git a/pkgs/sagemath-categories/requirements-editable.txt.m4 b/pkgs/sagemath-categories/requirements-editable.txt.m4 new file mode 100644 index 00000000000..1c0abbe40ae --- /dev/null +++ b/pkgs/sagemath-categories/requirements-editable.txt.m4 @@ -0,0 +1,7 @@ +include(`sage_spkg_versions.m4')dnl +dnl Same as setup.cfg.m4 install_requires; FIXME: should pin to built wheels. +SPKG_INSTALL_REQUIRES_gmpy2 +SPKG_INSTALL_REQUIRES_cysignals +SPKG_INSTALL_REQUIRES_memory_allocator +-e ../sagemath-environment +-e ../sagemath-objects diff --git a/pkgs/sagemath-categories/tox.ini b/pkgs/sagemath-categories/tox.ini index b4bb49d132a..841209e88f1 100644 --- a/pkgs/sagemath-categories/tox.ini +++ b/pkgs/sagemath-categories/tox.ini @@ -13,7 +13,9 @@ envlist = requires = # Auto-provision a modern tox. # [pkgenv] added in 4.2 - https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance + # Because of https://github.com/tox-dev/tox/issues/3238, need <4.14.1 tox>=4.2 + tox<4.14.1 [pkgenv] # Environment in which to build the sdist. @@ -49,6 +51,11 @@ passenv = {[pkgenv]passenv} setenv = {[pkgenv]setenv} # Sage scripts such as sage-runtests like to use $HOME/.sage HOME={envdir} + # Stop 'sage -t --installed' from picking up doc installed in SAGE_LOCAL + SAGE_DOC=/doesnotexist + KNOWN_TEST_FAILURES={toxinidir}/known-test-failures.json + # See src/bin/sage-env + PYDEVD_DISABLE_FILE_VALIDATION=1 allowlist_externals = bash @@ -61,7 +68,7 @@ commands = {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.categories.all import *; SimplicialComplexes(); FunctionFields()' bash -c 'cd $(python -c "import sys; \"\" in sys.path and sys.path.remove(\"\"); from sage.env import SAGE_LIB; print(SAGE_LIB)") \ - && sage-runtests -p --initial --environment=sage.all__sagemath_categories --probe all --baseline-stats-path={toxinidir}/known-test-failures.json --optional=sage --installed' + && sage-runtests -p --force-lib --initial --environment=sage.all__sagemath_categories --probe all --baseline-stats-path=$KNOWN_TEST_FAILURES --optional=sage --installed' [testenv:.tox] # Allow access to PyPI for auto-provisioning a suitable tox version @@ -84,6 +91,11 @@ setenv = {[pkgenv]setenv} basepython = {env:SAGE_VENV}/bin/python3 +[testenv:.pkg-sagepython-sagewheels-nopypi-editable] +config_settings_build_editable = + editable_mode = strict + + [testenv:sagepython] basepython = {env:SAGE_VENV}/bin/python3 package_env = .pkg-sagepython @@ -92,10 +104,6 @@ package_env = .pkg-sagepython basepython = {env:SAGE_VENV}/bin/python3 package_env = .pkg-sagepython-sagewheels-nopypi -[testenv:sagepython-sagewheels-nopypi-norequirements] -basepython = {env:SAGE_VENV}/bin/python3 -package_env = .pkg-sagepython-sagewheels-nopypi - [testenv:sagepython-sagewheels] basepython = {env:SAGE_VENV}/bin/python package_env = .pkg-sagepython @@ -103,3 +111,16 @@ package_env = .pkg-sagepython [testenv:sagepython-norequirements] basepython = {env:SAGE_VENV}/bin/python3 package_env = .pkg-sagepython + + +[testenv:sagepython-sagewheels-nopypi-norequirements] +basepython = {env:SAGE_VENV}/bin/python3 +package_env = .pkg-sagepython-sagewheels-nopypi + +[testenv:sagepython-sagewheels-nopypi-editable] +basepython = {env:SAGE_VENV}/bin/python3 +package_env = .pkg-sagepython-sagewheels-nopypi-editable +package = editable +deps = -r requirements-editable.txt +config_settings_build_editable = + editable_mode = strict diff --git a/pkgs/sagemath-environment/requirements-editable.txt.m4 b/pkgs/sagemath-environment/requirements-editable.txt.m4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/pkgs/sagemath-environment/tox.ini b/pkgs/sagemath-environment/tox.ini index 6bf1f2a6ebb..5d741bd0b48 100644 --- a/pkgs/sagemath-environment/tox.ini +++ b/pkgs/sagemath-environment/tox.ini @@ -13,7 +13,9 @@ envlist = requires = # Auto-provision a modern tox. # [pkgenv] added in 4.2 - https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance + # Because of https://github.com/tox-dev/tox/issues/3238, need <4.14.1 tox>=4.2 + tox<4.14.1 [pkgenv] # Environment in which to build the sdist. @@ -49,6 +51,9 @@ passenv = {[pkgenv]passenv} setenv = {[pkgenv]setenv} # Sage scripts such as sage-runtests like to use $HOME/.sage HOME={envdir} + # Stop 'sage -t --installed' from picking up doc installed in SAGE_LOCAL + SAGE_DOC=/doesnotexist + KNOWN_TEST_FAILURES={toxinidir}/known-test-failures.json allowlist_externals = bash @@ -78,6 +83,11 @@ setenv = {[pkgenv]setenv} basepython = {env:SAGE_VENV}/bin/python3 +[testenv:.pkg-sagepython-sagewheels-nopypi-editable] +config_settings_build_editable = + editable_mode = strict + + [testenv:sagepython] basepython = {env:SAGE_VENV}/bin/python3 package_env = .pkg-sagepython @@ -98,3 +108,11 @@ package_env = .pkg-sagepython [testenv:sagepython-sagewheels-nopypi-norequirements] basepython = {env:SAGE_VENV}/bin/python3 package_env = .pkg-sagepython-sagewheels-nopypi + +[testenv:sagepython-sagewheels-nopypi-editable] +basepython = {env:SAGE_VENV}/bin/python3 +package_env = .pkg-sagepython-sagewheels-nopypi-editable +package = editable +deps = -r requirements-editable.txt +config_settings_build_editable = + editable_mode = strict diff --git a/pkgs/sagemath-objects/requirements-editable.txt.m4 b/pkgs/sagemath-objects/requirements-editable.txt.m4 new file mode 100644 index 00000000000..df9b22b43aa --- /dev/null +++ b/pkgs/sagemath-objects/requirements-editable.txt.m4 @@ -0,0 +1,4 @@ +include(`sage_spkg_versions.m4')dnl +dnl Same as setup.cfg.m4 install_requires; FIXME: should pin to built wheels. +SPKG_INSTALL_REQUIRES_gmpy2 +SPKG_INSTALL_REQUIRES_cysignals diff --git a/pkgs/sagemath-objects/tox.ini b/pkgs/sagemath-objects/tox.ini index a8f5a6d6a76..a7b91f55990 100644 --- a/pkgs/sagemath-objects/tox.ini +++ b/pkgs/sagemath-objects/tox.ini @@ -13,7 +13,9 @@ envlist = requires = # Auto-provision a modern tox. # [pkgenv] added in 4.2 - https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance + # Because of https://github.com/tox-dev/tox/issues/3238, need <4.14.1 tox>=4.2 + tox<4.14.1 [pkgenv] # Environment in which to build the sdist. @@ -49,6 +51,9 @@ passenv = {[pkgenv]passenv} setenv = {[pkgenv]setenv} # Sage scripts such as sage-runtests like to use $HOME/.sage HOME={envdir} + # Stop 'sage -t --installed' from picking up doc installed in SAGE_LOCAL + SAGE_DOC=/doesnotexist + KNOWN_TEST_FAILURES={toxinidir}/known-test-failures.json allowlist_externals = bash @@ -82,6 +87,11 @@ setenv = {[pkgenv]setenv} basepython = {env:SAGE_VENV}/bin/python3 +[testenv:.pkg-sagepython-sagewheels-nopypi-editable] +config_settings_build_editable = + editable_mode = strict + + [testenv:sagepython] basepython = {env:SAGE_VENV}/bin/python3 package_env = .pkg-sagepython @@ -102,3 +112,11 @@ package_env = .pkg-sagepython [testenv:sagepython-sagewheels-nopypi-norequirements] basepython = {env:SAGE_VENV}/bin/python3 package_env = .pkg-sagepython-sagewheels-nopypi + +[testenv:sagepython-sagewheels-nopypi-editable] +basepython = {env:SAGE_VENV}/bin/python3 +package_env = .pkg-sagepython-sagewheels-nopypi-editable +package = editable +deps = -r requirements-editable.txt +config_settings_build_editable = + editable_mode = strict diff --git a/pkgs/sagemath-repl/pyproject.toml.m4 b/pkgs/sagemath-repl/pyproject.toml.m4 index 2d2f13008be..459a599f1fb 100644 --- a/pkgs/sagemath-repl/pyproject.toml.m4 +++ b/pkgs/sagemath-repl/pyproject.toml.m4 @@ -13,8 +13,10 @@ description = "Sage: Open Source Mathematics Software: IPython kernel, Sage prep dependencies = [ SPKG_INSTALL_REQUIRES_sagemath_objects SPKG_INSTALL_REQUIRES_sagemath_environment + SPKG_INSTALL_REQUIRES_ipykernel SPKG_INSTALL_REQUIRES_ipython SPKG_INSTALL_REQUIRES_ipywidgets + SPKG_INSTALL_REQUIRES_jupyter_client ] dynamic = ["version"] include(`pyproject_toml_metadata.m4')dnl' diff --git a/pkgs/sagemath-repl/requirements-editable.txt.m4 b/pkgs/sagemath-repl/requirements-editable.txt.m4 new file mode 100644 index 00000000000..fa89ade7621 --- /dev/null +++ b/pkgs/sagemath-repl/requirements-editable.txt.m4 @@ -0,0 +1,11 @@ +include(`sage_spkg_versions.m4')dnl +dnl Same as setup.cfg.m4 install_requires (+ their install-requires) +dnl FIXME: should pin to built wheels. +SPKG_INSTALL_REQUIRES_gmpy2 +SPKG_INSTALL_REQUIRES_cysignals +SPKG_INSTALL_REQUIRES_memory_allocator +SPKG_INSTALL_REQUIRES_ipython +SPKG_INSTALL_REQUIRES_ipywidgets +dnl To be added when ready for editable: +-e ../sagemath-environment +-e ../sagemath-objects diff --git a/pkgs/sagemath-repl/tox.ini b/pkgs/sagemath-repl/tox.ini index 679153a2947..d7b557761ac 100644 --- a/pkgs/sagemath-repl/tox.ini +++ b/pkgs/sagemath-repl/tox.ini @@ -13,7 +13,9 @@ envlist = requires = # Auto-provision a modern tox. # [pkgenv] added in 4.2 - https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance + # Because of https://github.com/tox-dev/tox/issues/3238, need <4.14.1 tox>=4.2 + tox<4.14.1 [pkgenv] # Environment in which to build the sdist. @@ -49,6 +51,11 @@ passenv = {[pkgenv]passenv} setenv = {[pkgenv]setenv} # Sage scripts such as sage-runtests like to use $HOME/.sage HOME={envdir} + # Stop 'sage -t --installed' from picking up doc installed in SAGE_LOCAL + SAGE_DOC=/doesnotexist + KNOWN_TEST_FAILURES={toxinidir}/known-test-failures.json + # See src/bin/sage-env + PYDEVD_DISABLE_FILE_VALIDATION=1 allowlist_externals = bash @@ -57,7 +64,7 @@ commands = # Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package. {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.repl.all; import sage.doctest.all' - bash -c 'cd $({envpython} -c "import sys; \"\" in sys.path and sys.path.remove(\"\"); from sage.env import SAGE_LIB; print(SAGE_LIB)") && sage-runtests -p --environment=sage.all__sagemath_repl --baseline-stats-path={toxinidir}/known-test-failures.json --initial --optional=sage sage/repl sage/doctest sage/misc/sage_input.py sage/misc/sage_eval.py' + bash -c 'cd $({envpython} -c "import sys; \"\" in sys.path and sys.path.remove(\"\"); from sage.env import SAGE_LIB; print(SAGE_LIB)") && sage-runtests -p --environment=sage.all__sagemath_repl --baseline-stats-path=$KNOWN_TEST_FAILURES --initial --optional=sage sage/repl sage/doctest sage/misc/sage_input.py sage/misc/sage_eval.py' [testenv:.tox] # Allow access to PyPI for auto-provisioning a suitable tox version @@ -80,6 +87,11 @@ setenv = {[pkgenv]setenv} basepython = {env:SAGE_VENV}/bin/python3 +[testenv:.pkg-sagepython-sagewheels-nopypi-editable] +config_settings_build_editable = + editable_mode = strict + + [testenv:sagepython] basepython = {env:SAGE_VENV}/bin/python3 package_env = .pkg-sagepython @@ -88,10 +100,6 @@ package_env = .pkg-sagepython basepython = {env:SAGE_VENV}/bin/python3 package_env = .pkg-sagepython-sagewheels-nopypi -[testenv:sagepython-sagewheels-nopypi-norequirements] -basepython = {env:SAGE_VENV}/bin/python3 -package_env = .pkg-sagepython-sagewheels-nopypi - [testenv:sagepython-sagewheels] basepython = {env:SAGE_VENV}/bin/python package_env = .pkg-sagepython @@ -99,3 +107,16 @@ package_env = .pkg-sagepython [testenv:sagepython-norequirements] basepython = {env:SAGE_VENV}/bin/python3 package_env = .pkg-sagepython + + +[testenv:sagepython-sagewheels-nopypi-norequirements] +basepython = {env:SAGE_VENV}/bin/python3 +package_env = .pkg-sagepython-sagewheels-nopypi + +[testenv:sagepython-sagewheels-nopypi-editable] +basepython = {env:SAGE_VENV}/bin/python3 +package_env = .pkg-sagepython-sagewheels-nopypi-editable +package = editable +deps = -r requirements-editable.txt +config_settings_build_editable = + editable_mode = strict diff --git a/pkgs/sagemath-standard/tox.ini b/pkgs/sagemath-standard/tox.ini index 6aae1ef1bfa..c197f49d9be 100644 --- a/pkgs/sagemath-standard/tox.ini +++ b/pkgs/sagemath-standard/tox.ini @@ -62,7 +62,9 @@ envlist = requires = # Auto-provision a modern tox. # [pkgenv] added in 4.2 - https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance + # Because of https://github.com/tox-dev/tox/issues/3238, need <4.14.1 tox>=4.2 + tox<4.14.1 [pkgenv] # Environment in which to build the sdist. diff --git a/src/sage/doctest/reporting.py b/src/sage/doctest/reporting.py index 600a18b0e8d..74b823becc2 100644 --- a/src/sage/doctest/reporting.py +++ b/src/sage/doctest/reporting.py @@ -145,7 +145,8 @@ def were_doctests_with_optional_tag_run(self, tag): When latex is available, doctests marked with optional tag ``latex`` are run by default since :issue:`32174`:: - sage: filename = os.path.join(SAGE_SRC,'sage','misc','latex.py') + sage: # needs SAGE_SRC + sage: filename = os.path.join(SAGE_SRC, 'sage', 'misc', 'latex.py') sage: DC = DocTestController(DocTestDefaults(), [filename]) sage: DTR = DocTestReporter(DC) sage: DTR.were_doctests_with_optional_tag_run('latex') # optional - latex diff --git a/src/sage/features/__init__.py b/src/sage/features/__init__.py index a8b11ef7db5..ebeb55527a8 100644 --- a/src/sage/features/__init__.py +++ b/src/sage/features/__init__.py @@ -948,7 +948,10 @@ def _is_present(self): # Available since https://setuptools.pypa.io/en/latest/history.html#v59-0-0 from setuptools.errors import CCompilerError except ImportError: - from distutils.errors import CCompilerError + try: + from distutils.errors import CCompilerError + except ImportError: + CCompilerError = () with open(tmp_filename(ext=".pyx"), 'w') as pyx: pyx.write(self.test_code) try: diff --git a/src/sage/misc/package.py b/src/sage/misc/package.py index cc7ac5fdfb2..01b4b8e5ce7 100644 --- a/src/sage/misc/package.py +++ b/src/sage/misc/package.py @@ -178,16 +178,16 @@ def pip_installed_packages(normalization=None): sage: # optional - sage_spkg sage: from sage.misc.package import pip_installed_packages sage: d = pip_installed_packages() - sage: 'scipy' in d or 'SciPy' in d + sage: 'scipy' in d or 'SciPy' in d # needs scipy + True + sage: 'beautifulsoup4' in d # needs beautifulsoup4 + True + sage: 'prompt-toolkit' in d or 'prompt_toolkit' in d # whether - or _ appears in the name depends on the setuptools version used for building the package True - sage: d['beautifulsoup4'] # optional - beautifulsoup4 - '...' - sage: d['prompt-toolkit'] - '...' sage: d = pip_installed_packages(normalization='spkg') sage: d['prompt_toolkit'] '...' - sage: d['scipy'] + sage: d['scipy'] # needs scipy '...' """ with open(os.devnull, 'w') as devnull: diff --git a/src/tox.ini b/src/tox.ini index aab671441a9..ca69ed6c8bf 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -26,8 +26,10 @@ envlist = doctest, coverage, startuptime, pycodestyle-minimal, relint, codespell skipsdist = true requires = - # For the renamed "allowlist_externals" keyword + # For the renamed "allowlist_externals" keyword, need >= 3.18 + # Because of https://github.com/tox-dev/tox/issues/3238, need <4.14.1 tox>=3.18 + tox<4.14.1 [sagedirect] # Base for tox environments that bypass the virtual environment set up by tox, @@ -86,6 +88,24 @@ commands_post = {env:SAGE} --python -m coverage report {env:SAGE} --python -m coverage html -d "{envdir}" +[testenv:coverage.py-xml] +# https://coverage.readthedocs.io/en/latest/index.html +description = + run the Sage doctester with Coverage.py, generate XML report +## This toxenv bypasses the virtual environment set up by tox. +passenv = {[sagedirect]passenv} +setenv = {[sagedirect]setenv} +envdir = {[sagedirect]envdir} +allowlist_externals = {[sagedirect]allowlist_externals} +commands_pre = + {env:SAGE} -pip install -U coverage +commands = + {env:SAGE} --python -m coverage run "{toxinidir}/../venv/bin/sage-runtests" -p 0 {posargs:--all} +commands_post = + {env:SAGE} --python -m coverage combine + {env:SAGE} --python -m coverage report + {env:SAGE} --python -m coverage xml -o "{envdir}/coverage.xml" + [testenv:coverage] description = give information about doctest coverage of files diff --git a/tox.ini b/tox.ini index 837764e6441..e464e6e652d 100644 --- a/tox.ini +++ b/tox.ini @@ -129,8 +129,10 @@ envlist = # pycodestyle requires = - # For repaired numerical factors in tox 4: + # For repaired numerical factors in tox 4, need >= 4.2.7. + # Because of https://github.com/tox-dev/tox/issues/3238, need <4.14.1 tox>=4.2.7 + tox<4.14.1 skipsdist = true @@ -185,6 +187,7 @@ setenv = # What system packages should be installed. Default: All standard packages with spkg-configure. SAGE_PACKAGE_LIST_ARGS=--has-file=spkg-configure.m4 :standard: recommended: EXTRA_SAGE_PACKAGES_3=_recommended $(head -n 1 build/pkgs/_recommended/dependencies) + incremental: EXTRA_SAGE_PACKAGES_4=git develop: EXTRA_SAGE_PACKAGES_4=_develop $(head -n 1 build/pkgs/_develop/dependencies) minimal: SAGE_PACKAGE_LIST_ARGS=_prereq maximal: SAGE_PACKAGE_LIST_ARGS=:standard: :optional: @@ -499,8 +502,9 @@ setenv = # docker: FULL_BASE_IMAGE_AND_TAG={env:ARCH_IMAGE_PREFIX:}{env:BASE_IMAGE}{env:ARCH_IMAGE_SUFFIX:}:{env:ARCH_TAG_PREFIX:}{env:BASE_TAG}{env:ARCH_TAG_SUFFIX:} docker-incremental: FULL_BASE_IMAGE_AND_TAG={env:FROM_DOCKER_REPOSITORY:ghcr.io/sagemath/sage/}sage-$(echo {envname} | sed -E "s/(docker-|-incremental|-sitepackages)//g")-{env:FROM_DOCKER_TARGET:with-targets}:{env:FROM_DOCKER_TAG:dev} - docker-incremental: SKIP_SYSTEM_PKG_INSTALL=yes - docker-incremental-sitepackages: SKIP_SYSTEM_PKG_INSTALL=no + # Can SKIP_SYSTEM_PKG_INSTALL if the base image already has git + docker-incremental-{develop,recommended,maximal}: SKIP_SYSTEM_PKG_INSTALL=yes + docker-incremental-sitepackages: SKIP_SYSTEM_PKG_INSTALL=no # docker-nobootstrap: BOOTSTRAP=./bootstrap -D ### @@ -768,10 +772,6 @@ commands = docker: docker build . -f {envdir}/Dockerfile \ docker: --target $docker_target \ docker: $TAG_ARGS \ - docker: --build-arg EXTRA_CONFIGURE_ARGS="{env:CONFIGURE_ARGS}" \ - docker: --build-arg BASE_IMAGE={env:FULL_BASE_IMAGE_AND_TAG} \ - docker-conda: --build-arg USE_CONDARC="{env:USE_CONDARC}" \ - docker: --build-arg BOOTSTRAP="{env:BOOTSTRAP}" \ docker: --build-arg TARGETS_PRE="$(if test -n "$TARGETS_PRE"; then echo $TARGETS_PRE; else echo {posargs:all-sage-local}; fi)" \ docker: --build-arg TARGETS="{posargs:build}" \ docker: --build-arg TARGETS_OPTIONAL="{env:TARGETS_OPTIONAL:ptest}" \ @@ -997,7 +997,22 @@ allowlist_externals = {[sage_src]allowlist_externals} [testenv:coverage.py] description = run the Sage doctester with Coverage.py - (https://coverage.readthedocs.io/en/latest/index.html) +passenv = {[sage_src]passenv} +envdir = {[sage_src]envdir} +commands = {[sage_src]commands} +allowlist_externals = {[sage_src]allowlist_externals} + +[testenv:coverage.py-html] +description = + run the Sage doctester with Coverage.py, generate HTML report +passenv = {[sage_src]passenv} +envdir = {[sage_src]envdir} +commands = {[sage_src]commands} +allowlist_externals = {[sage_src]allowlist_externals} + +[testenv:coverage.py-xml] +description = + run the Sage doctester with Coverage.py, generate XML report passenv = {[sage_src]passenv} envdir = {[sage_src]envdir} commands = {[sage_src]commands}