Skip to content
Open
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
3 changes: 3 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git_archival.txt export-subst
*.ipynb linguist-documentation
66 changes: 66 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
See the [Scikit-HEP Developer introduction][skhep-dev-intro] for a detailed
description of best practices for developing Scikit-HEP packages.

[skhep-dev-intro]: https://scikit-hep.org/developer/intro

# Contributing

## Setting up a development environment

### Nox

The fastest way to start with development is to use nox. If you don't have nox,
you can use `uvx nox` to run it without installing, or `uv tool install nox`. If
you don't have uv (or pipx, which is similar), then you can install it with
`pip install uv` (the only case where installing an application with regular pip
is reasonable). If you use macOS, then uv, prek, and nox are all in brew, use
`brew install uv prek nox`.

To use, run `nox`. This will lint and test using the Python version nox runs on.
You can also run specific jobs:

```console
$ nox -l # List all the defined sessions
$ nox -s lint # Lint only
$ nox -s tests # Python tests
$ nox -s tests -P 3.12 # Python tests on a specific Python version
$ nox -s minimums # Python tests with the lowest supported dependency versions
$ nox -s cov # Python tests with an HTML coverage report
$ nox -s bench # Benchmarks
$ nox -s docs # Build and serve the docs
$ nox -s plots # Regenerate the figures used in the docs
$ nox -s build # Make an SDist and wheel
```

Nox handles everything for you, including setting up a temporary virtual
environment for each run.

### uv

For extended development, you can set up a development environment with uv:

```bash
uv sync --group test --group docs
uv run pytest
```

## Post setup

You should prepare prek, which will help you by checking that commits pass
required checks:

```bash
uv tool install prek # or brew install prek on macOS
prek install # Will install a pre-commit hook into the git repo
```

You can also/alternatively run `prek` (changes only) or `prek -a` to check even
without installing the hook.

## Testing

Use pytest to run the unit checks:

```bash
uv run pytest
```
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
cooldown:
default-days: 7
groups:
actions:
patterns:
- "*"
5 changes: 5 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
changelog:
exclude:
authors:
- dependabot[bot]
- pre-commit-ci[bot]
63 changes: 63 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CD

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
release:
types:
- published

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
# Many color libraries just need this to be set to any value, but at least
# one distinguishes color depth, where "3" -> "256-bit color".
FORCE_COLOR: 3

jobs:
dist:
name: Distribution build
runs-on: ubuntu-latest
permissions:
contents: read # to check out the repository

steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0

- uses: hynek/build-and-inspect-python-package@v3.0.1

publish:
needs: [dist]
name: Publish to PyPI
environment:
name: pypi
url: https://pypi.org/p/jacobi
permissions:
id-token: write # for trusted publishing to PyPI
attestations: write # to generate artifact attestations
contents: read # to check out the repository
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/download-artifact@v8
with:
name: Packages
path: dist

- name: Generate artifact attestation for sdist and wheel
uses: actions/attest@v4
with:
subject-path: "dist/jacobi-*"

- uses: pypa/gh-action-pypi-publish@release/v1
117 changes: 117 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: CI

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

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
# Many color libraries just need this variable to be set to any value.
# Set it to 3 to support 8-bit color graphics (256 colors per channel)
# for libraries that care about the value set.
FORCE_COLOR: 3

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read # to check out the repository
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0

- uses: actions/setup-python@v7
with:
python-version: "3.x"

- uses: astral-sh/setup-uv@v10.1.0

- uses: j178/prek-action@v3.0.0

- name: Run Pylint
run: uvx nox -s pylint -- --output-format=github

checks:
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
permissions:
contents: read # to check out the repository
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
runs-on: [ubuntu-latest]

include:
- python-version: "3.10"
runs-on: windows-latest
- python-version: "3.14"
runs-on: windows-latest
- python-version: "3.10"
runs-on: macos-latest
- python-version: "3.14"
runs-on: macos-latest
- python-version: "3.14t"
runs-on: ubuntu-latest
- python-version: "pypy-3.11"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0

- uses: actions/setup-python@v7
id: setup-python
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- uses: astral-sh/setup-uv@v10.1.0

- name: Install package
run: uv sync --group test
env:
UV_PYTHON: ${{ steps.setup-python.outputs.python-path }}

- name: Test package
run: uv run pytest -ra --cov --cov-report=term --durations=20

minimums:
name: Check minimums
runs-on: ubuntu-latest
permissions:
contents: read # to check out the repository
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0

- uses: astral-sh/setup-uv@v10.1.0

- name: Test with the lowest supported dependency versions
run: uvx nox -s minimums

pass:
if: always()
needs: [lint, checks, minimums]
runs-on: ubuntu-slim
timeout-minutes: 2
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
50 changes: 0 additions & 50 deletions .github/workflows/doc.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Docs

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
release:
types:
- published

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
# Many color libraries just need this to be set to any value, but at least
# one distinguishes color depth, where "3" -> "256-bit color".
FORCE_COLOR: 3

jobs:
build:
name: Build docs
runs-on: ubuntu-latest
permissions:
contents: read # to check out the repository
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0

- uses: astral-sh/setup-uv@v10.1.0

- name: Build the documentation
run: uvx nox -s docs

- uses: actions/upload-pages-artifact@v5
with:
path: docs/_build/html

deploy:
name: Deploy docs to GitHub Pages
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'release' && github.event.action == 'published')
needs: [build]
permissions:
contents: read # to read the repository settings
pages: write # to deploy to GitHub Pages
id-token: write # to verify the deployment originates from this workflow
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/configure-pages@v6

- id: deployment
uses: actions/deploy-pages@v5
Loading
Loading