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
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

97 changes: 97 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Publish to PyPI

# Triggered by pushing a v* tag, or manually via the "Run workflow" button.
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
confirm:
description: "Type 'publish' to confirm release"
required: true

jobs:
# -----------------------------------------------------------------------
# Guard: manual runs require the confirmation input.
# -----------------------------------------------------------------------
check:
name: Check confirmation
runs-on: ubuntu-latest
if: >
github.event_name == 'push' ||
github.event.inputs.confirm == 'publish'
steps:
- run: echo "Confirmed — proceeding with release."

# -----------------------------------------------------------------------
# Test gate: don't publish if tests fail.
# -----------------------------------------------------------------------
test:
name: Tests (Python 3.13)
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.13"
cache: pip
- run: pip install -e ".[dev]"
- run: pytest --cov=obsarray

# -----------------------------------------------------------------------
# Build source distribution and wheel.
# -----------------------------------------------------------------------
build:
name: Build distribution
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0 # full history so setuptools_scm picks up the tag

- uses: actions/setup-python@v7
with:
python-version: "3.13"

- name: Build
run: |
pip install build
python -m build

- name: Store distribution packages
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/

# -----------------------------------------------------------------------
# Publish to PyPI via trusted publisher (OIDC — no API token needed).
#
# One-time setup required in the PyPI project settings:
# Publisher: GitHub Actions
# Owner: comet-toolkit
# Repository: obsarray
# Workflow: publish.yml
# Environment: pypi
# -----------------------------------------------------------------------
publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/obsarray
permissions:
id-token: write # required for OIDC trusted publishing

steps:
- name: Download distribution packages
uses: actions/download-artifact@v8
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
82 changes: 0 additions & 82 deletions .github/workflows/pull_request.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/push_branch.yml

This file was deleted.

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

on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:

jobs:
test:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v7

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install dependencies
run: pip install -e ".[dev]"

- name: Run tests
run: |
mkdir -p test_report
pytest \
--html=test_report/report.html \
--cov-report html:test_report/cov_report \
--cov-report xml:test_report/coverage.xml \
--junitxml=test_report/junit.xml \
--cov=obsarray

- name: Upload test report
if: always()
uses: actions/upload-artifact@v7
with:
name: test-report-py${{ matrix.python-version }}
path: test_report/
retention-days: 7

- name: Upload coverage to Codecov
if: matrix.python-version == '3.13'
uses: codecov/codecov-action@v7
with:
files: test_report/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.13"
cache: pip
- run: pip install -e ".[dev]"
- name: ruff format
run: ruff format --check obsarray
- name: ruff lint
run: ruff check obsarray
- name: mypy
run: mypy obsarray
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# macOS
.DS_Store

# Mypy cache
.mypy_cache

# Ruff cache
.ruff_cache

# Compiles docs for gitlab pages
public
latex
Expand Down Expand Up @@ -59,6 +65,7 @@ coverage.xml
*.cover
.hypothesis/
.pytest_cache/
test_report/

# Translations
*.mo
Expand Down Expand Up @@ -117,4 +124,5 @@ ENV/

# IDE settings
.vscode/.git.old

CLAUDE.md
22 changes: 19 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
repos:
- repo: https://github.com/psf/black
rev: stable
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: black
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.13
hooks:
- id: ruff-check
args: [--fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v2.1.0
hooks:
- id: mypy
# Match the CI lint job: check the package only, with numpy/xarray
# type information available (CI installs the package).
files: ^obsarray/
additional_dependencies: [numpy, xarray]
16 changes: 12 additions & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@ version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.10"
python: "3.13"
jobs:
# Read the Docs clones shallowly; setuptools_scm needs the tags to
# derive the version shown in the docs.
post_checkout:
- git fetch --unshallow || true

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py

# Declare the Python requirements required to build docs
# Install the package with its docs extras from pyproject.toml
python:
install:
- requirements: requirements.txt
- method: pip
path: .
extra_requirements:
- docs
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include versioneer.py
include obsarray/_version.py
include README.md
include LICENSE
Loading
Loading