Skip to content

Commit

Permalink
Merge pull request #288 from bessagroup/pr/2.0.0
Browse files Browse the repository at this point in the history
Pull request from pr/2.0.0 to main
  • Loading branch information
mpvanderschelling authored Jan 24, 2025
2 parents 8b8b744 + 2bbb042 commit b6f7d3a
Show file tree
Hide file tree
Showing 155 changed files with 14,980 additions and 9,945 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source = src
omit =
tests/*
**/__init__.py
src/f3dasm/_src/experimentdata/_newdata.py

[report]
# Regexes for lines to exclude from consideration
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/pr_to_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Build documentation
run: |
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: '3.1.2' # The pandoc version to download (if necessary) and use.
- run: |
sphinx-build -b html ./docs/source ./docs/build/html
build-package:
strategy:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/pr_to_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ jobs:
run: |
pip install -r requirements_dev.txt
- name: Build documentation
run: |
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: '3.1.2' # The pandoc version to download (if necessary) and use.
- run: |
sphinx-build -b html ./docs/source ./docs/build/html
build-package:
strategy:
Expand Down
134 changes: 134 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: release

on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+a[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+b[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"

env:
PACKAGE_NAME: "f3dasm"
OWNER: "bessagroup"

jobs:
details:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.release.outputs.new_version }}
suffix: ${{ steps.release.outputs.suffix }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: actions/checkout@v2

- name: Extract tag and Details
id: release
run: |
if [ "${{ github.ref_type }}" = "tag" ]; then
TAG_NAME=${GITHUB_REF#refs/tags/}
NEW_VERSION=$(echo $TAG_NAME | awk -F'-' '{print $1}')
SUFFIX=$(echo $TAG_NAME | grep -oP '[a-z]+[0-9]+' || echo "")
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
echo "Version is $NEW_VERSION"
echo "Suffix is $SUFFIX"
echo "Tag name is $TAG_NAME"
else
echo "No tag found"
exit 1
fi
check_pypi:
needs: details
runs-on: ubuntu-latest
steps:
- name: Fetch information from PyPI
run: |
response=$(curl -s https://pypi.org/pypi/${{ env.PACKAGE_NAME }}/json || echo "{}")
latest_previous_version=$(echo $response | awk '/"releases":/ {flag=1} flag' | grep -oP '"\d+\.\d+(\.\d+)*"' | tr -d '"' | sort -rV | head -n 1)
if [ -z "$latest_previous_version" ]; then
echo "Package not found on PyPI."
latest_previous_version="0.0.0"
fi
echo "Latest version on PyPI: $latest_previous_version"
echo "latest_previous_version=$latest_previous_version" >> $GITHUB_ENV
- name: Compare versions and exit if not newer
run: |
NEW_VERSION=${{ needs.details.outputs.new_version }}
LATEST_VERSION=$latest_previous_version
if [ "$(printf '%s\n' "$LATEST_VERSION" "$NEW_VERSION" | sort -rV | head -n 1)" != "$NEW_VERSION" ] || [ "$NEW_VERSION" == "$LATEST_VERSION" ]; then
echo "The new version $NEW_VERSION is not greater than the latest version $LATEST_VERSION on PyPI."
exit 1
else
echo "The new version $NEW_VERSION is greater than the latest version $LATEST_VERSION on PyPI."
fi
setup_and_build:
needs: [details, check_pypi]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install build dependencies
run: python -m pip install -U setuptools wheel build

- name: Build the package
run: python -m build .

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/

pypi_publish:
name: Upload release to PyPI
needs: [setup_and_build, details]
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist/

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github_release:
name: Create GitHub Release
needs: [setup_and_build, details]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist/

- name: Create GitHub Release
id: create_release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create ${{ needs.details.outputs.tag_name }} dist/* --title ${{ needs.details.outputs.tag_name }} --generate-notes
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ or

```bash
# PyPI
$ conda install f3dasm
$ conda install conda-forge::f3dasm
```

* Follow the complete [installation instructions](https://f3dasm.readthedocs.io/en/latest/rst_doc_files/general/installation.html) to get going!
Expand Down Expand Up @@ -100,7 +100,7 @@ If you find any **issues, bugs or problems** with this template, please use the

## License

Copyright 2024, Martin van der Schelling
Copyright 2025, Martin van der Schelling

All rights reserved.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.4
2.0.0
5 changes: 3 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
sphinx
sphinx_rtd_theme
sphinx-book-theme
sphinxcontrib-bibtex
sphinx_autodoc_typehints
sphinx-tabs==3.4.4
sphinx-gallery
nbsphinx
ipykernel
47 changes: 23 additions & 24 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import os
import sys

from sphinx_gallery.sorting import FileNameSortKey

# -- Search path for extensions and modules -----------------------------------
# If extensions or Python modules are in a different directory than this file,
# then add these directories to sys.path so that Sphinx can search for them
Expand All @@ -26,9 +24,9 @@

project = 'f3dasm'
author = 'Martin van der Schelling'
copyright = '2024, Martin van der Schelling'
version = '1.5.4'
release = '1.5.4'
copyright = '2025, Martin van der Schelling'
version = '2.0.0'
release = '2.0.0'


# -- General configuration ----------------------------------------------------
Expand All @@ -38,26 +36,25 @@
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.

extensions = ['sphinx.ext.duration',
'sphinx_rtd_theme',
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx_autodoc_typehints',
'sphinx_tabs.tabs',
'sphinx_gallery.gen_gallery',]

sphinx_gallery_conf = {
'examples_dirs': ['../../examples'], # path to your example scripts
'gallery_dirs': ['auto_examples'],
'reference_url': {'sphinx_gallery': None, },
'backreferences_dir': 'gen_modules/backreferences',
'doc_module': ('f3dasm',),
"filename_pattern": r"/*\.py",
"within_subsection_order": FileNameSortKey,
"nested_sections": False,
}
'nbsphinx',]

# sphinx_gallery_conf = {
# 'examples_dirs': ['../../examples'], # path to your example scripts
# 'gallery_dirs': ['auto_examples'],
# 'reference_url': {'sphinx_gallery': None, },
# 'backreferences_dir': 'gen_modules/backreferences',
# 'doc_module': ('f3dasm',),
# "filename_pattern": r"/*\.py",
# "within_subsection_order": FileNameSortKey,
# "nested_sections": False,
# }

# Source: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-source_suffix
source_suffix = {'.rst': 'restructuredtext', }
Expand Down Expand Up @@ -122,15 +119,17 @@
# Source: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_theme_path
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# import sphinx_rtd_theme
# html_theme = 'sphinx_rtd_theme'
# html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_theme = 'sphinx_book_theme'
else:
# Source: https://sphinx-rtd-theme.readthedocs.io/en/stable/index.html
# Requires installation of Python package 'sphinx_rtd_theme'
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# import sphinx_rtd_theme
# html_theme = 'sphinx_rtd_theme'
# html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_theme = 'sphinx_book_theme'

# Source: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_static_path
html_static_path = ['_static', ]
Expand Down
10 changes: 5 additions & 5 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ f3dasm

.. toctree::
:name: gettingstartedtoc
:caption: Getting started
:caption: 🚶 Getting started
:maxdepth: 3
:hidden:
:includehidden:
Expand All @@ -20,21 +20,21 @@ f3dasm

.. toctree::
:name: functionalitiestoc
:caption: Functionalities
:caption: 🌊 Functionalities
:maxdepth: 3
:hidden:
:includehidden:

auto_examples/index
rst_doc_files/gallery
rst_doc_files/defaults

.. toctree::
:name: apitoc
:caption: API
:caption: 📖 Reference
:hidden:

rst_doc_files/reference/index.rst
API reference <_autosummary/f3dasm>
API documentation <_autosummary/f3dasm>

.. toctree::
:name: licensetoc
Expand Down
2 changes: 1 addition & 1 deletion docs/source/license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BSD 3-Clause License
====================

Copyright (c) 2022, Martin van der Schelling
Copyright (c) 2025, Martin van der Schelling

All rights reserved.

Expand Down
Loading

0 comments on commit b6f7d3a

Please sign in to comment.