Skip to content

Commit 441d5be

Browse files
authored
Update to use python-graphblas instead of grblas. (#2)
* Update to use `python-graphblas` instead of `grblas`. Also, add git pre-commit hooks * New commit (trying to make coveralls happy) * coveralls debug * Don't upload to coveralls atm. why broke?!
1 parent 67a9e4d commit 441d5be

File tree

10 files changed

+101
-39
lines changed

10 files changed

+101
-39
lines changed

.github/workflows/test.yml

+23-23
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
activate-environment: testing
3131
- name: Install dependencies
3232
run: |
33-
conda install -c conda-forge grblas networkx scipy pytest coverage black flake8 coveralls
33+
conda install -c conda-forge python-graphblas networkx scipy pytest coverage black flake8 coveralls
3434
pip install -e .
3535
- name: Style checks
3636
run: |
@@ -46,26 +46,26 @@ jobs:
4646
COVERALLS_PARALLEL: true
4747
run: |
4848
coverage report --show-missing
49-
coveralls --service=github
49+
# coveralls --service=github # Broken :(
5050
51-
finish:
52-
needs: test
53-
if: always()
54-
runs-on: ubuntu-latest
55-
defaults:
56-
run:
57-
shell: bash -l {0}
58-
steps:
59-
- name: Create env
60-
uses: conda-incubator/setup-miniconda@v2
61-
with:
62-
auto-update-conda: true
63-
python-version: "3.10"
64-
activate-environment: finishing
65-
- name: Update env
66-
run: conda install -c conda-forge coveralls
67-
- name: Coveralls finished
68-
env:
69-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70-
run: |
71-
coveralls --finish
51+
# finish:
52+
# needs: test
53+
# if: always()
54+
# runs-on: ubuntu-latest
55+
# defaults:
56+
# run:
57+
# shell: bash -l {0}
58+
# steps:
59+
# - name: Create env
60+
# uses: conda-incubator/setup-miniconda@v2
61+
# with:
62+
# auto-update-conda: true
63+
# python-version: "3.10"
64+
# activate-environment: finishing
65+
# - name: Update env
66+
# run: conda install -c conda-forge coveralls
67+
# - name: Coveralls finished
68+
# env:
69+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
# run: |
71+
# coveralls --finish

.pre-commit-config.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# https://pre-commit.com/
2+
#
3+
# Before first use: `pre-commit install`
4+
# To run: `pre-commit run --all-files`
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.2.0
8+
hooks:
9+
- id: check-added-large-files
10+
- id: check-yaml
11+
- id: debug-statements
12+
- id: end-of-file-fixer
13+
- id: mixed-line-ending
14+
- id: trailing-whitespace
15+
- repo: https://github.com/myint/autoflake
16+
rev: v1.4
17+
hooks:
18+
- id: autoflake
19+
args: [--in-place]
20+
- repo: https://github.com/pycqa/isort
21+
rev: 5.10.1
22+
hooks:
23+
- id: isort
24+
language_version: python3
25+
- repo: https://github.com/asottile/pyupgrade
26+
rev: v2.32.0
27+
hooks:
28+
- id: pyupgrade
29+
args: [--py38-plus]
30+
- repo: https://github.com/psf/black
31+
rev: 22.3.0
32+
hooks:
33+
- id: black
34+
language_version: python3
35+
args: [--target-version=py38]
36+
- repo: https://github.com/PyCQA/flake8
37+
rev: 4.0.1
38+
hooks:
39+
- id: flake8
40+
additional_dependencies: &flake8_dependencies
41+
- flake8==4.0.1
42+
- flake8-comprehensions==3.8.0
43+
- flake8-bugbear==22.3.23
44+
- repo: https://github.com/asottile/yesqa
45+
rev: v1.3.0
46+
hooks:
47+
- id: yesqa
48+
additional_dependencies: *flake8_dependencies
49+
- repo: https://github.com/codespell-project/codespell
50+
rev: v2.1.0
51+
hooks:
52+
- id: codespell
53+
types_or: [python, rst, markdown]
54+
files: ^(graphblas_algorithms|docs)/
55+
# args: ["--ignore-words-list=coo,ba"]
56+
# Maybe: black-jupyter, blacken-docs, blackdoc mypy, velin

CODE_OF_CONDUCT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ This Code of Conduct applies both within project spaces and in public spaces
3636
when an individual is representing the project or its community.
3737

3838
A working group of community members is committed to promptly addressing any
39-
reported issues. The working group is made up of Grblas and Metagraph contributors and users.
39+
reported issues. The working group is made up of Python-graphblas and Metagraph contributors and users.
4040
Instances of abusive, harassing, or otherwise unacceptable behavior may be
4141
reported by contacting the working group by e-mail ([email protected]).
4242
Messages sent to this e-mail address will not be publicly visible but only to

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# **GraphBLAS Algorithms**
22

33
[![pypi](https://img.shields.io/pypi/v/graphblas-algorithms.svg)](https://pypi.python.org/pypi/graphblas-algorithms/)
4-
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/metagraph-dev/graphblas-algorithms/blob/main/LICENSE)
5-
[![Tests](https://github.com/metagraph-dev/graphblas-algorithms/workflows/Tests/badge.svg?branch=main)](https://github.com/metagraph-dev/graphblas-algorithms/actions)
6-
[![Coverage](https://coveralls.io/repos/metagraph-dev/graphblas-algorithms/badge.svg?branch=main)](https://coveralls.io/r/metagraph-dev/graphblas-algorithms)
4+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/python-graphblas/graphblas-algorithms/blob/main/LICENSE)
5+
[![Tests](https://github.com/python-graphblas/graphblas-algorithms/workflows/Tests/badge.svg?branch=main)](https://github.com/python-graphblas/graphblas-algorithms/actions)
6+
[![Coverage](https://coveralls.io/repos/python-graphblas/graphblas-algorithms/badge.svg?branch=main)](https://coveralls.io/r/python-graphblas/graphblas-algorithms)
77
[![Code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
88
<!--- [![conda-forge](https://img.shields.io/conda/vn/conda-forge/graphblas-algorithms.svg)](https://anaconda.org/conda-forge/graphblas-algorithms) --->
99
<!--- [![Docs](https://readthedocs.org/projects/graphblas-algorithms/badge/?version=latest)](https://graphblas-algorithms.readthedocs.io/en/latest/) --->
1010

11-
GraphBLAS algorithms written in Python with [`grblas`](https://github.com/metagraph-dev/grblas). We are trying to target the NetworkX API algorithms where possible.
11+
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.
1212

1313
### Installation
1414
```

graphblas_algorithms/link_analysis.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from collections import OrderedDict
22
from warnings import warn
33

4-
import grblas as gb
4+
import graphblas as gb
55
import networkx as nx
6-
from grblas import Vector, binary, unary
7-
from grblas.semiring import plus_first, plus_times
6+
from graphblas import Vector, binary, unary
7+
from graphblas.semiring import plus_first, plus_times
88

99

1010
def pagerank_core(

graphblas_algorithms/tests/test_pagerank.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ def test_signatures():
1818
assert nx_sig == sig
1919

2020

21-
from networkx.algorithms.link_analysis.tests.test_pagerank import * # isort:skip
21+
from networkx.algorithms.link_analysis.tests.test_pagerank import * # noqa isort:skip

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
grblas >=2022.3.1
1+
python-graphblas >=2022.4.1

scripts/bench_pagerank.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def main(filename, backend, time, n, verify, alpha, tol, _get_result=False):
158158
print()
159159
for k1, v1 in results.items():
160160
print("%5s" % k1, end="")
161-
for k2, v2 in results.items():
161+
for v2 in results.values():
162162
print("%9.2g" % np.abs(v1 - v2).sum(), end="")
163163
print()
164164
return
@@ -172,7 +172,7 @@ def main(filename, backend, time, n, verify, alpha, tol, _get_result=False):
172172

173173
if backend == "graphblas":
174174
import pandas as pd
175-
from grblas import Matrix
175+
from graphblas import Matrix
176176

177177
from graphblas_algorithms.link_analysis import pagerank_core as pagerank
178178

@@ -225,7 +225,7 @@ def main(filename, backend, time, n, verify, alpha, tol, _get_result=False):
225225
print("Load time:", stime(stop - start))
226226
timer = timeit.Timer(
227227
"pagerank(G, alpha=alpha, tol=tol)",
228-
globals=dict(pagerank=pagerank, G=G, alpha=alpha, tol=tol),
228+
globals={"pagerank": pagerank, "G": G, "alpha": alpha, "tol": tol},
229229
)
230230
first_time = timer.timeit(1)
231231
if time == 0:

setup.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ testpaths = graphblas_algorithms/tests
66

77
[flake8]
88
max-line-length = 100
9+
inline-quotes = "
910
exclude =
1011
versioneer.py,
1112
graphblas_algorithms/tests/,

setup.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
import versioneer
44

5+
extras_require = {
6+
"test": ["pytest", "scipy"],
7+
}
8+
extras_require["complete"] = sorted({v for req in extras_require.values() for v in req})
9+
510
with open("README.md") as f:
611
long_description = f.read()
712

@@ -14,11 +19,11 @@
1419
long_description_content_type="text/markdown",
1520
author="Jim Kitchen and Erik Welch",
1621
17-
url="https://github.com/metagraph-dev/graphblas-algorithms",
22+
url="https://github.com/python-graphblas/graphblas-algorithms",
1823
packages=find_packages(),
1924
python_requires=">=3.8",
20-
install_requires=["grblas >=2022.4.0", "networkx"],
21-
tests_require=["pytest", "scipy"],
25+
install_requires=["python-graphblas >=2022.4.1", "networkx"],
26+
extras_require=extras_require,
2227
include_package_data=True,
2328
license="Apache License 2.0",
2429
keywords=[

0 commit comments

Comments
 (0)