Skip to content

Commit

Permalink
Merge pull request #549 from ImperialCollegeLondon/release/0.1.1a5
Browse files Browse the repository at this point in the history
Release/0.1.1a5
  • Loading branch information
jacobcook1995 authored Sep 6, 2024
2 parents c4a281c + a6ea336 commit 84ae814
Show file tree
Hide file tree
Showing 289 changed files with 29,705 additions and 11,055 deletions.
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ Fixes # (issue)

- [ ] Code is commented, particularly in hard-to-understand areas
- [ ] Tests added that prove fix is effective or that feature works
- [ ] Relevant documentation reviewed and updated
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Test and build

on: [push, pull_request, release]
# When does this run - new, reopened or updated PRs, pushes to main or develop and when
# the workflow is called by another workflow, such as the publishing actions.
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main, develop]
workflow_call:

jobs:
qa:
Expand All @@ -19,7 +26,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.10", "3.11" ]
python-version: [ "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -63,9 +70,6 @@ jobs:
- name: Install dependencies
run: poetry install

- name: Set ipython kernel
run: poetry run python -m ipykernel install --user --name=vr_python3

- name: Build docs using sphinx
run: |
cd docs
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Publishing

on:
release:
types: [published]

jobs:
# First, run the standard test suite - for this to work correctly, the workflow needs
# to inherit the organisation secrets used to authenticate to CodeCov.
# https://github.com/actions/runner/issues/1413
test:
uses: ./.github/workflows/ci.yml
secrets: inherit

# Next, build the package wheel and source releases and add them to the release assets
build-wheel:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# Build the package - this could use `poetry build` directly but pyproject.toml
# already has the build-system configured to use poetry so `pip` should pick that
# up automatically.
- name: Build sdist
run: |
python -m pip install --upgrade build
python -m build
# Upload the build outputs as job artifacts - these will be two files with x.y.z
# version numbers:
# - virtual_ecosystem-x.y.z-py3-none-any.whl
# - virtual_ecosystem-x.y.z.tar.gz
- uses: actions/upload-artifact@v4
with:
path: dist/virtual_ecosystem*

# Add the built files to the release assets, alongside the repo archives
# automatically added by GitHub. These files should then match exactly to the
# published files on PyPI.
- uses: softprops/action-gh-release@v1
with:
files: dist/virtual_ecosystem*

# Now attempt to publish the package to the TestPyPI site, where the virtual_ecosystem
# project has been configured to allow trusted publishing from this repo and workflow.
#
# The skip-existing option allows the publication step to pass even when the release
# files already exists on PyPI. That suggests something has gone wrong with the
# release or the build file staging and the release should not be allowed to continue
# to publish on PyPI.

publish-TestPyPI:
needs: build-wheel
name: Publish virtual_ecosystem to TestPyPI
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
# Download the built package files from the job artifacts
- name: Download sdist artifact
uses: actions/download-artifact@v4
with:
name: artifact
path: dist

# Information step to show the contents of the job artifacts
- name: Display structure of downloaded files
run: ls -R dist

# Use trusted publishing to release the files downloaded into dist to TestPyPI
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
# skip-existing: true

# The final job in the workflow is to publish to the real PyPI as long as the release
# name does not contain the tag 'test-pypi-only'
publish-PyPI:
if: ${{ ! contains(github.event.release.name, 'test-pypi-only')}}
needs: publish-TestPyPI
name: Publish virtual_ecosystem to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
# Download the built package files from the job artifacts
- name: Download sdist artifact
uses: actions/download-artifact@v4
with:
name: artifact
path: dist

# Information step to show the contents of the job artifacts
- name: Display structure of downloaded files
run: ls -R dist

# Use trusted publishing to release the files downloaded into dist to PyPI
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ venv.bak/

# mkdocs documentation
/site
docs/source/variables.rst
docs/jupyter_execute/*.png

# mypy
.mypy_cache/
Expand All @@ -134,6 +136,5 @@ dmypy.json
# Mac DS Store files
.DS_Store

# PYPI credentials
# Local PyPI authentication tokens
.pypirc

32 changes: 10 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-merge-conflict
- id: debug-statements
- repo: https://github.com/PyCQA/isort
rev: "5.13.2"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
hooks:
- id: isort
additional_dependencies: [toml]
- repo: https://github.com/psf/black
rev: "24.2.0"
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-docstrings]
- id: ruff # Run the linter.
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format # Run the formatter.
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.8.0"
rev: "v1.11.2"
hooks:
- id: mypy
additional_dependencies: [types-jsonschema, xarray]
additional_dependencies: [types-jsonschema, xarray, types-tabulate, numpy]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
rev: v0.41.0
hooks:
- id: markdownlint
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
hooks:
- id: pyupgrade
args: [--py310-plus]

1 change: 0 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ build:
# VIRTUAL_ENV needs to be set manually for now.
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry run python -m ipykernel install --user --name=vr_python3

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"recommendations": [
"Gruntfuggly.todo-tree",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter",
"ms-toolsai.jupyter-keymap",
"ms-toolsai.jupyter-renderers",
"ms-vsliveshare.vsliveshare",
"stkb.rewrap"
"stkb.rewrap",
"charliermarsh.ruff"
]
}
7 changes: 1 addition & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "none",
"editor.formatOnSave": true,
"editor.rulers": [
88
Expand All @@ -18,8 +14,7 @@
"workbench.editorAssociations": {
"*.ipynb": "jupyter-notebook"
},
"cSpell.words": [],
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
"editor.defaultFormatter": "charliermarsh.ruff"
},
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/images/abiotic_sketch.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 84ae814

Please sign in to comment.