Skip to content

Commit

Permalink
move configuration into pyproject.toml (#134)
Browse files Browse the repository at this point in the history
* move configuration into `pyproject.toml`

* update test workflows

* update reference files

* update test

* rename tests

* test fix

* `fail-fast: true`

* test fix
  • Loading branch information
zacharyburnett authored Apr 21, 2022
1 parent b457b94 commit 379b111
Show file tree
Hide file tree
Showing 83 changed files with 1,165 additions and 985 deletions.
65 changes: 11 additions & 54 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,19 @@ on:
- published

jobs:
build_wheels:
name: build wheel
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.x' ]
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: load cached Python installation
id: cache
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: build-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'setup.*') }}
- name: build wheel
run: pip wheel . -w dist --no-deps
- name: save wheel
uses: actions/upload-artifact@v2
with:
name: build
path: ./dist/*.whl
build_sdist:
name: package source
publish:
name: publish package to PyPI
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: install Python
uses: actions/setup-python@v2
- name: install dependencies
- name: install Poetry
uses: abatilo/actions-poetry@v2.1.3
- name: install Dunamai
run: pip install dunamai
- name: package source
run: python setup.py sdist
- name: save source package
uses: actions/upload-artifact@v2
with:
name: build
path: ./dist/*.tar.gz
upload_pypi:
name: publish to PyPI
needs: [ build_wheels, build_sdist ]
runs-on: ubuntu-latest
steps:
- name: retrieve wheel(s) and source
uses: actions/download-artifact@v2
with:
name: build
path: dist
- name: upload wheel(s) and source
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
- name: extract version from VCS
run: poetry version $(dunamai from any)
- name: build wheel and source
run: poetry build
- name: upload wheel and source
run: poetry publish --username __token__ --password ${{ secrets.PYPI_TOKEN }}
55 changes: 55 additions & 0 deletions .github/workflows/quick_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: quick test

on:
push:
branches-ignore:
- main
paths:
- '**.py'
- '.github/workflows/quick_test.yml'
- 'pyproject.toml'

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: clone repository
uses: actions/checkout@v2
- name: install Python
uses: actions/setup-python@v2
- name: load cached Python installation
id: cache
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: lint-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: install linters
run: pip install flake8 oitnb
- name: lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: lint with oitnb
run: oitnb . --check
test:
needs: lint
name: quick test
runs-on: ubuntu-latest
steps:
- name: clone repository
uses: actions/checkout@v2
- name: install Python
uses: actions/setup-python@v2
- name: load cached Python installation
id: cache
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: test-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: install dependencies
run: pip install ".[testing]"
- name: run tests
run: pytest --numprocesses auto
55 changes: 38 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,50 @@
name: tests

on: [ push ]
on:
push:
branches:
- main
paths:
- '**.py'
- '.github/workflows/tests.yml'
- 'pyproject.toml'
pull_request:
branches:
- main

jobs:
lint:
name: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.x' ]
steps:
- name: clone repository
uses: actions/checkout@v2
- name: install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: load cached Python installation
id: cache
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: lint-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'setup.*') }}
- name: install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install ".[development]"
key: lint-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: install linters
run: pip install flake8 oitnb
- name: lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: lint with oitnb
run: oitnb . --check
test:
needs: lint
name: test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.7', '3.x' ]
os: [ ubuntu-latest, macos-latest ]
python-version: [ '3.7', '3.8', '3.9', '3.x' ]
steps:
- name: clone repository
uses: actions/checkout@v2
Expand All @@ -51,18 +57,33 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: test-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'setup.*') }}
key: test-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install ".[testing]"
- name: run tests
if: matrix.python-version != '3.x' || matrix.os != 'ubuntu-latest'
run: pytest --numprocesses auto
test_with_coverage:
needs: [ lint, test ]
name: test with coverage
runs-on: ubuntu-latest
steps:
- name: clone repository
uses: actions/checkout@v2
- name: install Python
uses: actions/setup-python@v2
- name: load cached Python installation
id: cache
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: test-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: install dependencies
run: pip install ".[testing]"
- name: run tests with coverage
if: matrix.python-version == '3.x' && matrix.os == 'ubuntu-latest'
run: pytest --numprocesses auto --cov . --cov-report xml:coverage.xml
- name: show coverage report
run: coverage report
- name: upload coverage to Codecov
if: matrix.python-version == '3.x' && matrix.os == 'ubuntu-latest'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
51 changes: 48 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
[tool.poetry]
name = 'coupledmodeldriver'
version = '0.0.0'
description = 'coupled model configuration generation'
authors = ['Zach Burnett <[email protected]>']
license = 'CC0-1.0'
readme = 'README.md'
repository = 'https://github.com/noaa-ocs-modeling/CoupledModelDriver.git'
documentation = 'https://coupledmodeldriver.readthedocs.io'

[build-system]
requires = [
"dunamai",
"setuptools",
'poetry-core>=1.0.0',
'poetry-dynamic-versioning',
]
build-backend = "setuptools.build_meta"
build-backend = 'poetry.core.masonry.api'

[tool.poetry-dynamic-versioning]
enable = true

[tool.poetry.dependencies]
python = '^3.7'
adcircpy = '>=1.1.2'
file-read-backwards = '*'
nemspy = '>=1.0.4'
numpy = '*'
pyproj = '*'
typepigeon = '>=1.0.3'
isort = { version = '*', optional = true }
oitnb = { version = '*', optional = true }
pooch = { version = '*', optional = true }
pytest = { version = '*', optional = true }
pytest-cov = { version = '*', optional = true }
pytest-socket = { version = '*', optional = true }
pytest-xdist = { version = '*', optional = true }
wget = { version = '*', optional = true }
m2r2 = { version = '*', optional = true }
sphinx = { version = '*', optional = true }
sphinx-rtd-theme = { version = '*', optional = true }
sphinxcontrib-programoutput = { version = '*', optional = true }

[tool.poetry.extras]
testing = ['pooch', 'pytest', 'pytest-cov', 'pytest-socket', 'pytest-xdist', 'wget']
development = ['isort', 'oitnb']
documentation = ['m2r2', 'sphinx', 'sphinx-rtd-theme', 'sphinxcontrib-programoutput']

[tool.poetry.scripts]
initialize_adcirc = 'coupledmodeldriver.client.initialize_adcirc:main'
generate_adcirc = 'coupledmodeldriver.client.generate_adcirc:main'
check_completion = 'coupledmodeldriver.client.check_completion:main'
unqueued_runs = 'coupledmodeldriver.client.unqueued_runs:main'
44 changes: 0 additions & 44 deletions setup.cfg

This file was deleted.

12 changes: 0 additions & 12 deletions setup.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2022-02-22 12:57 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2022-04-21 08:35 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `config.rc` generated with NEMSpy 1.0.5
# `config.rc` generated with NEMSpy 1.0.8
atm_dir: ../../../../input/forcings/ike
atm_nam: wind_atm_fin_ch_time_vec.nc
wav_dir: ../../../../input/forcings/ike
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2022-02-22 12:57 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2022-04-21 08:35 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `model_configure` generated with NEMSpy 1.0.5
# `model_configure` generated with NEMSpy 1.0.8
total_member: 1
print_esmf: .true.
namelist: atm_namelist.rc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `nems.configure` generated with NEMSpy 1.0.5
# `nems.configure` generated with NEMSpy 1.0.8
# EARTH #
EARTH_component_list: ATM WAV OCN
EARTH_attributes::
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2022-02-22 12:57 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2022-04-21 08:35 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
2 changes: 1 addition & 1 deletion tests/data/reference/test_hera_adcirc_tidal/spinup/fort.15
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2022-02-22 12:57 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2022-04-21 08:35 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `config.rc` generated with NEMSpy 1.0.5
# `config.rc` generated with NEMSpy 1.0.8
wav_dir: ../../../../input/forcings/ike
wav_nam: ww3.Constant.20151214_sxy_ike_date.nc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
created on 2022-02-22 12:57 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
created on 2022-04-21 08:35 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION
Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION
1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION
1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER
Expand Down
Loading

0 comments on commit 379b111

Please sign in to comment.