Skip to content

Commit

Permalink
Merge pull request #18 from mcflugen/mcflugen/update-repo
Browse files Browse the repository at this point in the history
Update repository
  • Loading branch information
mcflugen authored Jul 28, 2023
2 parents d7ef670 + e3a5eea commit 3d34609
Show file tree
Hide file tree
Showing 37 changed files with 810 additions and 334 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[run]
omit =
omit =
*/_version.py
28 changes: 28 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: changelog

on:
pull_request:
types: [labeled, unlabeled, opened, reopened, synchronize]

permissions:
contents: read

jobs:
check-changelog-entry:
name: changelog entry
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
# `towncrier check` runs `git diff --name-only origin/main...`, which
# needs a non-shallow clone.
fetch-depth: 0

- name: Check changelog
if: contains(github.event.pull_request.labels.*.name, 'skip news') != true
run: |
if ! pipx run towncrier check --compare-with origin/${{ github.base_ref }}; then
echo "Please see https://landlab.readthedocs.io/en/master/development/contribution/index.html?highlight=towncrier#news-entries for guidance."
false
fi
27 changes: 27 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint

on: [push, pull_request]

jobs:

lint:
name: Check for lint
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Lint
run: |
pip install nox
nox -s lint -- --no-skip
46 changes: 46 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: TestPyPI

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+[ab][0-9]+'

env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
TWINE_REPOSITORY_URL: 'https://test.pypi.org/legacy/'

jobs:
build-and-publish:
name: Build and publish to TestPyPI
runs-on: ubuntu-latest

defaults:
run:
shell: bash -l {0}

strategy:
fail-fast: false

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Install twine
run: |
pip install --upgrade pip wheel setuptools
pip install twine
python --version
pip --version
twine --version
- name: Create source distribution
run: |
python setup.py sdist --dist-dir wheelhouse
- name: Upload source distribution
run: |
twine upload --skip-existing wheelhouse/*.tar.gz
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: PyPI

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- '!v[0-9]+.[0-9]+.[0-9]+[ab][0-9]+'

env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

jobs:
build-and-publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest

defaults:
run:
shell: bash -l {0}

strategy:
fail-fast: false

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install twine
run: |
pip install --upgrade pip wheel setuptools
pip install twine
python --version
pip --version
twine --version
- name: Create source distribution
run: |
python setup.py sdist --dist-dir wheelhouse
- name: Upload source distribution
run: |
twine upload --skip-existing wheelhouse/*.tar.gz
65 changes: 65 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Test

on: [push, pull_request]

jobs:
build-and-test:
name: Run the tests
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ${{ matrix.os }}

defaults:
run:
shell: bash -l {0}

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3

- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
channels: conda-forge
channel-priority: true

- name: Show conda installation info
run: |
conda install mamba
pip install nox
conda info
conda list
- name: Test
env:
HYPOTHESIS_PROFILE: "ci"
run: |
nox -s test
- name: Coveralls
if: matrix.os == 'ubuntu-latest'
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
flag-name: py${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.pytest-marker }}
debug: true

coveralls_finish:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
debug: true
112 changes: 112 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
repos:
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
name: black
description: "Black: The uncompromising Python code formatter"
entry: black
language: python
language_version: python3
minimum_pre_commit_version: 2.9.2
require_serial: true
types_or: [python, pyi]
- id: black-jupyter
name: black-jupyter
description:
"Black: The uncompromising Python code formatter (with Jupyter Notebook support)"
entry: black
language: python
minimum_pre_commit_version: 2.9.2
require_serial: true
types_or: [python, pyi, jupyter]
additional_dependencies: [".[jupyter]"]

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-simplify

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-pyupgrade
args: ["--py39-plus"]
- id: nbqa-isort
- id: nbqa-flake8
args: ["--extend-ignore=E402"]
exclude: |
(?x)^(
notebooks/tutorials/making_components/making_components.ipynb
)
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
description: Strip output from jupyter notebooks
args: [--drop-empty-cells]

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py39-plus]

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
files: \.py$

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-builtin-literals
- id: check-added-large-files
- id: check-case-conflict
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: forbid-new-submodules
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/regebro/pyroma
rev: "4.2"
hooks:
- id: pyroma
args: ["-d", "--min=10", "."]
additional_dependencies:
- numpy
- cython

- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
hooks:
- id: check-manifest
args: ["--ignore=.nox,build", "--no-build-isolation"]
additional_dependencies:
- numpy
- cython~=3.0.0b3

- repo: https://github.com/PyCQA/pydocstyle
rev: 6.1.1
hooks:
- id: pydocstyle
files: landlab/.*\.py$
args:
- --convention=numpy
- --add-select=D417
additional_dependencies: [".[toml]"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.982
hooks:
- id: mypy
additional_dependencies: [types-all]
62 changes: 0 additions & 62 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 3d34609

Please sign in to comment.