Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize package #115

Merged
merged 20 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
labels:
- "Bot"
51 changes: 51 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

name: Documentation

on:
pull_request:
push:
branches: [master, main]
release:
types:
- published

jobs:
build-docs:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-name: TEST
init-shell: bash
create-args: >-
python=3 pip
--file requirements.txt
--file requirements-dev.txt
--channel conda-forge

- name: Install utide
shell: bash -l {0}
run: |
pip install -e . --no-deps --force-reinstall

- name: Build documentation
shell: bash -l {0}
run: |
set -e
pushd docs
make clean html linkcheck
popd

- name: Deploy
if: success() && github.event_name == 'release'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html
16 changes: 3 additions & 13 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,7 @@ on:
jobs:
pre-commit:
runs-on: ubuntu-latest
env:
FORCE_COLOR: "1"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- id: file_changes
uses: trilom/[email protected]
with:
output: ' '
- uses: pre-commit/[email protected]
with:
extra_args: --files ${{ steps.file_changes.outputs.files}}
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected]
28 changes: 17 additions & 11 deletions .github/workflows/publish.yml → .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,53 @@
name: Publish to PyPI

on:
pull_request:
push:
branches: [master, main]
release:
types:
- published

defaults:
run:
shell: bash

jobs:
packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
shell: bash

- name: Install build tools
run: |
python -m pip install --upgrade pip wheel setuptools setuptools_scm build twine pytest numpy scipy

shell: bash
python -m pip install --upgrade pip build

- name: Build binary wheel
- name: Build sdist and binary wheel
run: python -m build --sdist --wheel . --outdir dist

- name: CheckFiles
run: |
ls dist
shell: bash
python -m pip install --upgrade check-manifest
check-manifest --verbose

- name: Test wheels
run: |
cd dist && python -m pip install UTide*.whl
cd dist && python -m pip install *.whl
python -m pip install --upgrade twine
python -m twine check *
shell: bash

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
if: success() && github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
35 changes: 0 additions & 35 deletions .github/workflows/tarball-tests.yml

This file was deleted.

47 changes: 23 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,40 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: [windows-latest, ubuntu-latest, macos-latest]
# Oldest one based on NEP-29 and latest one.
# See https://numpy.org/neps/nep-0029-deprecation_policy.html
numpy-version: ["1.19", "1.22"]
numpy-version: ["1.21", "1.25"]
exclude:
- python-version: "3.10"
numpy-version: "1.19"
- python-version: "3.11"
numpy-version: "1.21"
- python-version: "3.8"
numpy-version: "1.25"
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup
uses: mamba-org/provision-with-micromamba@main
- name: Setup Micromamba Python ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
environment-file: false
environment-name: TEST
init-shell: bash
create-args: >-
python=${{ matrix.python-version }} pip
--file requirements.txt
--file requirements-dev.txt
--channel conda-forge

- name: Python ${{ matrix.python-version }} numpy ${{ matrix.numpy-version }}
- name: Install utide
shell: bash -l {0}
run: |
micromamba create --name TEST python=${{ matrix.python-version }} --file requirements.txt --file requirements-dev.txt --channel conda-forge
micromamba activate TEST
micromamba install numpy=${{ matrix.numpy-version }}
pip install -e . --no-deps --force-reinstall

- name: Debug Info
shell: bash -l {0}
run: |
micromamba activate TEST
micromamba info --all
micromamba list
run: >
python -m pip install -e . --no-deps --force-reinstall
&& micromamba install numpy=${{ matrix.numpy-version }}
&& pip install -e . --no-deps --force-reinstall

- name: Tests
- name: Run tests
shell: bash -l {0}
run: |
micromamba activate TEST
pytest -n 2 -rxs --cov=utide tests
pytest -rxs --cov=utide tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ doc/_build/
.project
.pydevproject
.vscode/
utide/_version.py
2 changes: 0 additions & 2 deletions .isort.cfg

This file was deleted.

50 changes: 30 additions & 20 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.4.0
hooks:
- id: check-ast
- id: end-of-file-fixer
Expand All @@ -14,34 +14,44 @@ repos:
- id: trailing-whitespace
- id: debug-statements

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: flake8
exclude: docs/source/conf.py
args: [--max-line-length=105]
- id: black
language_version: python3

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.5.1
hooks:
- id: isort
additional_dependencies: [toml]
args: [--project=utide, --multi-line=3, --lines-after-imports=2, --lines-between-types=1, --trailing-comma, --force-grid-wrap=0, --use-parentheses, --line-width=88]
- id: add-trailing-comma

- repo: https://github.com/psf/black
rev: 22.3.0
- repo: https://github.com/keewis/blackdoc
rev: v0.3.8
hooks:
- id: black
language_version: python3
- id: blackdoc

- repo: https://github.com/asottile/pyupgrade
rev: v2.32.0
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: pyupgrade
- id: codespell
exclude: >
(?x)^(
.*\.yaml
)$
args:
- --py36-plus
- --ignore-words-list=fo,htmp

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.2.3
rev: v2.5.1
hooks:
- id: add-trailing-comma

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.272
hooks:
- id: ruff

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 0.12.0
hooks:
- id: pyproject-fmt
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include *.txt
include README.rst
include README.md
include pyproject.toml

graft utide
Expand All @@ -11,6 +11,6 @@ prune *.egg-info

global-exclude *.mat

exclude *.yml
exclude *.enc
exclude *.yaml
exclude .gitignore
exclude utide/_version.py
Loading
Loading