Skip to content

Commit 6582245

Browse files
update github actions (#30)
* update CI * add format * update version * update stub * clean up * fix CI * fix CI * fix --------- Co-authored-by: tang zhixiong <zhixiong.tang@momenta.ai>
1 parent 6e8fbf0 commit 6582245

File tree

9 files changed

+81
-60
lines changed

9 files changed

+81
-60
lines changed

.github/workflows/format.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This is a format job. Pre-commit has a first-party GitHub action, so we use
2+
# that: https://github.com/pre-commit/action
3+
4+
name: Format
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
push:
10+
branches:
11+
- master
12+
13+
jobs:
14+
pre-commit:
15+
name: Format
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.9"
22+
- name: Cache pre-commit
23+
uses: actions/cache@v4
24+
with:
25+
path: ~/.cache/pre-commit
26+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
27+
restore-keys: |
28+
pre-commit-
29+
- uses: pre-commit/action@v3.0.0

.github/workflows/pip.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,33 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
platform: [windows-latest, macos-latest, ubuntu-latest]
18-
python-version: ["3.8", "3.12", "pypy-3.9"]
18+
python-version: ["3.9", "3.11"]
1919

2020
steps:
2121
- uses: actions/checkout@v4
2222

23-
- uses: actions/setup-python@v4
23+
- uses: actions/setup-python@v5
2424
with:
2525
python-version: ${{ matrix.python-version }}
26+
allow-prereleases: true
27+
28+
- name: Get pip cache dir
29+
id: pip-cache
30+
shell: bash
31+
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
32+
33+
- name: Cache pip dependencies
34+
uses: actions/cache@v4
35+
with:
36+
path: ${{ steps.pip-cache.outputs.dir }}
37+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
38+
restore-keys: |
39+
${{ runner.os }}-pip-${{ matrix.python-version }}-
40+
${{ runner.os }}-pip-
2641
2742
- name: Build and install
2843
run: pip install --verbose .[test]
2944

3045
- name: Test
46+
if: ${{ startsWith(matrix.platform, 'ubuntu') }}
3147
run: pytest

.github/workflows/wheels.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ jobs:
3232
- name: Check metadata
3333
run: pipx run twine check dist/*
3434

35-
- uses: actions/upload-artifact@v3
35+
- uses: actions/upload-artifact@v4
3636
with:
37+
name: cibw-sdist
3738
path: dist/*.tar.gz
3839

3940

@@ -43,27 +44,39 @@ jobs:
4344
strategy:
4445
fail-fast: false
4546
matrix:
46-
os: [ubuntu-latest, macos-latest, windows-latest]
47+
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-14]
4748

4849
steps:
4950
- uses: actions/checkout@v4
5051
with:
5152
submodules: true
5253

53-
- uses: pypa/cibuildwheel@v2.21.1
54+
- name: Cache cibuildwheel
55+
uses: actions/cache@v4
56+
with:
57+
path: |
58+
~/Library/Caches/pip
59+
~/.cache/pip
60+
~/AppData/Local/pip/Cache
61+
key: cibw-pip-${{ matrix.os }}-${{ hashFiles('pyproject.toml') }}
62+
restore-keys: |
63+
cibw-pip-${{ matrix.os }}-
64+
65+
- uses: pypa/cibuildwheel@v3.3.1
5466
env:
5567
CIBW_ARCHS_MACOS: universal2
56-
CIBW_ARCHS_WINDOWS: auto ARM64
68+
CIBW_ARCHS_WINDOWS: AMD64 ARM64
5769
CIBW_BEFORE_BUILD: pip install pytest networkx --prefer-binary
58-
CIBW_SKIP: "*musllinux*"
59-
CIBW_TEST_SKIP: pp*
70+
CIBW_SKIP: "pp* *musllinux* *_i686 cp314t-win*"
71+
CIBW_TEST_SKIP: "*macosx* *win* *aarch64 cp314t-*"
6072

6173
- name: Verify clean directory
6274
run: git diff --exit-code
6375
shell: bash
6476

65-
- uses: actions/upload-artifact@v3
77+
- uses: actions/upload-artifact@v4
6678
with:
79+
name: cibw-wheels-${{ matrix.os }}
6780
path: wheelhouse/*.whl
6881

6982

@@ -77,15 +90,16 @@ jobs:
7790
id-token: write
7891

7992
steps:
80-
- uses: actions/setup-python@v4
93+
- uses: actions/setup-python@v5
8194
with:
8295
python-version: "3.x"
8396

84-
- uses: actions/download-artifact@v3
97+
- uses: actions/download-artifact@v4
8598
with:
86-
name: artifact
99+
pattern: cibw-*
100+
merge-multiple: true
87101
path: dist
88102

89103
- uses: pypa/gh-action-pypi-publish@release/v1
90104
with:
91-
password: ${{ secrets.PYPI_API_TOKEN }}
105+
password: ${{ secrets.pypi_password }}

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ build-backend = "scikit_build_core.build"
55

66
[project]
77
name = "networkx_graph"
8-
version = "0.2.5"
9-
url = "https://github.com/cubao/networkx-graph"
8+
version = "0.2.6"
109
description = "Some customized graph algorithms"
1110
readme = "README.md"
1211
authors = [
@@ -23,8 +22,13 @@ classifiers = [
2322
"Programming Language :: Python :: 3.10",
2423
"Programming Language :: Python :: 3.11",
2524
"Programming Language :: Python :: 3.12",
25+
"Programming Language :: Python :: 3.13",
26+
"Programming Language :: Python :: 3.14",
2627
]
2728

29+
[project.urls]
30+
Homepage = "https://github.com/cubao/networkx-graph"
31+
2832
[project.optional-dependencies]
2933
test = ["pytest"]
3034

src/main.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,24 +2224,8 @@ PYBIND11_MODULE(_core, m)
22242224
22252225
.. autosummary::
22262226
:toctree: _generate
2227-
2228-
add
2229-
subtract
22302227
)pbdoc";
22312228

2232-
m.def("add", &add, R"pbdoc(
2233-
Add two numbers
2234-
2235-
Some other explanation about the add function.
2236-
)pbdoc");
2237-
2238-
m.def(
2239-
"subtract", [](int i, int j) { return i - j; }, R"pbdoc(
2240-
Subtract two numbers
2241-
2242-
Some other explanation about the subtract function.
2243-
)pbdoc");
2244-
22452229
py::class_<Indexer>(m, "Indexer", py::module_local()) //
22462230
.def(py::init<>())
22472231
.def(py::init<const std::map<std::string, int64_t>>(), "index"_a)

src/networkx_graph/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
ZigzagPathGenerator,
1818
__doc__,
1919
__version__,
20-
add,
21-
subtract,
2220
)
2321
from ._core import DiGraph as DiGraphImpl
2422

@@ -46,8 +44,6 @@ def add_edge(self, node0: str, node1: str, **attr):
4644
__all__ = [
4745
"__doc__",
4846
"__version__",
49-
"add",
50-
"subtract",
5147
"Node",
5248
"Edge",
5349
"Path",

src/networkx_graph/__main__.py

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

src/networkx_graph/_core.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import typing
1818

1919
import pybind11_stubgen.typing_ext
2020

21-
__all__ = [
21+
__all__: list[str] = [
2222
"Bindings",
2323
"DiGraph",
2424
"Edge",
@@ -711,4 +711,4 @@ def subtract(arg0: int, arg1: int) -> int:
711711
Some other explanation about the subtract function.
712712
"""
713713

714-
__version__: str = "0.2.5"
714+
__version__: str = "0.2.6"

tests/test_basic.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,7 @@ def calculate_md5(filename, block_size=4096):
3232

3333

3434
def test_version():
35-
assert m.__version__ == "0.2.5"
36-
37-
38-
def test_add():
39-
assert m.add(1, 2) == 3
40-
41-
42-
def test_sub():
43-
assert m.subtract(1, 2) == -1
35+
assert m.__version__ == "0.2.6"
4436

4537

4638
def test_networkx():

0 commit comments

Comments
 (0)