Skip to content

Commit 8e7b800

Browse files
fix: ensure doc links and tag workflow (#69)
1 parent 77b9f06 commit 8e7b800

File tree

3 files changed

+80
-43
lines changed

3 files changed

+80
-43
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- 'v*'
79
pull_request:
810
branches:
911
- main
@@ -77,3 +79,33 @@ jobs:
7779

7880
- name: Run pre-commit checks
7981
run: poetry run pre-commit run --all-files
82+
83+
publish:
84+
name: Publish to PyPI
85+
needs: [test, lint]
86+
runs-on: ubuntu-latest
87+
if: startsWith(github.ref, 'refs/tags/')
88+
89+
steps:
90+
- name: Checkout code
91+
uses: actions/checkout@v4
92+
with:
93+
fetch-depth: 0
94+
95+
- name: Set up Python
96+
uses: actions/setup-python@v5
97+
with:
98+
python-version: "3.11"
99+
100+
- name: Verify version matches tag
101+
run: python scripts/check_version_match.py
102+
103+
- name: Install Poetry
104+
run: |
105+
curl -sSL https://install.python-poetry.org | python3 -
106+
echo "$HOME/.local/bin" >> $GITHUB_PATH
107+
108+
- name: Publish
109+
env:
110+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
111+
run: poetry publish --build --no-interaction

README.md

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
11
# gen_surv
22

3-
[![Coverage](https://codecov.io/gh/DiogoRibeiro7/genSurvPy/branch/main/graph/badge.svg)](https://app.codecov.io/gh/DiogoRibeiro7/genSurvPy)
4-
[![Docs](https://readthedocs.org/projects/gensurvpy/badge/?version=latest)](https://gensurvpy.readthedocs.io/en/latest/)
5-
[![PyPI](https://img.shields.io/pypi/v/gen_surv)](https://pypi.org/project/gen-surv/)
6-
[![Tests](https://github.com/DiogoRibeiro7/genSurvPy/actions/workflows/ci.yml/badge.svg)](https://github.com/DiogoRibeiro7/genSurvPy/actions/workflows/ci.yml)
7-
[![Python](https://img.shields.io/pypi/pyversions/gen_surv)](https://pypi.org/project/gen-surv/)
8-
9-
**gen_surv** is a Python package for simulating survival data under a variety of statistical models. It is inspired by the R package [genSurv](https://cran.r-project.org/package=genSurv) and provides a unified interface for generating realistic survival datasets.
3+
[![Coverage][cov-badge]][cov-link]
4+
[![Docs][docs-badge]][docs-link]
5+
[![PyPI][pypi-badge]][pypi-link]
6+
[![Tests][ci-badge]][ci-link]
7+
[![Python][py-badge]][pypi-link]
8+
9+
[cov-badge]: https://codecov.io/gh/DiogoRibeiro7/genSurvPy/branch/main/graph/badge.svg
10+
[cov-link]: https://app.codecov.io/gh/DiogoRibeiro7/genSurvPy
11+
[docs-badge]: https://readthedocs.org/projects/gensurvpy/badge/?version=latest
12+
[docs-link]: https://gensurvpy.readthedocs.io/en/latest/
13+
[pypi-badge]: https://img.shields.io/pypi/v/gen_surv
14+
[pypi-link]: https://pypi.org/project/gen-surv/
15+
[ci-badge]: https://github.com/DiogoRibeiro7/genSurvPy/actions/workflows/ci.yml/badge.svg
16+
[ci-link]: https://github.com/DiogoRibeiro7/genSurvPy/actions/workflows/ci.yml
17+
[py-badge]: https://img.shields.io/pypi/pyversions/gen_surv
18+
19+
**gen_surv** is a Python library for simulating survival data under a wide range of statistical models. Inspired by the R package [genSurv](https://cran.r-project.org/package=genSurv), it offers a unified interface for generating realistic datasets for research, teaching and benchmarking.
1020

1121
---
1222

1323
## Features
1424

1525
- Cox proportional hazards model (CPHM)
16-
- Accelerated failure time models (log-normal, log-logistic)
26+
- Accelerated failure time models (log-normal, log-logistic, Weibull)
1727
- Continuous-time multi-state Markov model (CMM)
1828
- Time-dependent covariate model (TDCM)
1929
- Time-homogeneous hidden Markov model (THMM)
2030
- Mixture cure and piecewise exponential models
2131
- Competing risks generators (constant and Weibull hazards)
22-
- Command-line interface and export utilities
32+
- Visualization utilities for simulated datasets
2333
- Scikit-learn compatible data generator
24-
- Conversion helper for scikit-survival and lifelines
34+
- Conversion helpers for scikit-survival and lifelines
35+
- Command-line interface and export utilities
2536

2637
## Installation
2738

@@ -45,8 +56,7 @@ cd genSurvPy
4556
poetry install --with dev
4657
```
4758

48-
Integration tests that rely on scikit-survival are automatically skipped if the
49-
package is not installed.
59+
Integration tests that rely on scikit-survival are automatically skipped if the package is not installed.
5060

5161
## Development Setup
5262

@@ -57,10 +67,13 @@ pre-commit install
5767
pre-commit run --all-files
5868
```
5969

60-
## Quick Example
70+
## Usage
71+
72+
### Python API
6173

6274
```python
63-
from gen_surv import export_dataset, generate
75+
from gen_surv import generate, export_dataset, to_sksurv
76+
from gen_surv.visualization import plot_survival_curve
6477

6578
# basic Cox proportional hazards data
6679
sim = generate(
@@ -72,45 +85,38 @@ sim = generate(
7285
cens_par=1.0,
7386
)
7487

75-
# save to an RDS file
88+
plot_survival_curve(sim)
7689
export_dataset(sim, "survival_data.rds")
77-
```
78-
79-
You can also convert the resulting DataFrame for use with
80-
[scikit-survival](https://scikit-survival.readthedocs.io) or
81-
[lifelines](https://lifelines.readthedocs.io):
82-
83-
```python
84-
from gen_surv import to_sksurv
8590

91+
# convert for scikit-survival
8692
sks_dataset = to_sksurv(sim)
8793
```
8894

89-
See the [usage guide](docs/source/getting_started.md) for more examples.
95+
See the [usage guide](https://gensurvpy.readthedocs.io/en/latest/getting_started.html) for more examples.
9096

91-
## Supported Models
92-
93-
| Model | Description |
94-
|----------------------|-----------------------------------------|
95-
| **CPHM** | Cox proportional hazards |
96-
| **AFT** | Accelerated failure time (log-normal, log-logistic) |
97-
| **CMM** | Continuous-time multi-state Markov |
98-
| **TDCM** | Time-dependent covariates |
99-
| **THMM** | Time-homogeneous hidden Markov |
100-
| **Competing Risks** | Multiple event types with cause-specific hazards |
101-
| **Mixture Cure** | Models long-term survivors |
102-
| **Piecewise Exponential** | Flexible baseline hazard via intervals |
103-
104-
More details on each algorithm are available in the [Algorithms](docs/source/algorithms.md) page and the [theory guide](docs/source/theory.md).
105-
106-
## Command-Line Usage
97+
### Command Line
10798

10899
Datasets can be generated without writing Python code:
109100

110101
```bash
111102
python -m gen_surv dataset cphm --n 1000 -o survival.csv
112103
```
113104

105+
## Supported Models
106+
107+
| Model | Description |
108+
|-------|-------------|
109+
| **CPHM** | Cox proportional hazards |
110+
| **AFT** | Accelerated failure time (log-normal, log-logistic, Weibull) |
111+
| **CMM** | Continuous-time multi-state Markov |
112+
| **TDCM** | Time-dependent covariates |
113+
| **THMM** | Time-homogeneous hidden Markov |
114+
| **Competing Risks** | Multiple event types with cause-specific hazards |
115+
| **Mixture Cure** | Models long-term survivors |
116+
| **Piecewise Exponential** | Flexible baseline hazard via intervals |
117+
118+
More details on each algorithm are available in the [Algorithms](https://gensurvpy.readthedocs.io/en/latest/algorithms.html) page. For additional background, see the [theory guide](https://gensurvpy.readthedocs.io/en/latest/theory.html).
119+
114120
## Documentation
115121

116122
Full documentation is hosted on [Read the Docs](https://gensurvpy.readthedocs.io/en/latest/). It includes installation instructions, tutorials, API references and a bibliography.
@@ -139,4 +145,3 @@ If you use **gen_surv** in your research, please cite the project using the meta
139145
- ORCID: <https://orcid.org/0009-0001-2022-7072>
140146
- Professional email: <[email protected]>
141147
- Personal email: <[email protected]>
142-

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[tool.poetry]
22
name = "gen_surv"
3-
version = "1.0.9"
3+
version = "1.0.8"
44
description = "A Python package for simulating survival data, inspired by the R package genSurv"
55
authors = ["Diogo Ribeiro <[email protected]>"]
66
license = "MIT"
77
readme = "README.md"
88
packages = [{ include = "gen_surv" }]
99
homepage = "https://github.com/DiogoRibeiro7/genSurvPy"
1010
repository = "https://github.com/DiogoRibeiro7/genSurvPy"
11-
documentation = "https://gensurvpy.readthedocs.io/en/stable/"
11+
documentation = "https://gensurvpy.readthedocs.io/en/latest/"
1212
keywords = ["survival-analysis", "simulation", "cox-model", "markov-model", "time-dependent", "statistics"]
1313
classifiers = [
1414
"Development Status :: 5 - Production/Stable",

0 commit comments

Comments
 (0)