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
12 changes: 12 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 22c0aa6abc4acb083663b817bb58202193e9c3ef
_src_path: gh:ONEcampaign/bblocks-projects
project_name: oda_reader
project_slug: oda_reader
project_description: A simple package to import ODA data from the OECD's API and AidData's database
project_type: package
author_name: Jorge Rivera
author_email: jorge.rivera@one.org
python_version: "3.11"
license: mit
github_username: ONEcampaign
87 changes: 87 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI

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

jobs:
lint:
name: Lint & type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v8.1.0

- name: Cache uv
uses: actions/cache@v5
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
restore-keys: |
${{ runner.os }}-uv-

- name: Set up Python 3.11
run: uv python install '3.11'

- name: Install dependencies
run: uv sync --frozen --all-groups

- name: Run ruff check
run: uv run ruff check .

- name: Run ruff format check
run: uv run ruff format --check .

- name: Run ty
run: uv run ty check src/oda_reader

test:
name: Run tests
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13"]

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
with:
python-version: ${{ matrix.python-version }}

- name: Cache uv
uses: actions/cache@v5
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
restore-keys: |
${{ runner.os }}-uv-

- name: Install dependencies
run: uv sync --all-groups

- name: Run unit tests
run: uv run pytest tests/ -n auto -m "not integration" --cov=src/oda_reader --cov-report=xml --cov-report=term
env:
ODA_READER_CACHE_DIR: ${{ runner.temp }}/oda_cache

- name: Integration tests
if: github.event_name == 'pull_request' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
run: uv run pytest tests/ -v
env:
ODA_READER_CACHE_DIR: ${{ runner.temp }}/oda_cache

- name: Upload coverage
uses: codecov/codecov-action@v6
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
with:
files: ./coverage.xml
66 changes: 40 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,58 @@
name: release
name: Release

on:
push:
tags:
- 'v*'
workflow_dispatch:

permissions:
contents: read
id-token: write # Required for PyPI trusted publishing

jobs:
release:
name: Create Release
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

strategy:
matrix:
python-versions: ["3.13"]
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0

permissions:
contents: write # needed by action-gh-release
- name: Cache uv
uses: actions/cache@v5
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
restore-keys: |
${{ runner.os }}-uv-

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.11
run: uv python install '3.11'

- name: Extract version from tag
id: tag_name
run: echo "current_version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
shell: bash
- name: Build package
run: uv build --no-sources

- name: Set up uv (and Python)
uses: astral-sh/setup-uv@v6
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
python-version: ${{ matrix.python-versions }}
name: dist
path: dist/

- name: Build sdist and wheel (uv)
run: uv build --no-sources
publish:
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/oda_reader
steps:
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0

- name: Show dist/
run: ls -l dist
- name: Download build artifacts
uses: actions/download-artifact@v8
with:
name: dist
path: dist/

- name: Publish to PyPI (uv)
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish to PyPI
run: uv publish
39 changes: 0 additions & 39 deletions .github/workflows/tests.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,11 @@ cython_debug/
/src/oda_reader/dev_tests.py
/docs/site
/docs/plans

# Ruff
.ruff_cache/

# AI assistants
.claude/
CLAUDE.md
AGENTS.md
Loading