diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 03675fc..7767834 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,7 @@ jobs: activate-environment: testing - name: Install dependencies run: | - conda install -c conda-forge grblas networkx scipy pytest coverage black flake8 coveralls + conda install -c conda-forge python-graphblas networkx scipy pytest coverage black flake8 coveralls pip install -e . - name: Style checks run: | @@ -46,26 +46,26 @@ jobs: COVERALLS_PARALLEL: true run: | coverage report --show-missing - coveralls --service=github + # coveralls --service=github # Broken :( - finish: - needs: test - if: always() - runs-on: ubuntu-latest - defaults: - run: - shell: bash -l {0} - steps: - - name: Create env - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: "3.10" - activate-environment: finishing - - name: Update env - run: conda install -c conda-forge coveralls - - name: Coveralls finished - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - coveralls --finish +# finish: +# needs: test +# if: always() +# runs-on: ubuntu-latest +# defaults: +# run: +# shell: bash -l {0} +# steps: +# - name: Create env +# uses: conda-incubator/setup-miniconda@v2 +# with: +# auto-update-conda: true +# python-version: "3.10" +# activate-environment: finishing +# - name: Update env +# run: conda install -c conda-forge coveralls +# - name: Coveralls finished +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# run: | +# coveralls --finish diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..fa4b778 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,56 @@ +# https://pre-commit.com/ +# +# Before first use: `pre-commit install` +# To run: `pre-commit run --all-files` +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.2.0 + hooks: + - id: check-added-large-files + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + - repo: https://github.com/myint/autoflake + rev: v1.4 + hooks: + - id: autoflake + args: [--in-place] + - repo: https://github.com/pycqa/isort + rev: 5.10.1 + hooks: + - id: isort + language_version: python3 + - repo: https://github.com/asottile/pyupgrade + rev: v2.32.0 + hooks: + - id: pyupgrade + args: [--py38-plus] + - repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + language_version: python3 + args: [--target-version=py38] + - repo: https://github.com/PyCQA/flake8 + rev: 4.0.1 + hooks: + - id: flake8 + additional_dependencies: &flake8_dependencies + - flake8==4.0.1 + - flake8-comprehensions==3.8.0 + - flake8-bugbear==22.3.23 + - repo: https://github.com/asottile/yesqa + rev: v1.3.0 + hooks: + - id: yesqa + additional_dependencies: *flake8_dependencies + - repo: https://github.com/codespell-project/codespell + rev: v2.1.0 + hooks: + - id: codespell + types_or: [python, rst, markdown] + files: ^(graphblas_algorithms|docs)/ + # args: ["--ignore-words-list=coo,ba"] +# Maybe: black-jupyter, blacken-docs, blackdoc mypy, velin diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index c68e9d7..7cfcb10 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -36,7 +36,7 @@ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. A working group of community members is committed to promptly addressing any -reported issues. The working group is made up of Grblas and Metagraph contributors and users. +reported issues. The working group is made up of Python-graphblas and Metagraph contributors and users. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the working group by e-mail (metagraph-conduct@googlegroups.com). Messages sent to this e-mail address will not be publicly visible but only to diff --git a/README.md b/README.md index 86ea6e5..c58a7d2 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # **GraphBLAS Algorithms** [![pypi](https://img.shields.io/pypi/v/graphblas-algorithms.svg)](https://pypi.python.org/pypi/graphblas-algorithms/) -[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/metagraph-dev/graphblas-algorithms/blob/main/LICENSE) -[![Tests](https://github.com/metagraph-dev/graphblas-algorithms/workflows/Tests/badge.svg?branch=main)](https://github.com/metagraph-dev/graphblas-algorithms/actions) -[![Coverage](https://coveralls.io/repos/metagraph-dev/graphblas-algorithms/badge.svg?branch=main)](https://coveralls.io/r/metagraph-dev/graphblas-algorithms) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/python-graphblas/graphblas-algorithms/blob/main/LICENSE) +[![Tests](https://github.com/python-graphblas/graphblas-algorithms/workflows/Tests/badge.svg?branch=main)](https://github.com/python-graphblas/graphblas-algorithms/actions) +[![Coverage](https://coveralls.io/repos/python-graphblas/graphblas-algorithms/badge.svg?branch=main)](https://coveralls.io/r/python-graphblas/graphblas-algorithms) [![Code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -GraphBLAS algorithms written in Python with [`grblas`](https://github.com/metagraph-dev/grblas). We are trying to target the NetworkX API algorithms where possible. +GraphBLAS algorithms written in Python with [Python-graphblas](https://github.com/python-graphblas/python-graphblas). We are trying to target the NetworkX API algorithms where possible. ### Installation ``` diff --git a/graphblas_algorithms/link_analysis.py b/graphblas_algorithms/link_analysis.py index cb786a9..3ed0e62 100644 --- a/graphblas_algorithms/link_analysis.py +++ b/graphblas_algorithms/link_analysis.py @@ -1,10 +1,10 @@ from collections import OrderedDict from warnings import warn -import grblas as gb +import graphblas as gb import networkx as nx -from grblas import Vector, binary, unary -from grblas.semiring import plus_first, plus_times +from graphblas import Vector, binary, unary +from graphblas.semiring import plus_first, plus_times def pagerank_core( diff --git a/graphblas_algorithms/tests/test_pagerank.py b/graphblas_algorithms/tests/test_pagerank.py index 65dd8db..cdbda24 100644 --- a/graphblas_algorithms/tests/test_pagerank.py +++ b/graphblas_algorithms/tests/test_pagerank.py @@ -18,4 +18,4 @@ def test_signatures(): assert nx_sig == sig -from networkx.algorithms.link_analysis.tests.test_pagerank import * # isort:skip +from networkx.algorithms.link_analysis.tests.test_pagerank import * # noqa isort:skip diff --git a/requirements.txt b/requirements.txt index bd152c5..ee57e55 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -grblas >=2022.3.1 +python-graphblas >=2022.4.1 diff --git a/scripts/bench_pagerank.py b/scripts/bench_pagerank.py index fb054f9..5162cf3 100644 --- a/scripts/bench_pagerank.py +++ b/scripts/bench_pagerank.py @@ -158,7 +158,7 @@ def main(filename, backend, time, n, verify, alpha, tol, _get_result=False): print() for k1, v1 in results.items(): print("%5s" % k1, end="") - for k2, v2 in results.items(): + for v2 in results.values(): print("%9.2g" % np.abs(v1 - v2).sum(), end="") print() return @@ -172,7 +172,7 @@ def main(filename, backend, time, n, verify, alpha, tol, _get_result=False): if backend == "graphblas": import pandas as pd - from grblas import Matrix + from graphblas import Matrix from graphblas_algorithms.link_analysis import pagerank_core as pagerank @@ -225,7 +225,7 @@ def main(filename, backend, time, n, verify, alpha, tol, _get_result=False): print("Load time:", stime(stop - start)) timer = timeit.Timer( "pagerank(G, alpha=alpha, tol=tol)", - globals=dict(pagerank=pagerank, G=G, alpha=alpha, tol=tol), + globals={"pagerank": pagerank, "G": G, "alpha": alpha, "tol": tol}, ) first_time = timer.timeit(1) if time == 0: diff --git a/setup.cfg b/setup.cfg index efd1f54..3ad34d1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,6 +6,7 @@ testpaths = graphblas_algorithms/tests [flake8] max-line-length = 100 +inline-quotes = " exclude = versioneer.py, graphblas_algorithms/tests/, diff --git a/setup.py b/setup.py index 32d632a..ddcfd3f 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,11 @@ import versioneer +extras_require = { + "test": ["pytest", "scipy"], +} +extras_require["complete"] = sorted({v for req in extras_require.values() for v in req}) + with open("README.md") as f: long_description = f.read() @@ -14,11 +19,11 @@ long_description_content_type="text/markdown", author="Jim Kitchen and Erik Welch", author_email="erik.n.welch@gmail.com,jim22k@gmail.com", - url="https://github.com/metagraph-dev/graphblas-algorithms", + url="https://github.com/python-graphblas/graphblas-algorithms", packages=find_packages(), python_requires=">=3.8", - install_requires=["grblas >=2022.4.0", "networkx"], - tests_require=["pytest", "scipy"], + install_requires=["python-graphblas >=2022.4.1", "networkx"], + extras_require=extras_require, include_package_data=True, license="Apache License 2.0", keywords=[