Skip to content

Commit 7c8f1c5

Browse files
authored
Merge pull request #22 from yb6599/master
CI update
2 parents f38d383 + bab4204 commit 7c8f1c5

34 files changed

+432
-328
lines changed

.github/workflows/main.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: CI
5+
6+
on:
7+
push:
8+
branches: [ "master" ]
9+
pull_request:
10+
branches: [ "master" ]
11+
12+
13+
jobs:
14+
linting:
15+
name: Linting
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.12"
24+
- name: Linting
25+
run: |
26+
pip install pre-commit
27+
pre-commit run --all-files
28+
29+
build:
30+
name: build
31+
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
python-version: ["3.9", "3.10", "3.11", "3.12"]
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: Set up Python ${{ matrix.python-version }}
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: ${{ matrix.python-version }}
43+
- name: build
44+
run: pip install .
45+
- name: test import
46+
run: python -c "import pysensors"
47+
48+
tests:
49+
name: Tests
50+
needs: linting
51+
runs-on: ubuntu-latest
52+
strategy:
53+
fail-fast: false
54+
max-parallel: 4
55+
matrix:
56+
python-version: ["3.9", "3.10", "3.11", "3.12"]
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
- name: Set up Python ${{ matrix.python-version }}
61+
uses: actions/setup-python@v5
62+
with:
63+
python-version: ${{ matrix.python-version }}
64+
- name: Install dependencies
65+
run: |
66+
pip install -r requirements-dev.txt
67+
- name: Test with pytest
68+
run: |
69+
pytest tests --cov=pysensors --cov-report=xml
70+
- name: Upload coverage to Codecov
71+
uses: codecov/codecov-action@v5
72+
with:
73+
token: ${{ secrets.CODECOV_TOKEN }}
74+
file: ./coverage.xml
75+
- name: Execute feature notebook with papermill
76+
run: |
77+
pip install papermill
78+
cd examples
79+
papermill --report-mode pysensors_overview.ipynb out.json
80+
- uses: actions/cache@v4
81+
with:
82+
path: ~/.cache/pip
83+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
84+
restore-keys: |
85+
${{ runner.os }}-pip-

.github/workflows/run-tests.yml

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ coverage.xml
1717

1818
# virtual environment
1919
venv/*
20+
env/*
2021

2122
.ipynb_checkpoints
2223
*/.ipynb_checkpoints/*

.pre-commit-config.yaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
21
fail_fast: false
32
repos:
43
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.3.0
4+
rev: v5.0.0
65
hooks:
76
- id: check-added-large-files
87
args: ["--maxkb=775"]
98
- id: check-merge-conflict
10-
- repo: https://github.com/asottile/reorder_python_imports
11-
rev: v3.8.2
9+
- repo: https://github.com/PyCQA/isort
10+
rev: 5.12.0
1211
hooks:
13-
- id: reorder-python-imports
14-
- repo: https://github.com/ambv/black
15-
rev: 22.8.0
12+
- id: isort
13+
args: [--profile=black]
14+
- repo: https://github.com/psf/black
15+
rev: 25.1.0
1616
hooks:
1717
- id: black
18-
- repo: https://gitlab.com/pycqa/flake8
19-
rev: 3.9.2
18+
- repo: https://github.com/sphinx-contrib/sphinx-lint
19+
rev: v0.6.1
20+
hooks:
21+
- id: sphinx-lint
22+
- repo: https://github.com/pycqa/flake8
23+
rev: 7.1.1
2024
hooks:
2125
- id: flake8
2226
args: ["--config=setup.cfg"]

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ PySensors provides the ``SSPOR`` (Sparse Sensor Placement Optimization for Recon
3232
Take representative examples of the types of data to be reconstructed (in this case polynomials)
3333

3434
.. code-block:: python
35-
35+
3636
x = numpy.linspace(0, 1, 1001)
3737
data = numpy.vander(x, 11).T # Create an array whose rows are powers of x
3838
39-
feed them to a ``SSPOR`` instance with 10 sensors, and
39+
feed them to a ``SSPOR`` instance with 10 sensors, and
4040

4141
.. code-block:: python
4242
@@ -265,7 +265,7 @@ References
265265

266266
.. |JOSS| image:: https://joss.theoj.org/papers/10.21105/joss.02828/status.svg
267267
:target: https://doi.org/10.21105/joss.02828
268-
268+
269269
.. |Zenodo| image:: https://zenodo.org/badge/260577702.svg
270270
:target: https://zenodo.org/badge/latestdoi/260577702
271271

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515

1616
PySensors @ PyPI <https://pypi.org/project/python-sensors/>
17-
Issue Tracker <https://github.com/dynamicslab/pysensors/issues>
17+
Issue Tracker <https://github.com/dynamicslab/pysensors/issues>

examples/classification.ipynb

Lines changed: 42 additions & 58 deletions
Large diffs are not rendered by default.

examples/vandermonde.ipynb

Lines changed: 12 additions & 18 deletions
Large diffs are not rendered by default.

pysensors/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
from pkg_resources import DistributionNotFound
2-
from pkg_resources import get_distribution
1+
from importlib.metadata import PackageNotFoundError, distribution
32

43
try:
5-
__version__ = get_distribution("python-sensors").version
6-
except DistributionNotFound:
4+
__version__ = distribution("python-sensors").version
5+
except PackageNotFoundError:
76
pass
87

98
from .classification import SSPOC
109
from .reconstruction import SSPOR
1110

12-
1311
__all__ = [
1412
# Modules:
1513
"basis",

pysensors/basis/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
from ._custom import Custom
12
from ._identity import Identity
23
from ._random_projection import RandomProjection
34
from ._svd import SVD
4-
from ._custom import Custom
55

6-
__all__ = ["Identity", "SVD", "RandomProjection","Custom"]
6+
__all__ = ["Identity", "SVD", "RandomProjection", "Custom"]

0 commit comments

Comments
 (0)