Skip to content

Commit ff83875

Browse files
authored
Merge pull request #37 from ocefpaf/update_best_practices
Update best practices example
2 parents be51938 + 43ff998 commit ff83875

16 files changed

Lines changed: 174 additions & 85 deletions

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,18 @@ updates:
99
interval: "daily"
1010
labels:
1111
- "Bot"
12+
groups:
13+
github-actions:
14+
patterns:
15+
- '*'
16+
cooldown:
17+
default-days: 7
18+
19+
- package-ecosystem: "pre-commit"
20+
directory: "/"
21+
schedule:
22+
interval: "daily"
23+
labels:
24+
- "Bot"
25+
cooldown:
26+
default-days: 7

.github/workflows/deploy-docs.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Documentation
22

3+
# no permissions by default
4+
permissions: {}
5+
36
on:
47
pull_request:
58
push:
@@ -12,15 +15,21 @@ on:
1215
jobs:
1316
build-docs:
1417
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
defaults:
21+
run:
22+
shell: bash -l {0}
1523

1624
steps:
1725
- name: checkout
18-
uses: actions/checkout@v6
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1927
with:
2028
fetch-depth: 0
29+
persist-credentials: false
2130

2231
- name: Setup Micromamba
23-
uses: mamba-org/setup-micromamba@v2
32+
uses: mamba-org/setup-micromamba@add3a49764cedee8ee24e82dfde87f5bc2914462 # v2.0.7
2433
with:
2534
environment-name: TEST
2635
init-shell: bash
@@ -31,12 +40,10 @@ jobs:
3140
--channel conda-forge
3241
3342
- name: Install package
34-
shell: bash -l {0}
3543
run: |
3644
python -m pip install -e . --no-deps --force-reinstall
3745
3846
- name: Build documentation
39-
shell: bash -l {0}
4047
run: |
4148
set -e
4249
jupyter nbconvert --to notebook --execute notebooks/tutorial.ipynb --output=tutorial-output.ipynb
@@ -47,7 +54,7 @@ jobs:
4754
4855
- name: Deploy
4956
if: success() && github.event_name == 'release'
50-
uses: peaceiris/actions-gh-pages@v4
57+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
5158
with:
5259
github_token: ${{ secrets.GITHUB_TOKEN }}
5360
publish_dir: docs/build/html

.github/workflows/pypi.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,55 @@ on:
99
types:
1010
- published
1111

12+
defaults:
13+
run:
14+
shell: bash
15+
1216
jobs:
13-
packages:
17+
pypi-publish:
18+
name: Upload release to PyPI
1419
runs-on: ubuntu-latest
20+
environment:
21+
name: pypi
22+
url: https://pypi.org/p/ioos-pkg-skeleton/
23+
permissions:
24+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
25+
1526
steps:
16-
- uses: actions/checkout@v6
27+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
28+
with:
29+
# Should be enough for setuptools-scm
30+
fetch-depth: 100
31+
persist-credentials: false
1732

1833
- name: Set up Python
19-
uses: actions/setup-python@v6
34+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2035
with:
2136
python-version: "3.x"
2237

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

2741
- name: Install build tools
2842
run: |
2943
python -m pip install --upgrade pip build
3044
31-
shell: bash
3245
33-
- name: Build binary wheel
46+
- name: Build sdist and binary wheel
3447
run: python -m build --sdist --wheel . --outdir dist
3548

3649
- name: CheckFiles
3750
run: |
3851
ls dist
39-
shell: bash
52+
python -m pip install --upgrade check-manifest
53+
check-manifest --verbose
4054
4155
- name: Test wheels
4256
run: |
4357
cd dist && python -m pip install *.whl
4458
python -m pip install --upgrade twine
4559
python -m twine check *
46-
shell: bash
4760
4861
- name: Publish a Python distribution to PyPI
4962
if: success() && github.event_name == 'release'
50-
uses: pypa/gh-action-pypi-publish@release/v1
51-
with:
52-
user: __token__
53-
password: ${{ secrets.PYPI_PASSWORD }}
63+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0

.github/workflows/tests.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Tests
22

3+
# no permissions by default
4+
permissions: {}
5+
36
on:
47
pull_request:
58
push:
@@ -10,17 +13,21 @@ jobs:
1013
runs-on: ${{ matrix.os }}
1114
strategy:
1215
matrix:
13-
python-version: ["3.8", "3.9", "3.10", "3.11"]
16+
python-version: [ "3.10", "3.14"]
1417
os: [windows-latest, ubuntu-latest, macos-latest]
1518
fail-fast: false
19+
defaults:
20+
run:
21+
shell: bash -l {0}
1622

1723
steps:
18-
- uses: actions/checkout@v6
24+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1925
with:
2026
fetch-depth: 0
27+
persist-credentials: false
2128

2229
- name: Setup Micromamba ${{ matrix.python-version }}
23-
uses: mamba-org/setup-micromamba@v2
30+
uses: mamba-org/setup-micromamba@add3a49764cedee8ee24e82dfde87f5bc2914462 # v2.0.7
2431
with:
2532
environment-name: TEST
2633
init-shell: bash
@@ -31,11 +38,9 @@ jobs:
3138
--channel conda-forge
3239
3340
- name: Install package
34-
shell: bash -l {0}
3541
run: |
3642
python -m pip install -e . --no-deps --force-reinstall
3743
3844
- name: Tests
39-
shell: bash -l {0}
4045
run: |
4146
python -m pytest -n 2 -rxs --cov=ioos_pkg_skeleton tests

.isort.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22

33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.4.0
4+
rev: v6.0.0
55
hooks:
66
- id: trailing-whitespace
77
exclude: tests/data
@@ -15,59 +15,73 @@ repos:
1515
files: requirements-dev.txt
1616

1717
- repo: https://github.com/econchick/interrogate
18-
rev: 1.5.0
18+
rev: 1.7.0
1919
hooks:
2020
- id: interrogate
2121
exclude: ^(docs|setup.py|tests)
2222
args: [--config=pyproject.toml]
2323

2424
- repo: https://github.com/keewis/blackdoc
25-
rev: v0.3.8
25+
rev: v0.4.6
2626
hooks:
2727
- id: blackdoc
2828

2929
- repo: https://github.com/charliermarsh/ruff-pre-commit
30-
rev: v0.0.282
30+
rev: v0.15.8
3131
hooks:
3232
- id: ruff
33-
34-
- repo: https://github.com/psf/black
35-
rev: 23.7.0
36-
hooks:
37-
- id: black
38-
language_version: python3
33+
args: ["--fix", "--show-fixes"]
34+
- id: ruff-format
3935

4036
- repo: https://github.com/codespell-project/codespell
41-
rev: v2.2.5
37+
rev: v2.4.2
4238
hooks:
4339
- id: codespell
4440
args:
4541
- --quiet-level=2
4642

4743
- repo: https://github.com/asottile/add-trailing-comma
48-
rev: v3.0.1
44+
rev: v4.0.0
4945
hooks:
5046
- id: add-trailing-comma
5147

5248
- repo: https://github.com/tox-dev/pyproject-fmt
53-
rev: "0.13.0"
49+
rev: "v2.21.0"
5450
hooks:
5551
- id: pyproject-fmt
5652

5753
- repo: https://github.com/aio-libs/sort-all
58-
rev: "v1.2.0"
54+
rev: "v1.3.0"
5955
hooks:
6056
- id: sort-all
6157
types: [file, python]
6258

59+
- repo: https://github.com/nbQA-dev/nbQA
60+
rev: 1.9.1
61+
hooks:
62+
- id: nbqa-check-ast
63+
- id: nbqa-black
64+
- id: nbqa-ruff
65+
args: [
66+
--fix,
67+
--config=ruff.toml,
68+
]
69+
70+
- repo: https://github.com/bdice/nb-strip-paths
71+
rev: v0.1.0
72+
hooks:
73+
- id: nb-strip-paths
74+
75+
- repo: https://github.com/woodruffw/zizmor-pre-commit
76+
rev: v1.23.1
77+
hooks:
78+
- id: zizmor
6379

6480
ci:
6581
autofix_commit_msg: |
6682
[pre-commit.ci] auto fixes from pre-commit.com hooks
6783
6884
for more information, see https://pre-commit.ci
6985
autofix_prs: false
70-
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
71-
autoupdate_schedule: monthly
7286
skip: []
7387
submodules: false

MANIFEST.in

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
include *.txt
2-
include README.md
3-
include pyproject.toml
2+
include *.md
3+
include *.toml
44

5-
# CHANGE PKG NAME HERE
65
graft ioos_pkg_skeleton
76

87
prune docs
98
prune tests
109
prune notebooks
1110
prune *.egg-info
1211

13-
global-exclude *.nc
14-
15-
exclude *.yml
16-
exclude *.enc
1712
exclude .gitignore
18-
exclude .isort.cfg
13+
exclude ioos_pkg_skeleton/_version.py
14+
15+
global-exclude *.nc
16+
global-exclude *.yaml
17+
global-exclude *.yml

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pip install ioos_pkg_skeleton
2727
```python
2828
from ioos_pkg_skeleton import ioos_pkg_skeleton
2929

30-
3130
ioos_pkg_skeleton.meaning_of_life_url()
3231
```
3332

docs/source/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@
5858
# |version| and |release|, also used in various other places throughout the
5959
# built documents.
6060
#
61-
from ioos_pkg_skeleton import __version__ as VERSION # noqa
61+
from ioos_pkg_skeleton import __version__
6262

63-
version = VERSION
63+
version = __version__
6464
# The full version, including alpha/beta/rc tags.
65-
release = VERSION
65+
release = __version__
6666

6767
# The language for content autogenerated by Sphinx. Refer to documentation
6868
# for a list of supported languages.

docs/source/how2package4ioos.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ setup(
8989
"tag_regex": r"^(?P<prefix>v)?(?P<version>[^\+]+)(?P<suffix>.*)?$",
9090
}
9191
)
92-
9392
```
9493

9594
We recommend the use of `setuptools-scm`.

0 commit comments

Comments
 (0)