Skip to content

Commit 36817ea

Browse files
authored
Merge pull request #1 from melonora/update
Update xarray dependency, switch to pixi, remove support python 3.8
2 parents 75fbff4 + 63bc19a commit 36817ea

32 files changed

+5100
-1456
lines changed

.devcontainer/devcontainer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
{
22
"name": "xarray-dataclasses",
3-
"image": "ghcr.io/astral-sh/uv:python3.12-bookworm",
4-
"runArgs": [
5-
"--name=xarray-dataclasses"
6-
],
7-
"containerEnv": {
8-
"UV_PROJECT_ENVIRONMENT": "/usr/local"
9-
},
10-
"postCreateCommand": "uv sync --frozen",
3+
"image":"python:3.13",
4+
"postCreateCommand": "pip install -e \".[dev]\" && npm install",
115
"customizations": {
126
"vscode": {
137
"extensions": [
14-
"ms-python.black-formatter",
8+
"github.vscode-pull-request-github",
9+
"mhutchie.git-graph",
10+
"ms-python.python",
1511
"streetsidesoftware.code-spell-checker",
1612
"tamasfe.even-better-toml"
1713
],
1814
"settings": {
15+
"files.insertFinalNewline": true,
16+
"files.trimTrailingWhitespace": true,
17+
"python.formatting.provider": "black",
1918
"python.languageServer": "Pylance",
2019
"[python]": {
21-
"editor.defaultFormatter": "ms-python.black-formatter",
22-
"editor.formatOnSave": true
20+
"editor.formatOnSave": true,
21+
"editor.insertSpaces": true,
22+
"editor.tabSize": 4
2323
}
2424
}
2525
}

.github/workflows/docs.yaml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/gh-pages.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: GitHub Pages
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
jobs:
9+
job:
10+
name: GitHub Pages
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.13"
17+
- name: Install project dependencies
18+
run: pip install -e ".[dev]"
19+
- name: Build docs
20+
run: python -m sphinx -b html docs docs/_build
21+
- name: Deploy docs
22+
uses: peaceiris/actions-gh-pages@v3
23+
with:
24+
force_orphan: true
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
publish_dir: ./docs/_build

.github/workflows/pypi.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/tests.yaml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
job:
13+
name: Test (Python ${{ matrix.python }})
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python }}
24+
- name: Install project dependencies
25+
run: pip install -e ".[dev]"
26+
- name: Test code's formatting (Black)
27+
run: black --check docs tests src/xarray_dataclasses
28+
- name: Test code's typing (Pyright)
29+
run: pyright docs tests src/xarray_dataclasses
30+
- name: Test code's execution (pytest)
31+
run: pytest -v tests
32+
- name: Test docs' building (Sphinx)
33+
run: python -m sphinx -b html docs docs/_build

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/python
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=python
3+
4+
### Python ###
15
# Byte-compiled / optimized / DLL files
26
__pycache__/
37
*.py[cod]
@@ -86,7 +90,7 @@ ipython_config.py
8690
# pyenv
8791
# For a library or package, you might want to ignore these files since the code is
8892
# intended to run in multiple environments; otherwise, check them in:
89-
.python-version
93+
# .python-version
9094

9195
# pipenv
9296
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
@@ -158,4 +162,6 @@ cython_debug/
158162
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
159163
# and can be added to the global gitignore or merged into this file. For a more nuclear
160164
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
161-
#.idea/
165+
.idea/
166+
167+
# End of https://www.toptal.com/developers/gitignore/api/python

CITATION.cff

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,15 @@
1-
# This CITATION.cff file was generated with cffinit.
2-
# Visit https://bit.ly/cffinit to generate yours today!
3-
41
cff-version: 1.2.0
5-
title: xarray-dataclasses
6-
message: >-
7-
If you use this software, please cite it using the
8-
metadata from this file.
9-
type: software
2+
message: "If you use this software, please cite it as below."
3+
4+
title: "xarray-dataclasses"
5+
abstract: "xarray data creation by data classes"
6+
version: 1.9.1
7+
date-released: 2024-12-09
8+
license: "MIT"
9+
doi: "10.5281/zenodo.4624819"
10+
url: "https://github.com/astropenguin/xarray-dataclasses"
1011
authors:
11-
- given-names: Akio
12-
family-names: Taniguchi
13-
14-
affiliation: Kitami Institute of Technology
15-
orcid: 'https://orcid.org/0000-0002-9695-6183'
16-
identifiers:
17-
- type: doi
18-
value: 10.5281/zenodo.10652375
19-
repository-code: 'https://github.com/astropenguin/xarray-dataclasses'
20-
url: 'https://astropenguin.github.io/xarray-dataclasses/v2.0.0'
21-
abstract: xarray data creation by data classes
22-
keywords:
23-
- python
24-
- dataclasses
25-
- specifications
26-
- typing
27-
- xarray
28-
license: MIT
29-
version: 2.0.0
30-
date-released: '2025-01-01'
12+
- given-names: "Akio"
13+
family-names: "Taniguchi"
14+
affiliation: "Nagoya University"
15+
orcid: "https://orcid.org/0000-0002-9695-6183"

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020-2025 Akio Taniguchi
3+
Copyright (c) 2020-2024 Akio Taniguchi
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
[![Python](https://img.shields.io/pypi/pyversions/xarray-dataclasses?label=Python&color=cornflowerblue&style=flat-square)](https://pypi.org/project/xarray-dataclasses/)
55
[![Downloads](https://img.shields.io/pypi/dm/xarray-dataclasses?label=Downloads&color=cornflowerblue&style=flat-square)](https://pepy.tech/project/xarray-dataclasses)
66
[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.4624819-cornflowerblue?style=flat-square)](https://doi.org/10.5281/zenodo.4624819)
7-
[![Tests](https://img.shields.io/github/actions/workflow/status/astropenguin/xarray-dataclasses/tests.yml?label=Tests&style=flat-square)](https://github.com/astropenguin/xarray-dataclasses/actions)
7+
[![Tests](https://img.shields.io/github/actions/workflow/status/astropenguin/xarray-dataclasses/tests.yml?label=Tests&style=flat-square)](https://github.com/astropenguin/xarray-dataclasses/actions/workflows/tests.yaml)
8+
[![Release](https://github.com/melonora/xarray-dataclasses/actions/workflows/pypi.yaml/badge.svg?event=release)](https://github.com/melonora/xarray-dataclasses/actions/workflows/pypi.yaml)
89

910
xarray data creation by data classes
1011

@@ -46,8 +47,13 @@ class Image(AsDataArray):
4647

4748
### Installation
4849

50+
There are multiple ways you can install xarray-dataclasses, dependent on what kind of dependency manager you use.
51+
4952
```shell
5053
pip install xarray-dataclasses
54+
conda install -c conda-forge xarray-dataclasses
55+
pixi add xarray-dataclasses
56+
pixi add --pypi xarray-dataclasses
5157
```
5258

5359
## Basic usage
@@ -338,6 +344,69 @@ class Image:
338344
image = asdataarray(Image([[0, 1], [2, 3]], [0, 1], [0, 1]))
339345
```
340346

347+
## How to contribute
348+
349+
Thank you for being willing to contribute! If you have some ideas to propose, please open an [issue](https://github.com/xarray-contrib/xarray-dataclasses/issues).
350+
We use [GitHub flow](https://docs.github.com/en/get-started/using-github/github-flow) for developing and managing the project.
351+
The first section describes how to contribute with it.
352+
The second and third sections explain how to prepare a local development environment and our automated workflows in GitHub Actions, respectively.
353+
354+
355+
### Get the source code
356+
357+
```shell
358+
git clone https://github.com/xarray-contrib/xarray-dataclasses
359+
cd xarray-dataclasses
360+
```
361+
362+
### Install dependencies
363+
364+
First install [pixi](https://pixi.sh/latest/installation/). Then, install project dependencies:
365+
366+
```shell
367+
pixi install -a
368+
pixi run pre-commit-install
369+
```
370+
371+
### Testing, linting, and formatting
372+
We have [a test workflow][test-workflow] for testing, static type checking, linting, and formatting the code.
373+
It is used for status checks when a pull request is created.
374+
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).
375+
Furthermore, these tasks are defined only in the `dev` environment. Pixi does not require you to specify the environment
376+
in that case.
377+
378+
```shell
379+
pixi run tests
380+
pixi run flake8
381+
pixi run black
382+
pixi run pyright
383+
```
384+
385+
### Creating documentation
386+
We also have a [documentation workflow] (Add link). However, if you want to locally create the documentation
387+
run the following:
388+
389+
```shell
390+
pixi run doc_build
391+
```
392+
393+
### Create a release
394+
395+
This section is relevant only for maintainers.
396+
397+
1. Pull `git`'s `main` branch.
398+
2. `pixi install -a`
399+
3. `pixi run pre-commit-install`
400+
4. `pixi run -e test test`
401+
5. `pixi shell`
402+
6. `hatch version <new-version>`
403+
7. `git add .`
404+
8. `git commit -m "ENH: Bump version to <version>"`
405+
9. `hatch build`
406+
10. `hatch publish`
407+
11. `git push upstream main`
408+
12. Create a new tag and Release via the GitHub UI. Auto-generate release notes
409+
and add additional notes as needed.
341410

342411
<!-- References -->
343412
[Pyright]: https://github.com/microsoft/pyright

0 commit comments

Comments
 (0)