Skip to content

Commit 75d4653

Browse files
committed
docs: add Sphinx configuration with Markdown support and index.md setup
1 parent 56a3453 commit 75d4653

File tree

8 files changed

+231
-13
lines changed

8 files changed

+231
-13
lines changed

README.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,30 @@ print(df.head())
5050

5151
```text
5252
genSurvPy/
53-
gen_surv/
54-
├── cphm.py
55-
├── cmm.py
56-
├── tdcm.py
57-
├── thmm.py
58-
├── censoring.py
59-
├── validate.py
60-
examples/
61-
├── run_cphm.py
62-
├── run_cmm.py
63-
├── run_tdcm.py
64-
├── run_thmm.py
65-
└── utils.py # optional for shared config (e.g. seeding)
53+
├── gen_surv/ # Pacote principal
54+
│ ├── __main__.py # Interface CLI via python -m
55+
│ ├── cphm.py
56+
│ ├── cmm.py
57+
│ ├── tdcm.py
58+
│ ├── thmm.py
59+
│ ├── censoring.py
60+
│ ├── bivariate.py
61+
│ ├── validate.py
62+
63+
├── tests/ # Testes automatizados
64+
│ ├── test_cphm.py
65+
│ ├── test_cmm.py
66+
│ ├── test_tdcm.py
67+
│ ├── test_thmm.py
68+
69+
├── examples/ # Exemplos de uso
70+
│ ├── run_cphm.py
71+
│ ├── ...
72+
73+
├── pyproject.toml # Configurado com Poetry
74+
├── README.md
75+
├── LICENSE
76+
├── .gitignore
6677
```
6778

6879
## 🧠 License

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/source/conf.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
import os
9+
import sys
10+
sys.path.insert(0, os.path.abspath('../../gen_surv'))
11+
12+
project = 'gen_suv'
13+
copyright = '2025, Diogo Ribeiro'
14+
author = 'Diogo Ribeiro'
15+
release = '0.2.0'
16+
17+
# -- General configuration ---------------------------------------------------
18+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
19+
20+
extensions = [
21+
"sphinx.ext.autodoc",
22+
"sphinx.ext.napoleon",
23+
"myst_parser",
24+
]
25+
26+
# Point to index.md or index.rst as the root document
27+
master_doc = "index"
28+
29+
templates_path = ['_templates']
30+
exclude_patterns = []
31+
32+
# -- Options for HTML output -------------------------------------------------
33+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
34+
35+
html_theme = 'alabaster'
36+
html_static_path = ['_static']
37+

docs/source/gen_surv.rst

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
gen\_surv package
2+
=================
3+
4+
Submodules
5+
----------
6+
7+
gen\_surv.bivariate module
8+
--------------------------
9+
10+
.. automodule:: gen_surv.bivariate
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
gen\_surv.censoring module
16+
--------------------------
17+
18+
.. automodule:: gen_surv.censoring
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
gen\_surv.cmm module
24+
--------------------
25+
26+
.. automodule:: gen_surv.cmm
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
31+
gen\_surv.cphm module
32+
---------------------
33+
34+
.. automodule:: gen_surv.cphm
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:
38+
39+
gen\_surv.tdcm module
40+
---------------------
41+
42+
.. automodule:: gen_surv.tdcm
43+
:members:
44+
:undoc-members:
45+
:show-inheritance:
46+
47+
gen\_surv.thmm module
48+
---------------------
49+
50+
.. automodule:: gen_surv.thmm
51+
:members:
52+
:undoc-members:
53+
:show-inheritance:
54+
55+
gen\_surv.validate module
56+
-------------------------
57+
58+
.. automodule:: gen_surv.validate
59+
:members:
60+
:undoc-members:
61+
:show-inheritance:
62+
63+
Module contents
64+
---------------
65+
66+
.. automodule:: gen_surv
67+
:members:
68+
:undoc-members:
69+
:show-inheritance:

docs/source/index.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# gen_surv
2+
3+
**gen_surv** is a Python package for simulating survival data under various models, inspired by the R package `genSurv`.
4+
5+
It includes generators for:
6+
7+
- **Cox Proportional Hazards Models (CPHM)**
8+
- **Continuous-Time Markov Models (CMM)**
9+
- **Time-Dependent Covariate Models (TDCM)**
10+
- **Time-Homogeneous Hidden Markov Models (THMM)**
11+
12+
---
13+
14+
## 📚 Modules
15+
16+
```{toctree}
17+
:maxdepth: 2
18+
:caption: Contents
19+
20+
modules
21+
```
22+
23+
# 🚀 Usage Example
24+
25+
```python
26+
from gen_surv.cphm import gen_cphm
27+
28+
df = gen_cphm(n=100, model_cens="uniform", cens_par=1.0, beta=0.5, covar=2.0)
29+
print(df.head())
30+
```
31+
32+
## 🔗 Project Links
33+
34+
- [Source Code](https://github.com/DiogoRibeiro7/genSurvPy)
35+
- [License](https://github.com/DiogoRibeiro7/genSurvPy/blob/main/LICENSE)

docs/source/modules.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
gen_surv
2+
========
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
7+
gen_surv

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ pytest-cov = "^6.1.1"
1616
[tool.poetry.group.dev.dependencies]
1717
pytest = "^8.3.5"
1818

19+
20+
[tool.poetry.group.docs.dependencies]
21+
myst-parser = "<4.0.0"
22+
1923
[tool.semantic_release]
2024
version_source = "tag"
2125
version_variable = ["pyproject.toml:project.version"]

0 commit comments

Comments
 (0)