Skip to content
Closed
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 .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 120
extend-ignore = E501,W291,W293,W391,F401,F841,E402,E302,E305
53 changes: 6 additions & 47 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,26 @@
# .github/workflows/bump-version.yml
name: Bump Version on Merge to Main
name: Tag Version on Merge to Main

on:
push:
branches:
- main

jobs:
bump-version:
tag-version:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- run: pip install python-semantic-release

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Run Semantic Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: semantic-release version
- name: Tag repository from pyproject
run: python scripts/check_version_match.py --fix

- name: Push changes
run: |
git push --follow-tags
- name: "Install Poetry"
run: pip install poetry
- name: "Determine version bump type"
run: |
git fetch --tags
# This defaults to a patch type, unless a feature commit was pushed, then set type to minor
LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
LAST_COMMIT=$(git log -1 --format='%H')
echo "Last git tag: $LAST_TAG"
echo "Last git commit: $LAST_COMMIT"
echo "Commits:"
git log --no-merges --pretty=oneline $LAST_TAG...$LAST_COMMIT
git log --no-merges --pretty=format:"%s" $LAST_TAG...$LAST_COMMIT | grep -q ^feat: && BUMP_TYPE="minor" || BUMP_TYPE="patch"
echo "Version bump type: $BUMP_TYPE"
echo "BUMP_TYPE=$BUMP_TYPE" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Version bump"
run: |
poetry version $BUMP_TYPE
- name: "Push new version"
run: |
git add pyproject.toml
git commit -m "Update version to $(poetry version -s)"
git pull --ff-only origin main
git push origin main --follow-tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

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

jobs:
test:
name: Test with Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]

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

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

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Install dependencies
run: poetry install --with dev

- name: Run tests with coverage
run: poetry run pytest --cov=gen_surv --cov-report=xml --cov-report=term

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }} # optional if public repo

lint:
name: Code Quality
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Install dependencies
run: poetry install --with dev

- name: Run pre-commit checks
run: poetry run pre-commit run --all-files
27 changes: 27 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Documentation Build

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

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
run: pip install poetry
- name: Install dependencies
run: poetry install --with docs
- name: Build documentation
run: poetry run sphinx-build -W -b html docs/source docs/build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/build/
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- name: Checkout code
Expand All @@ -17,15 +20,15 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Install dependencies
run: poetry install
run: poetry install --with dev

- name: Run tests
run: poetry run pytest --cov=gen_surv --cov-report=xml --cov-report=term
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ dist/
# Temporary
*.log
*.tmp
.hypothesis/
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
repos:
- repo: https://github.com/psf/black
rev: 24.1.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
- id: mypy
14 changes: 13 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ build:
os: ubuntu-22.04
tools:
python: "3.11"
jobs:
post_create_environment:
- pip install poetry
post_install:
- poetry config virtualenvs.create false
- poetry install --with docs

python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .

sphinx:
configuration: docs/source/conf.py
fail_on_warning: false

formats:
- pdf
- epub
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# CHANGELOG

## v1.0.9 (2025-08-02)

### Features
- export datasets to RDS files
- test workflow runs on a Python version matrix
- scikit-learn compatible data generator
- compatibility helpers for lifelines and scikit-survival

### Documentation
- updated usage examples and tutorials
- document optional scikit-survival dependency throughout the docs

### Continuous Integration
- auto-tag releases using the version check script

### Misc
- README quick example uses `covariate_range`

## v1.0.8 (2025-07-30)

### Documentation
- ensure absolute path resolution in `conf.py`
- drop unsupported theme option
- define bibliography anchors and headings
- fix tutorial links to non-existing docs
- add additional references to the bibliography

### Testing
- add CLI integration test
- expand piecewise generator test coverage

### Misc
- remove fix_recommendations.md



## v1.0.0 (2025-06-06)

Expand Down
102 changes: 102 additions & 0 deletions CHECKLIST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# ✅ Python Package Development Checklist

A checklist to ensure quality, maintainability, and usability of your Python package.

---

## 1. Purpose & Scope

- [ ] Clear purpose and use cases defined
- [ ] Scoped to a specific problem/domain
- [ ] Project name is meaningful and not taken on PyPI

---

## 2. Project Structure

- [ ] Uses `src/` layout or appropriate flat structure
- [ ] All package folders contain `__init__.py`
- [ ] Main configuration handled via `pyproject.toml`
- [ ] Includes standard files: `README.md`, `LICENSE`, `.gitignore`, `CHANGELOG.md`

---

## 3. Dependencies

- [ ] All dependencies declared in `pyproject.toml` or `requirements.txt`
- [ ] Development dependencies separated from runtime dependencies
- [ ] Uses minimal, necessary dependencies only

---

## 4. Code Quality

- [ ] Follows PEP 8 formatting
- [ ] Imports sorted with `isort` or `ruff`
- [ ] No linter warnings (`ruff`, `flake8`, etc.)
- [ ] Fully typed using `typing` module
- [ ] No unresolved TODOs or FIXME comments

---

## 5. Function & Module Design

- [ ] Functions are small, pure, and single-responsibility
- [ ] Classes follow clear and simple roles
- [ ] Global state is avoided
- [ ] Public API defined explicitly (e.g. via `__all__`)

---

## 6. Documentation

- [ ] `README.md` includes overview, install, usage, contributing
- [ ] All functions/classes include docstrings (Google/NumPy style)
- [ ] API reference documentation auto-generated (e.g., Sphinx, MkDocs)
- [ ] Optional: `docs/` folder for additional documentation or site generator

---

## 7. Testing

- [ ] Unit and integration tests implemented
- [ ] Test coverage > 80% verified by `coverage`
- [ ] Tests are fast and deterministic
- [ ] Continuous Integration (CI) configured to run tests

---

## 8. Versioning & Releases

- [ ] Uses semantic versioning (MAJOR.MINOR.PATCH)
- [ ] Git tags created for releases
- [ ] `CHANGELOG.md` updated with each release
- [ ] Local build verified (`poetry build`, `hatch build`, or equivalent)
- [ ] Can be published to PyPI and/or TestPyPI

---

## 9. CLI or Scripts (Optional)

- [ ] CLI entrypoint works correctly (`__main__.py` or `entry_points`)
- [ ] CLI provides helpful messages (`--help`) and handles errors gracefully

---

## 10. Examples / Tutorials

- [ ] Usage examples included in `README.md` or `examples/`
- [ ] Optional: Jupyter notebooks with demonstrations
- [ ] Optional: Colab or Binder links for live usage

---

## 11. Licensing & Attribution

- [ ] LICENSE file included (MIT, Apache 2.0, GPL, etc.)
- [ ] Author and contributors credited in `README.md`
- [ ] Optional: `CITATION.cff` file for academic citation

---

> You can duplicate this file for each new package or use it as a GitHub issue template for release checklists.
Loading
Loading