Skip to content

Commit 3518ff8

Browse files
authored
Merge pull request #66 from KrishnaswamyLab/scipy-graph-shortest-path
Use `scipy.sparse.csgraph.shortest_path`
2 parents a94cb37 + 582d9d4 commit 3518ff8

28 files changed

+465
-270
lines changed

.coveragerc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ exclude_lines =
1515
# Don't complain if non-runnable code isn't run:
1616
if 0:
1717
if __name__ == .__main__.
18-
19-

.github/workflows/pre-commit.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: pre-commit
2+
on:
3+
push:
4+
branches-ignore:
5+
- 'master'
6+
pull_request:
7+
types: [opened, synchronize, reopened, ready_for_review]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
pre-commit:
15+
runs-on: ubuntu-latest
16+
17+
if: >-
18+
!endsWith(github.event.head_commit.message, '# ci skip') &&
19+
(
20+
startsWith(github.ref, 'refs/heads') ||
21+
github.event.pull_request.draft == false
22+
)
23+
24+
steps:
25+
26+
- uses: actions/checkout@v3
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Cache pre-commit
31+
uses: actions/cache@v3
32+
with:
33+
path: ~/.cache/pre-commit
34+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}-
35+
36+
- name: Run pre-commit
37+
id: precommit
38+
uses: pre-commit/[email protected]
39+
continue-on-error: true
40+
41+
- name: Commit files
42+
if: steps.precommit.outcome == 'failure' && startsWith(github.ref, 'refs/heads')
43+
run: |
44+
if [[ `git status --porcelain --untracked-files=no` ]]; then
45+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
46+
git config --local user.name "github-actions[bot]"
47+
git add .
48+
git checkout -- .github/workflows
49+
git commit -m "pre-commit" -a
50+
fi
51+
shell: bash -ex {0}
52+
53+
- name: Push changes
54+
if: steps.precommit.outcome == 'failure' && startsWith(github.ref, 'refs/heads')
55+
uses: ad-m/github-push-action@master
56+
with:
57+
github_token: ${{ secrets.GITHUB_TOKEN }}
58+
branch: ${{ github.ref }}
59+
60+
- name: Check pre-commit
61+
if: steps.precommit.outcome == 'failure'
62+
uses: pre-commit/[email protected]

.github/workflows/run_tests.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'test_deploy'
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
17+
run_tester:
18+
runs-on: ${{ matrix.config.os }}
19+
if: "!contains(github.event.head_commit.message, 'ci skip')"
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
config:
25+
- {name: '3.10', os: ubuntu-latest, python: '3.10' }
26+
- {name: '3.9', os: ubuntu-latest, python: '3.9' }
27+
- {name: '3.8', os: ubuntu-latest, python: '3.8' }
28+
- {name: '3.7', os: ubuntu-latest, python: '3.7' }
29+
30+
steps:
31+
32+
- uses: actions/checkout@v2
33+
with:
34+
fetch-depth: 0
35+
36+
- name: Install system dependencies
37+
if: runner.os == 'Linux'
38+
run: |
39+
sudo apt-get update -qq
40+
sudo apt-get install -y libhdf5-dev libhdf5-serial-dev pandoc gfortran libblas-dev liblapack-dev llvm-dev
41+
42+
- name: Set up Python
43+
uses: actions/setup-python@v2
44+
with:
45+
python-version: ${{ matrix.config.python }}
46+
47+
- name: Cache Python packages
48+
uses: actions/cache@v2
49+
with:
50+
path: ${{ env.pythonLocation }}
51+
key: ${{runner.os}}-${{ matrix.config.python }}-pip-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
52+
restore-keys: ${{runner.os}}-${{ matrix.config.python }}-pip-${{ env.pythonLocation }}-
53+
54+
- name: Install package & dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install -U wheel setuptools
58+
pip install -U .[test]
59+
python -c "import graphtools"
60+
61+
- name: Run tests
62+
run: |
63+
nose2 -vvv
64+
65+
- name: Coveralls
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
COVERALLS_SERVICE_NAME: github
69+
run: |
70+
coveralls
71+
72+
- name: Upload check results on fail
73+
if: failure()
74+
uses: actions/upload-artifact@master
75+
with:
76+
name: ${{ matrix.config.name }}_results
77+
path: check

.pre-commit-config.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v3.3.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
exclude: \.(ai|gz)$
9+
- repo: https://github.com/timothycrosley/isort
10+
rev: 5.6.4
11+
hooks:
12+
- id: isort
13+
- repo: https://github.com/psf/black
14+
rev: 22.3.0
15+
hooks:
16+
- id: black
17+
args: ['--target-version=py36']
18+
- repo: https://github.com/pre-commit/mirrors-autopep8
19+
rev: v1.5.4
20+
hooks:
21+
- id: autopep8
22+
# - repo: https://gitlab.com/pycqa/flake8
23+
# rev: 3.8.4
24+
# hooks:
25+
# - id: flake8
26+
# additional_dependencies: ['hacking']

.travis.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ graphtools
88
.. image:: https://anaconda.org/conda-forge/graphtools/badges/version.svg
99
:target: https://anaconda.org/conda-forge/graphtools/
1010
:alt: Latest Conda version
11-
.. image:: https://api.travis-ci.com/KrishnaswamyLab/graphtools.svg?branch=master
11+
.. image:: https://img.shields.io/github/workflow/status/KrishnaswamyLab/graphtools/Unit%20Tests/master?label=Github%20Actions
1212
:target: https://travis-ci.com/KrishnaswamyLab/graphtools
13-
:alt: Travis CI Build
13+
:alt: Github Actions Build
1414
.. image:: https://img.shields.io/readthedocs/graphtools.svg
1515
:target: https://graphtools.readthedocs.io/
1616
:alt: Read the Docs

autoblack.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ for file in \$files; do
1111
done
1212
EOF
1313
chmod +x .git/hooks/pre-commit
14-

doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ help:
1717
# Catch-all target: route all unknown targets to Sphinx using the new
1818
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
1919
%: Makefile
20-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

graphtools/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
from .api import Graph, from_igraph, read_pickle
1+
from .api import from_igraph
2+
from .api import Graph
3+
from .api import read_pickle
24
from .version import __version__

graphtools/api.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import numpy as np
2-
import warnings
1+
from . import base
2+
from . import graphs
33
from scipy import sparse
4+
5+
import numpy as np
46
import pickle
57
import pygsp
68
import tasklogger
7-
8-
from . import base, graphs
9+
import warnings
910

1011
_logger = tasklogger.get_tasklogger("graphtools")
1112

@@ -36,7 +37,7 @@ def Graph(
3637
graphtype="auto",
3738
use_pygsp=False,
3839
initialize=True,
39-
**kwargs
40+
**kwargs,
4041
):
4142
"""Create a graph built on data.
4243
@@ -255,7 +256,7 @@ def Graph(
255256
else:
256257
msg = msg + " and PyGSP inheritance"
257258

258-
_logger.debug(msg)
259+
_logger.log_debug(msg)
259260

260261
class_names = [p.__name__.replace("Graph", "") for p in parent_classes]
261262
try:
@@ -273,7 +274,7 @@ def Graph(
273274
pass
274275

275276
# build graph and return
276-
_logger.debug(
277+
_logger.log_debug(
277278
"Initializing {} with arguments {}".format(
278279
parent_classes,
279280
", ".join(

0 commit comments

Comments
 (0)