Skip to content

Update xarray dependency, switch to pixi #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"name": "xarray-dataclasses",
"image": "ghcr.io/astral-sh/uv:python3.12-bookworm",
"runArgs": [
"--name=xarray-dataclasses"
],
"containerEnv": {
"UV_PROJECT_ENVIRONMENT": "/usr/local"
},
"postCreateCommand": "uv sync --frozen",
"image":"python:3.13",
"postCreateCommand": "pip install -e \".[dev]\" && npm install",
"customizations": {
"vscode": {
"extensions": [
"ms-python.black-formatter",
"github.vscode-pull-request-github",
"mhutchie.git-graph",
"ms-python.python",
"streetsidesoftware.code-spell-checker",
"tamasfe.even-better-toml"
],
"settings": {
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"python.formatting.provider": "black",
"python.languageServer": "Pylance",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.tabSize": 4
}
}
}
Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/docs.yaml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: GitHub Pages

on:
release:
types:
- created

jobs:
job:
name: GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install project dependencies
run: pip install -e ".[dev]"
- name: Build docs
run: python -m sphinx -b html docs docs/_build
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
force_orphan: true
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build
18 changes: 0 additions & 18 deletions .github/workflows/pypi.yaml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/tests.yaml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
job:
name: Test (Python ${{ matrix.python }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install project dependencies
run: pip install -e ".[dev]"
- name: Test code's formatting (Black)
run: black --check docs tests src/xarray_dataclasses
- name: Test code's typing (Pyright)
run: pyright docs tests src/xarray_dataclasses
- name: Test code's execution (pytest)
run: pytest -v tests
- name: Test docs' building (Sphinx)
run: python -m sphinx -b html docs docs/_build
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -86,7 +90,7 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down Expand Up @@ -158,4 +162,6 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/

# End of https://www.toptal.com/developers/gitignore/api/python
41 changes: 13 additions & 28 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: xarray-dataclasses
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
message: "If you use this software, please cite it as below."

title: "xarray-dataclasses"
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"
authors:
- given-names: Akio
family-names: Taniguchi
email: taniguchi.akio@gmail.com
affiliation: Kitami Institute of Technology
orcid: 'https://orcid.org/0000-0002-9695-6183'
identifiers:
- type: doi
value: 10.5281/zenodo.10652375
repository-code: 'https://github.com/astropenguin/xarray-dataclasses'
url: 'https://astropenguin.github.io/xarray-dataclasses/v2.0.0'
abstract: xarray data creation by data classes
keywords:
- python
- dataclasses
- specifications
- typing
- xarray
license: MIT
version: 2.0.0
date-released: '2025-01-01'
- given-names: "Akio"
family-names: "Taniguchi"
affiliation: "Nagoya University"
orcid: "https://orcid.org/0000-0002-9695-6183"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2025 Akio Taniguchi
Copyright (c) 2020-2024 Akio Taniguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
71 changes: 70 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
[![Python](https://img.shields.io/pypi/pyversions/xarray-dataclasses?label=Python&color=cornflowerblue&style=flat-square)](https://pypi.org/project/xarray-dataclasses/)
[![Downloads](https://img.shields.io/pypi/dm/xarray-dataclasses?label=Downloads&color=cornflowerblue&style=flat-square)](https://pepy.tech/project/xarray-dataclasses)
[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.4624819-cornflowerblue?style=flat-square)](https://doi.org/10.5281/zenodo.4624819)
[![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)
[![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)
[![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)

xarray data creation by data classes

Expand Down Expand Up @@ -46,8 +47,13 @@ class Image(AsDataArray):

### Installation

There are multiple ways you can install xarray-dataclasses, dependent on what kind of dependency manager you use.

```shell
pip install xarray-dataclasses
conda install -c conda-forge xarray-dataclasses
pixi add xarray-dataclasses
pixi add --pypi xarray-dataclasses
```

## Basic usage
Expand Down Expand Up @@ -338,6 +344,69 @@ class Image:
image = asdataarray(Image([[0, 1], [2, 3]], [0, 1], [0, 1]))
```

## How to contribute

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).
We use [GitHub flow](https://docs.github.com/en/get-started/using-github/github-flow) for developing and managing the project.
The first section describes how to contribute with it.
The second and third sections explain how to prepare a local development environment and our automated workflows in GitHub Actions, respectively.


### Get the source code

```shell
git clone https://github.com/xarray-contrib/xarray-dataclasses
cd xarray-dataclasses
```

### Install dependencies

First install [pixi](https://pixi.sh/latest/installation/). Then, install project dependencies:

```shell
pixi install -a
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).
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
```

### Creating documentation
We also have a [documentation workflow] (Add link). However, if you want to locally create the documentation
run the following:

```shell
pixi run doc_build
```

### Create a release

This section is relevant only for maintainers.

1. Pull `git`'s `main` branch.
2. `pixi install -a`
3. `pixi run pre-commit-install`
4. `pixi run -e test test`
5. `pixi shell`
6. `hatch version <new-version>`
7. `git add .`
8. `git commit -m "ENH: Bump version to <version>"`
9. `hatch build`
10. `hatch publish`
11. `git push upstream main`
12. Create a new tag and Release via the GitHub UI. Auto-generate release notes
and add additional notes as needed.

<!-- References -->
[Pyright]: https://github.com/microsoft/pyright
Expand Down
11 changes: 11 additions & 0 deletions docs/_static/logo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions docs/_static/logo-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions docs/build

This file was deleted.

12 changes: 8 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# project information
author = "Akio Taniguchi"
copyright = "2020-2025 Akio Taniguchi"
copyright = "2020-2024 Akio Taniguchi"


# general configuration
add_module_names = False
autodoc_member_order = "bysource"
autodoc_typehints = "both"
autodoc_typehints_format = "short"
exclude_patterns = [
Expand All @@ -25,8 +24,13 @@


# options for HTML output
html_static_path = ["_static"]
html_theme = "pydata_sphinx_theme"
html_theme_options = {
"github_url": "https://github.com/astropenguin/xarray-dataclasses",
"logo": {"text": "xarray-dataclasses"},
"logo": {
"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/",
}
Loading