diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml new file mode 100644 index 0000000..7aa53fb --- /dev/null +++ b/.github/workflows/test_docs.yml @@ -0,0 +1,21 @@ +name: Test documentation build + +on: + pull_request: + types: + - opened + - reopened + - synchronize + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: prefix-dev/setup-pixi@v0.8.10 + with: + pixi-version: v0.49.0 + frozen: true + - name: Test build documentation + run: | + pixi run -e dev doc_build diff --git a/CITATION.cff b/CITATION.cff index e2b6581..7a8ac1b 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,15 +1,19 @@ cff-version: 1.2.0 message: "If you use this software, please cite it as below." -title: "xarray-dataclasses" +title: "xarray-dataclass" abstract: "xarray data creation by data classes" version: 1.9.1 date-released: 2024-12-09 license: "MIT" doi: "10.5281/zenodo.4624819" -url: "https://github.com/astropenguin/xarray-dataclasses" +url: "https://github.com/xarray-contrib/xarray-dataclass" authors: - given-names: "Akio" family-names: "Taniguchi" affiliation: "Nagoya University" orcid: "https://orcid.org/0000-0002-9695-6183" + - given-names: "Wouter-Michiel Vierdag" + family-names: "Vierdag" + affiliation: "European Molecular Biology Laboratory" + orcid: "https://orcid.org/0000-0003-1666-5421" diff --git a/README.md b/README.md index 524ed56..61ff680 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ pixi add --pypi xarray-dataclasses ## Basic usage -xarray-dataclasses uses [the Python's dataclass]. +xarray-dataclass uses [the Python's dataclass]. Data (or data variables), coordinates, attributes, and a name of DataArray or Dataset objects will be defined as dataclass fields by special type hints (`Data`, `Coord`, `Attr`, `Name`), respectively. Note that the following code is supposed in the examples below. @@ -378,25 +378,24 @@ pixi run pre-commit-install ``` ### Testing, linting, and formatting -We have [a test workflow][test-workflow] for testing, static type checking, linting, and formatting the code. -It is used for status checks when a pull request is created. -If you would like to check them in local, the following commands are almost equivalent (the difference is that the workflow is run under multiple Python versions). +We have a test workflow for testing and a pre-commit workflow for static type checking, linting, and formatting the code. +It is performed when a pull request is created against main. +If you would like to check them in local, the following commands are almost equivalent (the difference is that the test workflows are run under multiple Python versions). Furthermore, these tasks are defined only in the `dev` environment. Pixi does not require you to specify the environment in that case. -```shell +``` pixi run tests -pixi run flake8 -pixi run black -pixi run pyright +pixi run -e dev pre-commit run --all-files ``` ### Creating documentation -We also have a [documentation workflow] (Add link). However, if you want to locally create the documentation +We also have a documentation workflow. However, if you want to locally create the documentation run the following: ```shell -pixi run doc_build +pixi run doc_build # this just creates the build +pixi run doc_serve # build and serve at http://localhost:8000/ ``` ### Create a release diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html new file mode 100644 index 0000000..3899cb3 --- /dev/null +++ b/docs/_templates/layout.html @@ -0,0 +1,23 @@ +{# Extend the theme's layout #} +{% extends "!layout.html" %} + +{# Add custom elements to the page #} +{% block extrahead %} + {{ super() }} + +{% endblock %} + +{# Add version information for the current page #} +{% block footer %} + {{ super() }} + +{% endblock %} diff --git a/docs/conf.py b/docs/conf.py index f90b903..bf89cc5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,12 @@ +from datetime import datetime + +# Get current year for copyright +current_year = datetime.now().year + # project information -author = "Akio Taniguchi" -copyright = "2020-2024 Akio Taniguchi" +project = "xarray-dataclass" +author = "Wouter-Michiel Vierdag" +copyright = f"{current_year} Wouter-Michiel Vierdag" # general configuration @@ -31,6 +37,17 @@ "image_light": "logo-light.svg", "image_dark": "logo-dark.svg", }, - "github_url": "https://github.com/astropenguin/xarray-dataclasses/", - "twitter_url": "https://twitter.com/astropengu_in/", + "github_url": "https://github.com/xarray-contrib/xarray-dataclass/", + "twitter_url": "https://x.com/xarray_dev/", + "show_prev_next": False, + "icon_links": [ + { + "name": "PyPI", + "url": "https://pypi.org/project/xarray-dataclass/", + "icon": "fa-solid fa-box", + }, + ], + "external_links": [ + {"name": "xarray", "url": "https://xarray.pydata.org/"}, + ], } diff --git a/pixi.lock b/pixi.lock index 357068c..6d53538 100644 --- a/pixi.lock +++ b/pixi.lock @@ -2763,11 +2763,11 @@ packages: - pypi: ./ name: xarray-dataclass version: 1.9.1 - sha256: d6ec499a7d4e75d4ec10071fcd09131a90d7ec7fe0932c20e3728835341a09e8 + sha256: 5dcef31196310ef30b006bd205732b69c31adf9366518750a677dcd5e5935de7 requires_dist: - - numpy>=2.0.0,<3 - - typing-extensions>=4.10.0,<5 - - xarray>=2022.3,<2026 + - numpy>=2.0.0 + - typing-extensions>=4.10.0 + - xarray>=2022.3 - build>=1.0.0 ; extra == 'dev' - ipython>=8.12 ; extra == 'dev' - myst-parser>=3.0 ; extra == 'dev' @@ -2776,7 +2776,7 @@ packages: - pytest>=8.2 ; extra == 'dev' - sphinx>=7.1 ; extra == 'dev' - twine>=4.0.0 ; extra == 'dev' - requires_python: '>=3.9,<3.14' + requires_python: '>=3.9' editable: true - conda: https://conda.anaconda.org/conda-forge/linux-64/xz-5.8.1-hbcc6ac9_2.conda sha256: 802725371682ea06053971db5b4fb7fbbcaee9cb1804ec688f55e51d74660617 diff --git a/pyproject.toml b/pyproject.toml index 27596a5..04e1512 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,9 @@ authors = [ {name = "Akio Taniguchi", email = "taniguchi.akio@gmail.com"}, {name = "Wouter-Michiel Vierdag", email = "michiel.vierdag@scverse.org"} ] +maintainers = [ + {name = "Wouter-Michiel Vierdag", email = "michiel.vierdag@scverse.org"} +] readme = "README.md" license.file = "LICENSE" @@ -71,6 +74,7 @@ dev = { features = ["dev"], solve-group = "default" } [tool.pixi.feature.dev.tasks] tests = "pytest" doc_build = { cmd = "sphinx-apidoc -efT -o docs/_apidoc src/xarray_dataclasses && sphinx-build -a docs docs/_build" } +doc_serve = { cmd = "sphinx-build -a docs docs/_build && python -m http.server --directory docs/_build 8000" } [tool.pyright] reportMissingImports = "none"