Skip to content

Commit

Permalink
housekeeping (#71)
Browse files Browse the repository at this point in the history
* switch to ini file

* save figs to test_dir

* Revert "switch to ini file"

This reverts commit 597fccc.

* linting

* workflows should trigger for changes to tests

* specify dependency ranges (#70)

* specify dependency ranges

I ended up trying to install mud on a computer with an older scikit-learn, and it ended up using the cache of like version 0.something, so I want to at least specify the major version we require for the more important libraries.

* loosen matplotlib

* 3.7 support is a pain...

* typo

* prevent warnings from numpy

* specify build os, tools

* fix flake8 E721 errors

* [black] lint files

* [black] notebook linting

* cover more versions of python

* type-checking investigation (#68)

* print mypy and python versions in workflow

* 'if save_path' used to fix 10 mypy errors

* automatic fix using https://github.com/hauntsaninja/no_implicit_optional

* post-fix linting

* refactor to address C901: too complex

* refactor to address C901: too complex

* ignore C901

* fix typo

* sort imports

* if save_path is not None

* no more 3.12 bc numpy 1.24

* fix all mypy issues with 1.8.0

* enforce old cli functionality

* actions updates, experiments with 3.12 (#72)

* experiment with 3.12

* loosen pandas for 3.12

* build updates

* rename, try new build
  • Loading branch information
mathematicalmichael committed Jan 22, 2024
1 parent a134ca7 commit a9c5d5f
Show file tree
Hide file tree
Showing 17 changed files with 607 additions and 510 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/build.yml
Expand Up @@ -2,37 +2,39 @@ name: builds

on:
push:
branches: [ main ]
branches: [main]
paths:
- "src/**.py"
- "tests/**.py"
- "setup.py"
- "setup.cfg"
- ".github/workflows/build.yml"
pull_request:
branches-ignore: '**docker**'
branches-ignore: ["**docker**"]
paths:
- "src/**.py"
- "tests/**.py"
- "setup.py"
- "setup.cfg"
- ".github/workflows/build.yml"
schedule:
- cron: "0 0 1 * *"
- cron: "0 0 1 * *"

jobs:
build:
name: Test build process
name: packaging
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -42,7 +44,7 @@ jobs:
pip install --upgrade wheel setuptools setuptools_scm
- name: Inspect version info
run: |
run: |
python setup.py --version
git describe --dirty --tags --long --match "*[0-9]*"
Expand All @@ -55,12 +57,15 @@ jobs:
run: |
pip install -e .
pip uninstall -y mud
- name: Test build
run: |
python setup.py sdist bdist_wheel
pip uninstall -y mud
- name: New build
run: |
pip install build
python -m build --sdist --wheel
style:
name: Enforce style
Expand All @@ -70,12 +75,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: setup
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -94,4 +99,6 @@ jobs:

- name: type checks
run: |
python --version
mypy --version
mypy src/mud/ tests/
25 changes: 14 additions & 11 deletions .github/workflows/main.yml
Expand Up @@ -5,13 +5,15 @@ on:
branches: [ main ]
paths:
- "src/**.py"
- "tests/**.py"
- "setup.py"
- "setup.cfg"
- ".github/workflows/main.yml"
pull_request:
branches-ignore: "**docker**"
branches-ignore: ["**docker**"]
paths:
- "src/**.py"
- "tests/**.py"
- "setup.py"
- "setup.cfg"
- ".github/workflows/main.yml"
Expand All @@ -20,19 +22,19 @@ on:

jobs:
unit-tests:
name: Run unit tests
name: pytest
strategy:
matrix:
python-version: ["3.7", "3.10"]
python-version: ["3.7", "3.10", "3.11", "3.12"]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -45,25 +47,25 @@ jobs:
run: pytest

- name: Upload coverage to coveralls.io
if: ${{ matrix.python-version }} == 3.9
if: ${{ matrix.python-version }} == 3.10
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

integration-tests:
name: Run integration tests
name: cli examples
strategy:
matrix:
python-version: ["3.9"]
python-version: ["3.10", "3.12"]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -77,6 +79,7 @@ jobs:
texlive-fonts-extra \
texlive-science \
latexmk \
dvipng \
cm-super
- name: Install Python dependencies
Expand All @@ -86,7 +89,7 @@ jobs:
pip install .[examples]
- name: Old CLI
continue-on-error: true
continue-on-error: false
run: mud_run_all -v

- name: New CLI
Expand Down
6 changes: 5 additions & 1 deletion .readthedocs.yml
Expand Up @@ -4,6 +4,11 @@
# Required
version: 2

build:
os: "ubuntu-20.04"
tools:
python: "3.8"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
Expand All @@ -18,7 +23,6 @@ formats:
- epub

python:
version: 3.8
install:
- requirements: docs/requirements.txt
- method: pip
Expand Down
1 change: 0 additions & 1 deletion notebooks/FenicsSolve.ipynb
Expand Up @@ -190,7 +190,6 @@
" gamma=-3,\n",
" save_data=True,\n",
"):\n",
"\n",
" if len(mins) != len(maxs):\n",
" raise ValueError(\"min/max arrays must be of same length\")\n",
"\n",
Expand Down
1 change: 0 additions & 1 deletion notebooks/MUD-ADCIRC-Figs.ipynb
Expand Up @@ -3516,7 +3516,6 @@
" close_fig: bool = False,\n",
" dpi: int = 500,\n",
"):\n",
"\n",
" triangles = mtri.Triangulation(\n",
" adcirc_grid_data[\"X\"], adcirc_grid_data[\"Y\"], adcirc_grid_data[\"triangles\"]\n",
" )\n",
Expand Down
1 change: 0 additions & 1 deletion notebooks/MUD_Butler_2021.ipynb
Expand Up @@ -1915,7 +1915,6 @@
"def plot_conv(\n",
" info, method=\"pca\", field=\"err\", agg=\"mean\", ax=None, fit=False, **kwargs\n",
"):\n",
"\n",
" stat = info.groupby([\"type\", \"n\"])[field].aggregate([agg])\n",
" stat = stat.unstack(level=0)[(agg, method)]\n",
"\n",
Expand Down
1 change: 0 additions & 1 deletion notebooks/Nonlinear_Examples.ipynb
Expand Up @@ -200,7 +200,6 @@
" t_start=1.0,\n",
" sampling_freq=100.0,\n",
"):\n",
"\n",
" time = np.linspace(time_range[0], time_range[1], 1000)\n",
" times = np.arange(t_start, time_range[1], 1 / sampling_freq)[0:N]\n",
"\n",
Expand Down
3 changes: 0 additions & 3 deletions notebooks/ODE_ExpDecay.ipynb
Expand Up @@ -122,7 +122,6 @@
" sampling_freq=100.0,\n",
" std_dev=0.05,\n",
"):\n",
"\n",
" u_t_lambda = lambda t, l: u_0 * np.exp(-np.outer(l, t))\n",
"\n",
" # Build initial samples\n",
Expand Down Expand Up @@ -190,7 +189,6 @@
" sampling_freq=10.0,\n",
" std_dev=0.05,\n",
"):\n",
"\n",
" u_t_lambda = lambda t, l1, l2: (l1 * np.exp(-np.outer(t, l2))).T\n",
"\n",
" # Build initial samples\n",
Expand Down Expand Up @@ -619,7 +617,6 @@
" sampling_freq=10.0,\n",
" std_dev=0.05,\n",
"):\n",
"\n",
" u_t_lambda = lambda t, l1, l2: (l1 * np.exp(-np.outer(t, l2))).T\n",
"\n",
" # Build initial samples\n",
Expand Down
10 changes: 5 additions & 5 deletions setup.cfg
Expand Up @@ -32,10 +32,10 @@ package_dir =
# Add here dependencies of your project (semicolon/line-separated), e.g.
install_requires =
importlib-metadata; python_version<"3.10"
numpy>=1.20
scipy
matplotlib
scikit-learn
numpy>=1.20,<1.27
scipy>=1.2,<2.0
matplotlib>=1.0,<4.0
scikit-learn>=1.0,<2.0

# Require a specific Python version, e.g. Python 2.7 or >= 3.4
python_requires = >=3.7
Expand Down Expand Up @@ -67,7 +67,7 @@ examples =
click
tqdm
prettytable
pandas
pandas>=1.2,<3.0
wget


Expand Down

0 comments on commit a9c5d5f

Please sign in to comment.