Skip to content

Update to use python-graphblas instead of grblas. #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
46 changes: 23 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
56 changes: 56 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
<!--- [![conda-forge](https://img.shields.io/conda/vn/conda-forge/graphblas-algorithms.svg)](https://anaconda.org/conda-forge/graphblas-algorithms) --->
<!--- [![Docs](https://readthedocs.org/projects/graphblas-algorithms/badge/?version=latest)](https://graphblas-algorithms.readthedocs.io/en/latest/) --->

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
```
Expand Down
6 changes: 3 additions & 3 deletions graphblas_algorithms/link_analysis.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
2 changes: 1 addition & 1 deletion graphblas_algorithms/tests/test_pagerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
grblas >=2022.3.1
python-graphblas >=2022.4.1
6 changes: 3 additions & 3 deletions scripts/bench_pagerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ testpaths = graphblas_algorithms/tests

[flake8]
max-line-length = 100
inline-quotes = "
exclude =
versioneer.py,
graphblas_algorithms/tests/,
Expand Down
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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=[
Expand Down