Skip to content

Commit b6c6f04

Browse files
committed
chore: update CI
1 parent 98134e1 commit b6c6f04

File tree

3 files changed

+54
-33
lines changed

3 files changed

+54
-33
lines changed
Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
4-
name: Python package
1+
name: Test and lint
52

63
on:
74
push:
@@ -11,34 +8,45 @@ on:
118

129
jobs:
1310
build:
14-
1511
runs-on: ubuntu-latest
1612
strategy:
1713
matrix:
18-
python-version: [3.8, 3.9, '3.10', '3.11']
14+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
1915

2016
steps:
21-
22-
- uses: actions/checkout@v2
23-
24-
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v2
26-
with:
27-
python-version: ${{ matrix.python-version }}
28-
29-
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade pip
32-
pip install flake8 pytest
33-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
34-
35-
- name: Lint with flake8
36-
run: |
37-
# stop the build if there are Python syntax errors or undefined names
38-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
39-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
40-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
41-
42-
- name: Test with pytest
43-
run: |
44-
pytest
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v3
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install uv
25+
run: |
26+
curl -LsSf https://astral.sh/uv/install.sh | sh
27+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
28+
29+
- name: Cache virtual environment
30+
uses: actions/cache@v3
31+
with:
32+
path: .venv
33+
key: venv-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
34+
restore-keys: |
35+
venv-${{ matrix.python-version }}-
36+
37+
- name: Set up uv venv and install dependencies
38+
run: |
39+
uv venv
40+
source .venv/bin/activate
41+
uv pip install ruff pytest pytest-cov pytest-codspeed
42+
uv pip install -e .
43+
44+
- name: Lint with ruff
45+
run: |
46+
source .venv/bin/activate
47+
ruff check dotmotif
48+
49+
- name: Test with pytest
50+
run: |
51+
source .venv/bin/activate
52+
pytest

dotmotif/__init__.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
"""
3-
Copyright 2022 The Johns Hopkins University Applied Physics Laboratory.
3+
Copyright 2022-2026 The Johns Hopkins Applied Physics Laboratory.
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -170,7 +170,20 @@ def list_automorphisms(self):
170170
return self._automorphisms
171171

172172
g = self.to_nx()
173-
res = isomorphism.GraphMatcher(g, g).subgraph_isomorphisms_iter()
173+
# Choose the appropriate VF2 matcher depending on directedness
174+
# and whether the graph is a multigraph.
175+
if g.is_directed():
176+
if g.is_multigraph():
177+
matcher_cls = isomorphism.MultiDiGraphMatcher
178+
else:
179+
matcher_cls = isomorphism.DiGraphMatcher
180+
else:
181+
if g.is_multigraph():
182+
matcher_cls = isomorphism.MultiGraphMatcher
183+
else:
184+
matcher_cls = isomorphism.GraphMatcher
185+
186+
res = matcher_cls(g, g).subgraph_isomorphisms_iter()
174187
autos = set()
175188
for auto in res:
176189
for k, v in auto.items():

dotmotif/executors/NetworkXExecutor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright 2022 The Johns Hopkins University Applied Physics Laboratory.
2+
Copyright 2022-2026 The Johns Hopkins Applied Physics Laboratory.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)