Skip to content
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
81 changes: 81 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI

on:
push:
branches: [main]
tags: ["[0-9]*"]
pull_request:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
include:
# Extends the existing ubuntu/3.14 cell: coverage runs there only.
- os: ubuntu-latest
python-version: "3.14"
coverage: true
- os: windows-latest
python-version: "3.14"
- os: macos-latest
python-version: "3.14"

steps:
- uses: actions/checkout@v7
- name: Set up uv
uses: astral-sh/setup-uv@v10.3.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-groups
- name: Test with pytest
if: ${{ !matrix.coverage }}
run: uv run pytest
- name: Test with pytest and coverage
if: ${{ matrix.coverage }}
run: uv run pytest --cov --cov-report=xml
- name: Upload coverage reports to Codecov
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}

build:
if: startsWith(github.ref, 'refs/tags/')
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up uv
uses: astral-sh/setup-uv@v10.3.0
with:
python-version: "3.14"
- name: Check that the tag matches the package version
run: |
version=$(sed -nE 's/^__version__ = "(.*)"$/\1/p' xdas/__init__.py)
test "$version" = "$GITHUB_REF_NAME" || { echo "tag $GITHUB_REF_NAME != __version__ $version"; exit 1; }
- name: Build sdist and wheel
run: uv build
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/

publish:
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/xdas/
permissions:
id-token: write # PyPI trusted publishing, no stored token
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
30 changes: 0 additions & 30 deletions .github/workflows/code-coverage.yaml

This file was deleted.

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

This file was deleted.

264 changes: 264 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
-----------------

[![Documentation Status](https://readthedocs.org/projects/xdas/badge/?version=latest)](https://xdas.readthedocs.io/en/latest/?badge=latest)
[![Tests Status](https://github.com/xdas-dev/xdas/actions/workflows/tests.yaml/badge.svg)](https://github.com/xdas-dev/xdas/actions/workflows/tests.yaml)
[![CI Status](https://github.com/xdas-dev/xdas/actions/workflows/ci.yaml/badge.svg)](https://github.com/xdas-dev/xdas/actions/workflows/ci.yaml)
[![codecov](https://codecov.io/gh/xdas-dev/xdas/graph/badge.svg?token=00MD52JRA3)](https://codecov.io/gh/xdas-dev/xdas)
[![PyPI](https://img.shields.io/pypi/v/xdas)](https://pypi.org/project/xdas/)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
Expand Down
34 changes: 23 additions & 11 deletions docs/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,17 @@ git clone git@github.com:xdas-dev/xdas.git
cd xdas
```

3. Checkout to the `dev` branch:
```
git checkout dev
```

4. Create virtual environment and install development dependencies:
3. Create virtual environment and install development dependencies:
```
uv sync --all-groups
```

5. Check that all tests are passing and that test coverage is 100\%:
4. Check that all tests are passing and that test coverage is 100\%:
```
uv run pytest --cov
```

6. Check that the documentation builds without errors:
5. Check that the documentation builds without errors:
```
cd docs
uv run make html
Expand Down Expand Up @@ -67,16 +62,21 @@ We will go through all the details

## How to edit the code

The usual workflow is:
- create a branch to have your independent version of the code
Xdas follows [GitHub Flow](https://docs.github.com/en/get-started/using-github/github-flow): `main` is the only long-lived branch and is always releasable. The usual workflow is:
- create a branch off `main` to have your independent version of the code
- make modifications by doing as many commits as you want
- format your code
- check that the tests are passing (and that the documentation builds).
- add an entry to the `[Unreleased]` section of `CHANGELOG.md` (see below)
- publish your branch online
- make a pull request to ask the permission to merge your code.
- make a pull request against `main` to ask the permission to merge your code.

To do this you can either use git in the [terminal](https://git-scm.com/docs/gittutorial) or within [VS Code](https://code.visualstudio.com/docs/sourcecontrol/overview).

## How to write a changelog entry

`CHANGELOG.md` follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Add one line per user-visible change under `[Unreleased]`, in the section that fits: `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed` or `Security`. Write it for users, not reviewers: say what changed for them, start with **Breaking:** when existing code stops working, and credit yourself at the end, e.g. `(@your-github-handle)`. Purely internal changes (tests, CI, refactoring) need no entry.


## How to write a docstring with examples

Expand Down Expand Up @@ -164,3 +164,15 @@ uv run make html
You can then inspect the documentation by opening `index.html` in docs/_build/html with any browser.

Note that VS Code has an extension called Live Preview to render html. Once this extension is installed, right click on the `index.html` file and click on Show preview.

## Releasing

Releases are cut from `main` by a maintainer:
1. On a branch, rename `[Unreleased]` in `CHANGELOG.md` to `[X.Y.Z] - YYYY-MM-DD`, open a fresh empty `[Unreleased]` above it, update the compare links at the bottom, and set `__version__ = "X.Y.Z"` in `xdas/__init__.py`.
2. Merge that pull request into `main` once CI is green.
3. Tag the merge commit and push the tag (no `v` prefix):
```
git tag X.Y.Z
git push origin X.Y.Z
```
The CI then runs the tests again, checks that the tag matches `__version__`, builds the package and publishes it to PyPI.
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pip install xdas
````
````{tab-item} Latest
```bash
pip install "git+https://github.com/xdas-dev/xdas.git@dev" --force-reinstall
pip install "git+https://github.com/xdas-dev/xdas.git@main" --force-reinstall
```

````
Expand Down
Loading
Loading