Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ exclude =
graphblas_algorithms/*/tests/,
graphblas_algorithms/*/*/tests/,
build/
# E203 for black; B042 because ArpackNoConvergence mirrors SciPy's signature.
extend-ignore =
E203,
SIM105,
SIM401,
# E203 whitespace before ':' (to be compatible with black)
B042,
# No trailing comments below: flake8 would read them as part of the pattern.
per-file-ignores =
__init__.py:F401,F403, # allow unused and star imports
graphblas_algorithms/nxapi/exception.py:F401,
__init__.py:F401,F403
_nx_graphblas/__init__.py:E501
graphblas_algorithms/nxapi/exception.py:F401
10 changes: 7 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: 'weekly'
interval: "weekly"
# Wait a week after a release before proposing it, so a compromised or
# broken release has time to be noticed and yanked.
cooldown:
default-days: 7
10 changes: 6 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ jobs:
name: pre-commit-hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
python-version: "3.10"
- uses: pre-commit/action@v3.0.0
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.11"
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
18 changes: 11 additions & 7 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: Publish to PyPI
on:
push:
tags:
- '20*'
- "20*"

permissions:
contents: read

jobs:
build_and_deploy:
Expand All @@ -14,28 +17,29 @@ jobs:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.10"
python-version: "3.11"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build wheel and sdist
run: python -m build --sdist --wheel
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: releases
path: dist
if-no-files-found: error
- name: Check with twine
run: python -m twine check --strict dist/*
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.11
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
password: ${{ secrets.PYPI_TOKEN }} # zizmor: ignore[use-trusted-publishing]
121 changes: 100 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,144 @@ name: Tests
on:
pull_request:
push:
branches: [ main ]
branches: [main]

permissions:
contents: read

jobs:
test:
name: pytest (${{ matrix.os }}, ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: true
# One failing cell should not cancel the others.
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.11", "3.12", "3.13"]
include:
# Additional architectures, at one Python version to limit the cost.
- os: macos-15-intel
python-version: "3.13"
- os: ubuntu-24.04-arm
python-version: "3.13"
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Setup mamba
uses: conda-incubator/setup-miniconda@v3
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
id: setup_mamba
continue-on-error: true
with:
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
use-mamba: true
python-version: ${{ matrix.python-version }}
channels: conda-forge,${{ contains(matrix.python-version, 'pypy') && 'defaults' || 'nodefaults' }}
channel-priority: ${{ contains(matrix.python-version, 'pypy') && 'flexible' || 'strict' }}
channels: conda-forge
channel-priority: strict
activate-environment: graphblas
auto-activate-base: false
- name: Setup conda
uses: conda-incubator/setup-miniconda@v3
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
id: setup_conda
if: steps.setup_mamba.outcome == 'failure'
continue-on-error: false
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
channels: conda-forge,${{ contains(matrix.python-version, 'pypy') && 'defaults' || 'nodefaults' }}
channel-priority: ${{ contains(matrix.python-version, 'pypy') && 'flexible' || 'strict' }}
channels: conda-forge
channel-priority: strict
activate-environment: graphblas
auto-activate-base: false
- name: Install dependencies
run: |
$(command -v mamba || command -v conda) install python-suitesparse-graphblas scipy pandas donfig pyyaml numpy python-graphblas \
pytest-cov pytest-randomly pytest-mpl networkx
# conda, not mamba: on Windows the action's bash wrapper for mamba runs `cmd.exe /C`,
# which Git Bash rewrites to `cmd.exe C:/`, so the install silently does nothing.
conda install python-suitesparse-graphblas scipy pandas donfig pyyaml numpy python-graphblas \
pytest-cov pytest-randomly pytest-xdist networkx rich setuptools
# matplotlib lxml pygraphviz pydot sympy # Extra networkx deps we don't need yet
# Sometimes we prefer to use the latest release of NetworkX or the latest development from github
# pip install git+https://github.com/networkx/networkx.git@main --no-deps
pip install -e . --no-deps
- name: PyTest
- name: pytest
run: |
python -c 'import sys, graphblas_algorithms; assert "networkx" not in sys.modules'
coverage run --branch -m pytest --color=yes -v --check-structure
coverage report
# NETWORKX_GRAPH_CONVERT=graphblas pytest --color=yes --pyargs networkx --cov --cov-append
./run_nx_tests.sh --color=yes --cov --cov-append
coverage run --branch -m pytest --color=yes -v
coverage report
coverage xml
- name: Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1

networkx:
# One cell, since the suite is slow and tests the dispatch layer, not the platform.
name: NetworkX suite through the backend
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Setup mamba
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
id: setup_mamba
continue-on-error: true
with:
miniforge-variant: Miniforge3
miniforge-version: latest
use-mamba: true
python-version: "3.13"
channels: conda-forge
channel-priority: strict
activate-environment: graphblas
- name: Setup conda
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
if: steps.setup_mamba.outcome == 'failure'
continue-on-error: false
with:
auto-update-conda: true
python-version: "3.13"
channels: conda-forge
channel-priority: strict
activate-environment: graphblas
- name: Install dependencies
run: |
# pytest-mpl brings matplotlib, which NetworkX's drawing tests need.
conda install python-suitesparse-graphblas scipy pandas donfig pyyaml numpy python-graphblas \
pytest-cov pytest-randomly pytest-mpl pytest-xdist networkx
pip install -e . --no-deps
- name: NetworkX test suite
id: nx_suite
# Advisory: the step may fail, the job passes, the counts are in the step summary.
continue-on-error: true
run: |
# The runner adds no pipefail to a custom shell, and `tee` would set the step's status.
set -o pipefail
./run_nx_tests.sh --color=yes -n auto -q --cov --cov-report=xml | tee nx-suite.log
- name: Publish the suite result
if: always()
env:
SUITE_OUTCOME: ${{ steps.nx_suite.outcome }}
run: |
# The step summary and annotations do not render color escapes.
summary=$(tail -n 1 nx-suite.log 2>/dev/null | sed 's/\x1b\[[0-9;]*m//g')
summary=${summary:-"the suite produced no output"}
{
echo "### NetworkX suite through this backend"
echo
echo '```'
echo "$summary"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
if [ "$SUITE_OUTCOME" != "success" ]; then
echo "::warning::NetworkX suite did not pass: $summary"
fi
- name: Coverage
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
Loading
Loading