Skip to content

Commit 4d075e1

Browse files
authored
Merge pull request #14 from xarray-contrib/docs_update
Adjust docs build
2 parents bd0970c + 08074fe commit 4d075e1

File tree

7 files changed

+89
-21
lines changed

7 files changed

+89
-21
lines changed

.github/workflows/test_docs.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test documentation build
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
10+
jobs:
11+
run:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: prefix-dev/[email protected]
16+
with:
17+
pixi-version: v0.49.0
18+
frozen: true
19+
- name: Test build documentation
20+
run: |
21+
pixi run -e dev doc_build

CITATION.cff

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
cff-version: 1.2.0
22
message: "If you use this software, please cite it as below."
33

4-
title: "xarray-dataclasses"
4+
title: "xarray-dataclass"
55
abstract: "xarray data creation by data classes"
66
version: 1.9.1
77
date-released: 2024-12-09
88
license: "MIT"
99
doi: "10.5281/zenodo.4624819"
10-
url: "https://github.com/astropenguin/xarray-dataclasses"
10+
url: "https://github.com/xarray-contrib/xarray-dataclass"
1111
authors:
1212
- given-names: "Akio"
1313
family-names: "Taniguchi"
1414
affiliation: "Nagoya University"
1515
orcid: "https://orcid.org/0000-0002-9695-6183"
16+
- given-names: "Wouter-Michiel Vierdag"
17+
family-names: "Vierdag"
18+
affiliation: "European Molecular Biology Laboratory"
19+
orcid: "https://orcid.org/0000-0003-1666-5421"

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pixi add --pypi xarray-dataclasses
6767

6868
## Basic usage
6969

70-
xarray-dataclasses uses [the Python's dataclass].
70+
xarray-dataclass uses [the Python's dataclass].
7171
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.
7272
Note that the following code is supposed in the examples below.
7373

@@ -378,25 +378,24 @@ pixi run pre-commit-install
378378
```
379379

380380
### Testing, linting, and formatting
381-
We have [a test workflow][test-workflow] for testing, static type checking, linting, and formatting the code.
382-
It is used for status checks when a pull request is created.
383-
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).
381+
We have a test workflow for testing and a pre-commit workflow for static type checking, linting, and formatting the code.
382+
It is performed when a pull request is created against main.
383+
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).
384384
Furthermore, these tasks are defined only in the `dev` environment. Pixi does not require you to specify the environment
385385
in that case.
386386

387-
```shell
387+
```
388388
pixi run tests
389-
pixi run flake8
390-
pixi run black
391-
pixi run pyright
389+
pixi run -e dev pre-commit run --all-files
392390
```
393391

394392
### Creating documentation
395-
We also have a [documentation workflow] (Add link). However, if you want to locally create the documentation
393+
We also have a documentation workflow. However, if you want to locally create the documentation
396394
run the following:
397395

398396
```shell
399-
pixi run doc_build
397+
pixi run doc_build # this just creates the build
398+
pixi run doc_serve # build and serve at http://localhost:8000/
400399
```
401400

402401
### Create a release

docs/_templates/layout.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{# Extend the theme's layout #}
2+
{% extends "!layout.html" %}
3+
4+
{# Add custom elements to the page #}
5+
{% block extrahead %}
6+
{{ super() }}
7+
<meta name="docsearch:version" content="{{ version }}">
8+
{% endblock %}
9+
10+
{# Add version information for the current page #}
11+
{% block footer %}
12+
{{ super() }}
13+
<script>
14+
// Add version information to the current page
15+
document.addEventListener('DOMContentLoaded', function() {
16+
// This helps search engines and other tools understand the version of the page
17+
var meta = document.createElement('meta');
18+
meta.name = 'version';
19+
meta.content = '{{ version }}';
20+
document.head.appendChild(meta);
21+
});
22+
</script>
23+
{% endblock %}

docs/conf.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
from datetime import datetime
2+
3+
# Get current year for copyright
4+
current_year = datetime.now().year
5+
16
# project information
2-
author = "Akio Taniguchi"
3-
copyright = "2020-2024 Akio Taniguchi"
7+
project = "xarray-dataclass"
8+
author = "Wouter-Michiel Vierdag"
9+
copyright = f"{current_year} Wouter-Michiel Vierdag"
410

511

612
# general configuration
@@ -31,6 +37,17 @@
3137
"image_light": "logo-light.svg",
3238
"image_dark": "logo-dark.svg",
3339
},
34-
"github_url": "https://github.com/astropenguin/xarray-dataclasses/",
35-
"twitter_url": "https://twitter.com/astropengu_in/",
40+
"github_url": "https://github.com/xarray-contrib/xarray-dataclass/",
41+
"twitter_url": "https://x.com/xarray_dev/",
42+
"show_prev_next": False,
43+
"icon_links": [
44+
{
45+
"name": "PyPI",
46+
"url": "https://pypi.org/project/xarray-dataclass/",
47+
"icon": "fa-solid fa-box",
48+
},
49+
],
50+
"external_links": [
51+
{"name": "xarray", "url": "https://xarray.pydata.org/"},
52+
],
3653
}

pixi.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ authors = [
1010
{name = "Akio Taniguchi", email = "[email protected]"},
1111
{name = "Wouter-Michiel Vierdag", email = "[email protected]"}
1212
]
13+
maintainers = [
14+
{name = "Wouter-Michiel Vierdag", email = "[email protected]"}
15+
]
1316
readme = "README.md"
1417
license.file = "LICENSE"
1518

@@ -71,6 +74,7 @@ dev = { features = ["dev"], solve-group = "default" }
7174
[tool.pixi.feature.dev.tasks]
7275
tests = "pytest"
7376
doc_build = { cmd = "sphinx-apidoc -efT -o docs/_apidoc src/xarray_dataclasses && sphinx-build -a docs docs/_build" }
77+
doc_serve = { cmd = "sphinx-build -a docs docs/_build && python -m http.server --directory docs/_build 8000" }
7478

7579
[tool.pyright]
7680
reportMissingImports = "none"

0 commit comments

Comments
 (0)