Skip to content

Commit 5ac0a69

Browse files
authored
Merge pull request #2 from carp-dk/main-refc
Refactored v0.2.0
2 parents e00b048 + e10c6d4 commit 5ac0a69

75 files changed

Lines changed: 3700 additions & 2997 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.13"
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
python -m pip install -e .
21+
python -m pip install pytest pytest-cov mypy ruff sphinx sphinx-rtd-theme pandas pyarrow folium matplotlib
22+
- name: Lint
23+
run: ruff check src examples tests docs
24+
- name: Type check
25+
run: mypy src/carp
26+
- name: Test
27+
run: pytest --cov=src/carp --cov-branch --cov-fail-under=100
28+
- name: Build docs
29+
run: sphinx-build -b html docs docs/_build/html

.github/workflows/release.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "**"
7+
8+
concurrency:
9+
group: release-${{ github.ref }}
10+
cancel-in-progress: false
11+
12+
jobs:
13+
validate_tag:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
version: ${{ steps.version.outputs.version }}
17+
tag: ${{ steps.version.outputs.tag }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.13"
23+
- id: version
24+
name: Validate tag against package version
25+
run: |
26+
version=$(python - <<'PY'
27+
import pathlib
28+
import tomllib
29+
30+
project = tomllib.loads(pathlib.Path("pyproject.toml").read_text())
31+
print(project["project"]["version"])
32+
PY
33+
)
34+
tag="${GITHUB_REF_NAME}"
35+
if [ "${tag}" != "${version}" ] && [ "${tag}" != "v${version}" ]; then
36+
echo "Tag ${tag} does not match package version ${version}." >&2
37+
exit 1
38+
fi
39+
echo "version=${version}" >> "${GITHUB_OUTPUT}"
40+
echo "tag=${tag}" >> "${GITHUB_OUTPUT}"
41+
42+
test:
43+
needs: validate_tag
44+
runs-on: ubuntu-latest
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
python-version: ["3.10", "3.11", "3.12", "3.13"]
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: actions/setup-python@v5
52+
with:
53+
python-version: ${{ matrix.python-version }}
54+
- name: Install dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
python -m pip install -e .
58+
python -m pip install pytest pytest-cov pandas pyarrow folium matplotlib
59+
- name: Run tests
60+
run: pytest --cov=src/carp --cov-branch --cov-fail-under=100
61+
62+
quality:
63+
needs: validate_tag
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v4
67+
- uses: actions/setup-python@v5
68+
with:
69+
python-version: "3.13"
70+
- name: Install dependencies
71+
run: |
72+
python -m pip install --upgrade pip
73+
python -m pip install -e .
74+
python -m pip install pytest pytest-cov mypy ruff sphinx sphinx-rtd-theme pandas pyarrow folium matplotlib
75+
- name: Lint
76+
run: ruff check src examples tests docs
77+
- name: Type check
78+
run: mypy src/carp
79+
- name: Build docs
80+
run: sphinx-build -W -b html docs docs/_build/html
81+
82+
build:
83+
needs: [test, quality]
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/checkout@v4
87+
- uses: actions/setup-python@v5
88+
with:
89+
python-version: "3.13"
90+
- name: Build distributions
91+
run: |
92+
python -m pip install --upgrade pip
93+
python -m pip install build twine
94+
python -m build
95+
python -m twine check dist/*
96+
- uses: actions/upload-artifact@v4
97+
with:
98+
name: python-package-distributions
99+
path: dist/
100+
101+
publish_pypi:
102+
needs: build
103+
runs-on: ubuntu-latest
104+
environment:
105+
name: pypi
106+
permissions:
107+
id-token: write
108+
steps:
109+
- uses: actions/download-artifact@v4
110+
with:
111+
name: python-package-distributions
112+
path: dist/
113+
- uses: pypa/gh-action-pypi-publish@release/v1
114+
115+
publish_github:
116+
needs: [validate_tag, publish_pypi]
117+
runs-on: ubuntu-latest
118+
permissions:
119+
contents: write
120+
steps:
121+
- uses: actions/download-artifact@v4
122+
with:
123+
name: python-package-distributions
124+
path: dist/
125+
- name: Generate checksums
126+
run: shasum -a 256 dist/* > dist/SHA256SUMS.txt
127+
- uses: softprops/action-gh-release@v2
128+
with:
129+
name: Release ${{ needs.validate_tag.outputs.tag }}
130+
tag_name: ${{ needs.validate_tag.outputs.tag }}
131+
generate_release_notes: true
132+
files: dist/*

CHANGELOG.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,35 @@
11
# Changelog
22

3-
All notable changes to this project will be documented in this file.
3+
## [0.2.0] - 2026-03-26
44

5-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5+
### Added
6+
7+
- New `CarpStudy` public API as the primary entrypoint for CARP study analysis
8+
- Modular service layout under `carp.core`, `participants`, `records`, `schema`, `export`, `frames`, `types`, `plotting`, and `commandline`
9+
- Self-contained pytest suite with committed multi-phase fixtures and optional `sleep-data` smoke coverage
10+
- 100% line and branch coverage enforcement for `src/carp`
11+
- Sphinx documentation site with autodoc and Napoleon support
12+
- GitHub Actions CI for linting, type-checking, tests, and docs builds
13+
- Tag-driven CD workflow that validates version tags, publishes to PyPI, and creates GitHub releases
14+
- Dedicated `test` and `docs` dependency groups
15+
16+
### Changed
17+
18+
- Replaced the legacy method-heavy design with a thin `CarpStudy` composition root and focused services
19+
- Kept the `carp` CLI command set stable while rewriting the implementation behind modular handlers
20+
- Switched plotting defaults to `dk.cachet.carp.location`
21+
- Made parquet filenames namespace-aware to avoid same-name type collisions
22+
- Added Google-style docstrings and expanded type annotations across the package
23+
- Refreshed the README, example scripts, generated type example, and notebook to use the new API
24+
- Normalized Ruff, MyPy, coverage, and documentation build configuration in `pyproject.toml`
25+
26+
### Removed
727

8-
## [Unreleased]
28+
- Legacy `carp.reader` monolith
29+
- Legacy `carp.plotting.map_viz` module
30+
- Old `CarpDataStream`-centric example usage and stale plotting/type-generation references
931

10-
## [0.1.0] - 2024-12-02
32+
## [0.1.0]
1133

1234
### Added
1335

0 commit comments

Comments
 (0)