Skip to content

Commit ee0a14f

Browse files
Fix test for python 3.13 (#116)
* update * update * upadte * update * update * update * update * fail fast * fix CI * update * update * update * update * update * update * fix * update * update * update * update * update * update * update * update * fix * fix doc --------- Co-authored-by: Nathanael Perraudin <nathanael.perraudin@synthesia.io>
1 parent 24aa9eb commit ee0a14f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+4189
-3290
lines changed

.github/workflows/ci.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master]
6+
pull_request:
7+
branches: [ main, master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up conda
21+
uses: conda-incubator/setup-miniconda@v3
22+
with:
23+
auto-update-conda: true
24+
python-version: ${{ matrix.python-version }}
25+
channels: conda-forge,defaults
26+
channel-priority: strict
27+
28+
- name: Install system dependencies
29+
run: |
30+
# Install system packages for Qt6 and OpenGL
31+
sudo apt-get update
32+
sudo apt-get install -y \
33+
qt6-base-dev \
34+
libqt6gui6 \
35+
libqt6widgets6 \
36+
libqt6opengl6-dev \
37+
xvfb \
38+
libegl1-mesa-dev \
39+
libgl1-mesa-dev \
40+
libglu1-mesa-dev \
41+
freeglut3-dev \
42+
libxkbcommon-x11-0 \
43+
libxcb-icccm4 \
44+
libxcb-image0 \
45+
libxcb-keysyms1 \
46+
libxcb-randr0 \
47+
libxcb-render-util0 \
48+
libxcb-shape0 \
49+
libxcb-xfixes0 \
50+
libxcb-xinerama0
51+
52+
- name: Install graph-tool via conda
53+
shell: bash -l {0}
54+
run: |
55+
conda install -c conda-forge graph-tool
56+
57+
- name: Verify graph-tool installation
58+
shell: bash -l {0}
59+
run: |
60+
python -c "import graph_tool.all as gt; print('✅ graph-tool imported successfully')"
61+
62+
- name: Cache pip packages
63+
uses: actions/cache@v4
64+
with:
65+
path: ~/.cache/pip
66+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
67+
restore-keys: |
68+
${{ runner.os }}-pip-${{ matrix.python-version }}-
69+
${{ runner.os }}-pip-
70+
71+
- name: Install Python dependencies
72+
shell: bash -l {0}
73+
run: |
74+
python -m pip install --upgrade pip setuptools wheel
75+
pip install --upgrade --upgrade-strategy eager .[dev]
76+
77+
- name: Set up virtual display
78+
run: |
79+
export DISPLAY=:99
80+
Xvfb :99 -screen 0 800x600x24 > /dev/null 2>&1 &
81+
echo "DISPLAY=:99" >> $GITHUB_ENV
82+
echo "QT_QPA_PLATFORM=offscreen" >> $GITHUB_ENV
83+
echo "QT_QPA_FONTDIR=/usr/share/fonts" >> $GITHUB_ENV
84+
echo "MESA_GL_VERSION_OVERRIDE=3.3" >> $GITHUB_ENV
85+
echo "MESA_GLSL_VERSION_OVERRIDE=330" >> $GITHUB_ENV
86+
87+
# - name: Run linting
88+
# shell: bash -l {0}
89+
# run: |
90+
# flake8 --doctests --exclude=doc
91+
92+
- name: Run tests with coverage
93+
shell: bash -l {0}
94+
run: |
95+
export MPLBACKEND=agg
96+
coverage run --branch --source pygsp -m pytest
97+
coverage report
98+
coverage xml
99+
100+
- name: Upload coverage to Coveralls
101+
if: matrix.python-version == '3.11' # Only upload once
102+
uses: coverallsapp/github-action@v2
103+
with:
104+
github-token: ${{ secrets.GITHUB_TOKEN }}
105+
file: coverage.xml
106+
107+
docs:
108+
runs-on: ubuntu-latest
109+
needs: test
110+
111+
steps:
112+
- uses: actions/checkout@v4
113+
114+
- name: Set up conda
115+
uses: conda-incubator/setup-miniconda@v3
116+
with:
117+
auto-update-conda: true
118+
python-version: "3.11"
119+
channels: conda-forge,defaults
120+
channel-priority: strict
121+
122+
- name: Install graph-tool via conda
123+
shell: bash -l {0}
124+
run: |
125+
conda install -c conda-forge graph-tool
126+
127+
- name: Verify graph-tool installation
128+
shell: bash -l {0}
129+
run: |
130+
python -c "import graph_tool.all as gt; print('✅ graph-tool imported successfully')"
131+
132+
- name: Install Python dependencies
133+
shell: bash -l {0}
134+
run: |
135+
python -m pip install --upgrade pip setuptools wheel
136+
pip install --upgrade --upgrade-strategy eager .[dev,doc]
137+
138+
- name: Build documentation
139+
shell: bash -l {0}
140+
run: |
141+
export MPLBACKEND=agg
142+
sphinx-build -b html -d doc/_build/doctrees doc doc/_build/html
143+
sphinx-build -b linkcheck -d doc/_build/doctrees doc doc/_build/linkcheck
144+
145+
- name: Upload documentation artifacts
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: documentation
149+
path: doc/_build/html/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.venv/
2+
uv.lock
23
__pycache__/
34

45
# Packages

.pre-commit-config.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.5.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- id: check-case-conflict
12+
- id: check-merge-conflict
13+
- id: check-toml
14+
- id: debug-statements
15+
- id: detect-private-key
16+
17+
- repo: https://github.com/psf/black
18+
rev: 23.12.1
19+
hooks:
20+
- id: black
21+
language_version: python3
22+
args: [--line-length=88]
23+
24+
- repo: https://github.com/pycqa/isort
25+
rev: 5.13.2
26+
hooks:
27+
- id: isort
28+
args: [--profile=black, --line-length=88]
29+
30+
# - repo: https://github.com/pycqa/flake8
31+
# rev: 7.0.0
32+
# hooks:
33+
# - id: flake8
34+
# additional_dependencies: [flake8-docstrings]
35+
# args: [--max-line-length, "88", --extend-ignore, "E203,W503,D100,D101,D102,D103,D104,D105,D107,D200,D202,D205,D209,D400,D401,D402,D412,D414"]
36+
37+
# - repo: https://github.com/PyCQA/bandit
38+
# rev: 1.7.5
39+
# hooks:
40+
# - id: bandit
41+
# args: [--skip=B101,B601]
42+
43+
# - repo: https://github.com/pre-commit/mirrors-mypy
44+
# rev: v1.8.0
45+
# hooks:
46+
# - id: mypy
47+
# additional_dependencies: [types-all]
48+
# args: [--ignore-missing-imports, --no-strict-optional]
49+
# files: ^pygsp/
50+
51+
# - repo: https://github.com/pycqa/pydocstyle
52+
# rev: 6.3.0
53+
# hooks:
54+
# - id: pydocstyle
55+
# args: [--convention=numpy]
56+
# files: ^pygsp/
57+
58+
- repo: https://github.com/asottile/pyupgrade
59+
rev: v3.15.0
60+
hooks:
61+
- id: pyupgrade
62+
args: [--py38-plus]
63+
64+
default_language_version:
65+
python: python3
66+
67+
ci:
68+
autofix_commit_msg: |
69+
[pre-commit.ci] auto fixes from pre-commit.com hooks
70+
71+
for more information, see https://pre-commit.ci
72+
autofix_prs: true
73+
autoupdate_branch: ''
74+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
75+
autoupdate_schedule: weekly
76+
skip: []
77+
submodules: false

.travis.yml

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

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to `Semantic Versioning <https://semver.org>`_.
99
Unreleased
1010
----------
1111

12+
* Upgrade from PyQt5 to PyQt6.
1213
* ``print(graph)`` and ``print(filters)`` now show valuable information.
1314
* Building a graph object is much faster.
1415
* New rectangular filter (low-pass and band-pass).

CONTRIBUTING.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ short example in ``examples``.
3131
Update ``README.rst`` and ``CHANGELOG.rst`` if applicable.
3232

3333
After making any change, please check the style, run the tests, and build the
34-
documentation with the following (enforced by Travis CI)::
34+
documentation with the following (enforced by GitHub Actions)::
3535

3636
$ make lint
3737
$ make test
@@ -43,9 +43,9 @@ tests reasonably cover the changes you've introduced.
4343
To iterate faster, you can partially run the test suite, at various degrees of
4444
granularity, as follows::
4545

46-
$ python -m unittest pygsp.tests.test_docstrings.suite_reference
47-
$ python -m unittest pygsp.tests.test_graphs.TestImportExport
48-
$ python -m unittest pygsp.tests.test_graphs.TestImportExport.test_save_load
46+
$ python -m pytest pygsp/tests/test_docstrings.py
47+
$ python -m pytest pygsp/tests/test_graphs.py::TestGraphs
48+
$ python -m pytest pygsp/tests/test_graphs.py::test_save_load
4949

5050
Making a release
5151
----------------
@@ -82,7 +82,7 @@ Repository organization
8282
Makefile Targets for make
8383
setup.py Meta information about package (published on PyPI)
8484
.gitignore Files ignored by the git revision control system
85-
.travis.yml Defines testing on Travis continuous integration
85+
.github/workflows/ Defines testing on GitHub Actions continuous integration
8686

8787
pygsp/ Contains the modules (the actual toolbox implementation)
8888
__init.py__ Load modules at package import

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ clean:
1313
git clean -Xdf
1414
jupyter nbconvert --inplace --ClearOutputPreprocessor.enabled=True $(NB)
1515

16+
1617
lint:
17-
flake8 --doctests --exclude=doc
18+
flake8 --doctests --exclude=doc,.venv,build --max-line-length=88 --extend-ignore=E203
1819

1920
# Matplotlib doesn't print to screen. Also faster.
2021
export MPLBACKEND = agg
@@ -23,7 +24,7 @@ export DISPLAY = :99
2324

2425
test:
2526
Xvfb $$DISPLAY -screen 0 800x600x24 &
26-
coverage run --branch --source pygsp setup.py test
27+
coverage run --branch --source pygsp -m pytest
2728
coverage report
2829
coverage html
2930
killall Xvfb

0 commit comments

Comments
 (0)