Skip to content

Commit

Permalink
Merge pull request #218 from halomod/warnings-tests
Browse files Browse the repository at this point in the history
Warnings tests
  • Loading branch information
steven-murray authored Jul 24, 2024
2 parents 7545931 + d47f0c1 commit 57e31ca
Show file tree
Hide file tree
Showing 45 changed files with 428 additions and 437 deletions.
45 changes: 30 additions & 15 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
[flake8]
ignore =
E203 # No space before colon
# No space before colon
E203
W503
D107 # Missing docstring in __init__ (we do it in the class)
D401 # "First line should be in imperative mood" -- this doesn't work for properties, see https://github.com/PyCQA/pydocstyle/issues/301
A003 # allow method names to be the same as python builtins
RST210 # inline strong start-string without end-string. This is OK in the case of **kwargs in parameters.
D102 # Ignore public methods without docstrings, because it doesn't check for inheritance :/
D200 # TODO: remove. (one-line docstring should fit on one line with quotes)
D400 # TODO: remove. (first line should end with a period)
E501 # TODO: remove (line too long)
D105 # TODO: remove
D204 # TODO: remove
D202 # TODO: remove
D205 # TODO: remove
G004 # logging statement uses f-string
B028 # stuff manually surrounded by quotes.
# Missing docstring in __init__ (we do it in the class)
D107
# "First line should be in imperative mood" -- this doesn't work for properties, see https://github.com/PyCQA/pydocstyle/issues/301
D401
# allow method names to be the same as python builtins
A003
# inline strong start-string without end-string. This is OK in the case of **kwargs in parameters.
RST210
# Ignore public methods without docstrings, because it doesn't check for inheritance :/
D102
# TODO: remove. (one-line docstring should fit on one line with quotes)
D200
# TODO: remove. (first line should end with a period)
D400
# TODO: remove (line too long)
E501
# TODO: remove
D105
# TODO: remove
D204
# TODO: remove
D202
# TODO: remove
D205
# logging statement uses f-string
G004
# No explicit stacklevel keyword argument in warn calls
B028
max-line-length = 88
# Should be 18.
max-complexity = 25
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check Distribution Build

on: push

jobs:
check-build:
name: Twine Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install Build Tools
run: pip install build twine

- name: Build a binary wheel
run: |
python -m build .
- name: Check Distribution
run: |
twine check dist/*
27 changes: 0 additions & 27 deletions .github/workflows/merge-me.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/merge-to-dev.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/pre_commit.yaml

This file was deleted.

52 changes: 20 additions & 32 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,30 @@
name: Deploy to PyPI
name: Publish Python distributions to PyPI

on: push
on:
release:
types: [published]

jobs:
build-n-publish:
name: Deploy
runs-on: ubuntu-22.04
name: Make Release on PyPI and Github
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
# https://github.com/ansible/pylibssh/blob/1e7b17f/.github/workflows/build-test-n-publish.yml#L146-L151
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
git describe --tags
git describe --tags $(git rev-list --tags --max-count=1)
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install pep517
run: |
python -m pip install pep517 --user
python -m pip install setuptools_scm
python setup.py --version
- name: Create setuptools_scm env variable
if: startsWith(github.ref, 'refs/tags/') != true
shell: bash
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Build Tools
run: pip install build

- name: Build a binary wheel
run: |
wget https://gist.github.com/plaplant/0902f09e59166bac742bbd554f3cd2f9/raw/make_dev_version.sh -O ../make_dev_version.sh
version=$(bash ../make_dev_version.sh)
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$version" >> $GITHUB_ENV
- name: Build a binary wheel and a source tarball
run: python -m pep517.build --binary --source --out-dir dist .
# deploy to actual PyPI only when a tag is pushed (which should happen only
# automatically on master)
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
python -m build .
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
17 changes: 0 additions & 17 deletions .github/workflows/tag-release.yaml

This file was deleted.

12 changes: 6 additions & 6 deletions .github/workflows/test_suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ name: Tests
# Also, only test on pull requests into master/dev.
on:
push:
tags-ignore:
- 'v*'
pull_request:
branches:
- 'master'
- 'dev'
- 'main'

jobs:
tests:
Expand All @@ -34,8 +31,11 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup GNU Fortran
uses: modflowpy/[email protected]
- uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: gcc
version: 13
- name: Install
run: pip install .[dev]
- name: Run Tests
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/warnings-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Warnings Tests

# Test on all pushes, except when the push is literally just a tag (because we
# tag automatically via CI, and therefore there's no extra code in that push).
# Also, only test on pull requests into master/dev.
on:
push:
pull_request:
branches:
- 'main'

jobs:
tests:
env:
ENV_NAME: tests
PYTHON: ${{ matrix.python-version }}
OS: ${{ matrix.os }}
name: Testing
# needs: [linter]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
steps:
- uses: actions/checkout@master
with:
fetch-depth: 1
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: gcc
version: 13
- name: Install
run: pip install .[dev]
- name: Run Tests
run: |
python -m pytest -Werror --cov=hmf --cov-config=.coveragerc --cov-report xml:./coverage.xml --durations=25
- uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-latest' && success()
with:
file: ./coverage.xml # optional
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
24 changes: 12 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: '^docs/conf.py'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
Expand All @@ -18,35 +18,35 @@ repos:
- id: mixed-line-ending
args: ['--fix=no']
- repo: https://github.com/PyCQA/flake8
rev: '5.0.4' # pick a git hash / tag to point to
rev: '7.0.0' # pick a git hash / tag to point to
hooks:
- id: flake8
additional_dependencies:
- flake8-rst-docstrings
- flake8-docstrings
- flake8-builtins
- flake8-logging-format
- flake8-rst-docstrings
- flake8-rst
- flake8-markdown
- flake8-bugbear
- flake8-comprehensions
- flake8-print
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: rst-backticks
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/asottile/pyupgrade
rev: v3.2.0
rev: v3.16.0
hooks:
- id: pyupgrade
args: [--py38-plus]
16 changes: 8 additions & 8 deletions development/growth_factor_integration.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 57e31ca

Please sign in to comment.