Skip to content

Commit f50fbc3

Browse files
Merge pull request #170 from ImperialCollegeLondon/release/3.0.1
Release candidate 3.0.1 RC 7
2 parents 93362fe + 838f6e8 commit f50fbc3

File tree

114 files changed

+6035
-3360
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+6035
-3360
lines changed
Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
name: Test and build
22

3-
on: [push, pull_request, release]
3+
# When does this run - new, reopened or updated PRs and when the workflow is called by
4+
# another workflow, such as the publishing actions.
5+
on:
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
workflow_call:
9+
410

511
jobs:
6-
# qa:
7-
# runs-on: ubuntu-latest
8-
# steps:
9-
# - uses: actions/checkout@v4
10-
# - uses: actions/setup-python@v5
11-
# with:
12-
# python-version: "3.9"
13-
# - uses: pre-commit/action@v3.0.0
12+
13+
qa:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.10"
20+
- uses: pre-commit/action@v3.0.0
21+
1422

1523
test:
16-
# needs: qa
24+
needs: qa
1725
runs-on: ${{ matrix.os }}
1826
strategy:
1927
fail-fast: false
2028
matrix:
2129
os: [ ubuntu-latest, macos-latest, windows-latest ]
22-
python-version: [ "3.9" , "3.10", "3.11" ]
30+
python-version: [ "3.10", "3.11", "3.12" ]
2331

2432
steps:
2533
- uses: actions/checkout@v4
@@ -39,21 +47,21 @@ jobs:
3947
- name: Run tests
4048
run: poetry run pytest --cov-report xml
4149

42-
- name: Upload coverage reports to Codecov
43-
id: codecov
44-
if: success() && (matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9)
50+
51+
- name: Upload coverage to Codecov
52+
if: (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10')
4553
uses: codecov/codecov-action@v3
4654
env:
4755
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4856

4957
docs_build:
50-
# needs: qa
58+
needs: qa
5159
runs-on: ubuntu-latest
5260
steps:
5361
- uses: actions/checkout@v4
5462
- uses: actions/setup-python@v5
5563
with:
56-
python-version: "3.9"
64+
python-version: "3.10"
5765

5866
- name: Install Poetry
5967
uses: abatilo/actions-poetry@v2.2.0
@@ -64,4 +72,11 @@ jobs:
6472
run: poetry install
6573

6674
- name: Build docs using mkdocs
67-
run: poetry run mkdocs build --strict
75+
run: poetry run mkdocs build --strict
76+
77+
- name: Check for file modifications due to docs build
78+
run: |
79+
if git status | grep -q "modified"; then
80+
echo "Docs build process has resulted in file changes."
81+
exit 1
82+
fi

.github/workflows/sdv_publish.yaml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Publishing
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
# First, run the standard test suite - for this to work correctly, the workflow needs
9+
# to inherit the organisation secrets used to authenticate to CodeCov.
10+
# https://github.com/actions/runner/issues/1413
11+
test:
12+
uses: ./.github/workflows/sdv_ci.yaml
13+
secrets: inherit
14+
15+
# Next, build the package wheel and source releases and add them to the release assets
16+
build-wheel:
17+
needs: test
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
# Build the package - this could use `poetry build` directly but pyproject.toml
23+
# already has the build-system configured to use poetry so `pip` should pick that
24+
# up automatically.
25+
- name: Build sdist
26+
run: |
27+
python -m pip install --upgrade build
28+
python -m build
29+
30+
# Upload the build outputs as job artifacts - these will be two files with x.y.z
31+
# version numbers:
32+
# - pyrealm-x.y.z-py3-none-any.whl
33+
# - pyrealm-x.y.z.tar.gz
34+
- uses: actions/upload-artifact@v4
35+
with:
36+
path: dist/safedata_validator*
37+
38+
# Add the built files to the release assets, alongside the repo archives
39+
# automatically added by GitHub. These files should then match exactly to the
40+
# published files on PyPI.
41+
- uses: softprops/action-gh-release@v1
42+
with:
43+
files: dist/safedata_validator*
44+
45+
# Now attempt to publish the package to the TestPyPI site, where the pyrealm project
46+
# has been configured to allow trusted publishing from this repo and workflow.
47+
#
48+
# The skip-existing option allows the publication step to pass even when the release
49+
# files already exists on PyPI. That suggests something has gone wrong with the
50+
# release or the build file staging and the release should not be allowed to continue
51+
# to publish on PyPI.
52+
53+
publish-TestPyPI:
54+
needs: build-wheel
55+
name: Publish safedata_validator to TestPyPI
56+
runs-on: ubuntu-latest
57+
permissions:
58+
id-token: write
59+
60+
steps:
61+
# Download the built package files from the job artifacts
62+
- name: Download sdist artifact
63+
uses: actions/download-artifact@v4
64+
with:
65+
name: artifact
66+
path: dist
67+
68+
# Information step to show the contents of the job artifacts
69+
- name: Display structure of downloaded files
70+
run: ls -R dist
71+
72+
# Use trusted publishing to release the files downloaded into dist to TestPyPI
73+
- name: Publish package distributions to TestPyPI
74+
uses: pypa/gh-action-pypi-publish@release/v1
75+
with:
76+
repository-url: https://test.pypi.org/legacy/
77+
# skip-existing: true
78+
79+
# The final job in the workflow is to publish to the real PyPI as long as the release
80+
# name does not contain the tag 'test-pypi-only'
81+
publish-PyPI:
82+
if: ${{ ! contains(github.event.release.name, 'test-pypi-only')}}
83+
needs: publish-TestPyPI
84+
name: Publish safedata_validator to PyPI
85+
runs-on: ubuntu-latest
86+
permissions:
87+
id-token: write
88+
89+
steps:
90+
# Download the built package files from the job artifacts
91+
- name: Download sdist artifact
92+
uses: actions/download-artifact@v4
93+
with:
94+
name: artifact
95+
path: dist
96+
97+
# Information step to show the contents of the job artifacts
98+
- name: Display structure of downloaded files
99+
run: ls -R dist
100+
101+
# Use trusted publishing to release the files downloaded into dist to PyPI
102+
- name: Publish package distributions to PyPI
103+
uses: pypa/gh-action-pypi-publish@release/v1

.pre-commit-config.yaml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,27 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-merge-conflict
66
- id: debug-statements
7-
- repo: https://github.com/PyCQA/isort
8-
rev: "5.12.0"
7+
- repo: https://github.com/astral-sh/ruff-pre-commit
8+
# Ruff version.
9+
rev: v0.6.2
910
hooks:
10-
- id: isort
11-
additional_dependencies: [toml]
12-
- repo: https://github.com/psf/black
13-
rev: "22.8.0"
14-
hooks:
15-
- id: black
16-
- repo: https://github.com/pycqa/flake8
17-
rev: 6.1.0
18-
hooks:
19-
- id: flake8
20-
additional_dependencies: [flake8-docstrings]
11+
# Run the linter.
12+
- id: ruff
13+
args: [--fix, --exit-non-zero-on-fix]
14+
# Run the formatter.
15+
- id: ruff-format
2116
- repo: https://github.com/pre-commit/mirrors-mypy
22-
rev: v0.991
17+
rev: v1.11.2
2318
hooks:
2419
- id: mypy
2520
additional_dependencies:
2621
- types-simplejson
2722
- types-python-dateutil
2823
- types-requests
2924
- repo: https://github.com/igorshubovych/markdownlint-cli
30-
rev: v0.37.0
25+
rev: v0.41.0
3126
hooks:
3227
- id: markdownlint

.readthedocs.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version: 2
99
build:
1010
os: ubuntu-20.04
1111
tools:
12-
python: "3.9"
12+
python: "3.10"
1313
jobs:
1414
post_create_environment:
1515
# Install poetry
@@ -25,4 +25,5 @@ build:
2525

2626
mkdocs:
2727
configuration: mkdocs.yml
28+
fail_on_warning: true
2829

.vscode/launch.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
"configurations": [
77
{
88
"name": "Python: Current File",
9-
"type": "python",
9+
"type": "debugpy",
1010
"request": "launch",
1111
"program": "${file}",
1212
"console": "integratedTerminal"
1313
},
1414
{
1515
"name": "Python: Current File with Args",
16-
"type": "python",
16+
"type": "debugpy",
1717
"request": "launch",
1818
"program": "${file}",
1919
"console": "integratedTerminal",
@@ -27,7 +27,7 @@
2727
},
2828
{
2929
"name": "_safedata_validate_cli debug",
30-
"type": "python",
30+
"type": "debugpy",
3131
"request": "launch",
3232
"program": "${file}",
3333
"console": "integratedTerminal",

.vscode/settings.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
2-
"python.linting.flake8Enabled": true,
3-
"python.linting.mypyEnabled": true,
4-
"python.linting.enabled": true,
5-
"python.formatting.provider": "black",
6-
"editor.formatOnSave": true,
2+
"[python]": {
3+
"editor.formatOnSave": true,
4+
"editor.defaultFormatter": "charliermarsh.ruff"
5+
},
76
"editor.rulers": [
87
88
98
],
@@ -13,9 +12,12 @@
1312
"-s",
1413
"test",
1514
// --no-cov needed so that breakpoints work: https://github.com/microsoft/vscode-python/issues/693
16-
"--no-cov"
15+
"--no-cov",
1716
],
1817
"workbench.editorAssociations": {
1918
"*.ipynb": "jupyter-notebook"
2019
},
20+
"[jsonc]": {
21+
"editor.defaultFormatter": "vscode.json-language-features"
22+
},
2123
}

docs/data_managers/command_line_tools/command_line_usage/safedata_build_local_gbif.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Build a local GBIF database.
1515
positional arguments:
1616
outfile Filename to use for database file.
1717

18-
optional arguments:
18+
options:
1919
-h, --help show this help message and exit
2020
-t TIMESTAMP, --timestamp TIMESTAMP
2121
The time stamp of a database archive version to use.

docs/data_managers/command_line_tools/command_line_usage/safedata_build_local_ncbi.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Build a local NCBI database.
1515
positional arguments:
1616
outfile Filename to use for database file.
1717

18-
optional arguments:
18+
options:
1919
-h, --help show this help message and exit
2020
-t TIMESTAMP, --timestamp TIMESTAMP
2121
The time stamp of a database archive version to use.

docs/data_managers/command_line_tools/command_line_usage/safedata_metadata_post_metadata.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ positional arguments:
1010
zenodo_json Path to a Zenodo metadata file
1111
dataset_json Path to a dataset metadata file
1212

13-
optional arguments:
13+
options:
1414
-h, --help show this help message and exit

docs/data_managers/command_line_tools/command_line_usage/safedata_metadata_show_resources.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ This subcommand simply shows the details of the resources being used and can
55
be used to simply display the Zenodo and metadata server details of the
66
default or specified resources file.
77

8-
optional arguments:
8+
options:
99
-h, --help show this help message and exit

0 commit comments

Comments
 (0)