pkpdutils 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. pkpdutils-1.0.0/.bumpversion.toml +28 -0
  2. pkpdutils-1.0.0/.editorconfig +20 -0
  3. pkpdutils-1.0.0/.github/CODEOWNERS +1 -0
  4. pkpdutils-1.0.0/.github/ISSUE_TEMPLATE/01-bug-report.md +49 -0
  5. pkpdutils-1.0.0/.github/ISSUE_TEMPLATE/02-question.md +16 -0
  6. pkpdutils-1.0.0/.github/ISSUE_TEMPLATE/03-feature-request.md +36 -0
  7. pkpdutils-1.0.0/.github/ISSUE_TEMPLATE/config.yml +2 -0
  8. pkpdutils-1.0.0/.github/dependabot.yml +16 -0
  9. pkpdutils-1.0.0/.github/pull_request_template.md +12 -0
  10. pkpdutils-1.0.0/.github/rulesets/apply.sh +43 -0
  11. pkpdutils-1.0.0/.github/rulesets/develop.json +61 -0
  12. pkpdutils-1.0.0/.github/rulesets/main.json +22 -0
  13. pkpdutils-1.0.0/.github/rulesets/tags.json +16 -0
  14. pkpdutils-1.0.0/.github/workflows/ci-cd.yml +117 -0
  15. pkpdutils-1.0.0/.github/workflows/docs.yml +66 -0
  16. pkpdutils-1.0.0/.github/workflows/ruff.yml +37 -0
  17. pkpdutils-1.0.0/.github/workflows/ty.yml +38 -0
  18. pkpdutils-1.0.0/.gitignore +34 -0
  19. pkpdutils-1.0.0/.pre-commit-config.yaml +65 -0
  20. pkpdutils-1.0.0/.python-version +1 -0
  21. pkpdutils-1.0.0/.ruff.toml +76 -0
  22. pkpdutils-1.0.0/.zenodo.json +25 -0
  23. pkpdutils-1.0.0/CITATION.cff +25 -0
  24. pkpdutils-1.0.0/CLAUDE.md +83 -0
  25. pkpdutils-1.0.0/LICENSE +7 -0
  26. pkpdutils-1.0.0/PKG-INFO +104 -0
  27. pkpdutils-1.0.0/README.md +59 -0
  28. pkpdutils-1.0.0/conftest.py +15 -0
  29. pkpdutils-1.0.0/docs/api/console.md +3 -0
  30. pkpdutils-1.0.0/docs/api/fit.compare.md +3 -0
  31. pkpdutils-1.0.0/docs/api/fit.md +21 -0
  32. pkpdutils-1.0.0/docs/api/fit.models.md +13 -0
  33. pkpdutils-1.0.0/docs/api/fit.proportionality.md +3 -0
  34. pkpdutils-1.0.0/docs/api/index.md +57 -0
  35. pkpdutils-1.0.0/docs/api/log.md +3 -0
  36. pkpdutils-1.0.0/docs/api/nca.auc.md +3 -0
  37. pkpdutils-1.0.0/docs/api/nca.md +3 -0
  38. pkpdutils-1.0.0/docs/api/nca.options.md +3 -0
  39. pkpdutils-1.0.0/docs/api/nca.result.md +3 -0
  40. pkpdutils-1.0.0/docs/api/nca.steady_state.md +3 -0
  41. pkpdutils-1.0.0/docs/api/nca.terminal.md +3 -0
  42. pkpdutils-1.0.0/docs/api/nca.uncertainty.md +3 -0
  43. pkpdutils-1.0.0/docs/api/plot.md +29 -0
  44. pkpdutils-1.0.0/docs/api/result.md +3 -0
  45. pkpdutils-1.0.0/docs/api/stats.bioequivalence.md +3 -0
  46. pkpdutils-1.0.0/docs/api/stats.ddi.md +3 -0
  47. pkpdutils-1.0.0/docs/api/stats.md +13 -0
  48. pkpdutils-1.0.0/docs/api/stats.meta.md +3 -0
  49. pkpdutils-1.0.0/docs/api/timecourse.md +3 -0
  50. pkpdutils-1.0.0/docs/api/units.md +3 -0
  51. pkpdutils-1.0.0/docs/development.md +228 -0
  52. pkpdutils-1.0.0/docs/fitting.md +202 -0
  53. pkpdutils-1.0.0/docs/glossary.md +58 -0
  54. pkpdutils-1.0.0/docs/images/.gitkeep +0 -0
  55. pkpdutils-1.0.0/docs/images/nca_single.png +0 -0
  56. pkpdutils-1.0.0/docs/index.md +61 -0
  57. pkpdutils-1.0.0/docs/installation.md +70 -0
  58. pkpdutils-1.0.0/docs/javascripts/mathjax.js +12 -0
  59. pkpdutils-1.0.0/docs/nca.md +167 -0
  60. pkpdutils-1.0.0/docs/pd.md +69 -0
  61. pkpdutils-1.0.0/docs/plotting.md +77 -0
  62. pkpdutils-1.0.0/docs/references.md +155 -0
  63. pkpdutils-1.0.0/docs/robots.txt +9 -0
  64. pkpdutils-1.0.0/docs/statistics.md +157 -0
  65. pkpdutils-1.0.0/docs/superpowers/plans/2026-09-14-pkpdutils-fitting.md +3377 -0
  66. pkpdutils-1.0.0/docs/superpowers/plans/2026-09-14-pkpdutils-nca.md +3554 -0
  67. pkpdutils-1.0.0/docs/superpowers/plans/2026-09-14-pkpdutils-scaffold-and-data-model.md +3664 -0
  68. pkpdutils-1.0.0/docs/superpowers/plans/2026-09-14-pkpdutils-uncertainty.md +1447 -0
  69. pkpdutils-1.0.0/docs/superpowers/plans/2026-09-15-pkpdutils-release-1.0.0.md +487 -0
  70. pkpdutils-1.0.0/docs/superpowers/plans/2026-09-15-pkpdutils-statistics.md +4735 -0
  71. pkpdutils-1.0.0/docs/superpowers/specs/2026-09-14-pkpdutils-redesign-design.md +270 -0
  72. pkpdutils-1.0.0/docs/timecourses.md +102 -0
  73. pkpdutils-1.0.0/docs/uncertainty.md +114 -0
  74. pkpdutils-1.0.0/docs/units.md +31 -0
  75. pkpdutils-1.0.0/examples/README.md +29 -0
  76. pkpdutils-1.0.0/examples/__init__.py +1 -0
  77. pkpdutils-1.0.0/examples/bioequivalence.py +97 -0
  78. pkpdutils-1.0.0/examples/covariate.py +42 -0
  79. pkpdutils-1.0.0/examples/ddi.py +85 -0
  80. pkpdutils-1.0.0/examples/dose_proportionality.py +65 -0
  81. pkpdutils-1.0.0/examples/emax.py +47 -0
  82. pkpdutils-1.0.0/examples/fitting_exponential.py +64 -0
  83. pkpdutils-1.0.0/examples/group_uncertainty.py +109 -0
  84. pkpdutils-1.0.0/examples/meta_analysis.py +61 -0
  85. pkpdutils-1.0.0/examples/nca_batch.py +60 -0
  86. pkpdutils-1.0.0/examples/nca_from_sbmlsim.py +61 -0
  87. pkpdutils-1.0.0/examples/nca_single.py +49 -0
  88. pkpdutils-1.0.0/examples/steady_state.py +68 -0
  89. pkpdutils-1.0.0/examples/timecourses.py +109 -0
  90. pkpdutils-1.0.0/pyproject.toml +94 -0
  91. pkpdutils-1.0.0/release-notes/0.1.5.md +12 -0
  92. pkpdutils-1.0.0/release-notes/0.1.6.md +12 -0
  93. pkpdutils-1.0.0/release-notes/0.2.0.md +12 -0
  94. pkpdutils-1.0.0/release-notes/0.2.1.md +11 -0
  95. pkpdutils-1.0.0/release-notes/0.2.2.md +11 -0
  96. pkpdutils-1.0.0/release-notes/0.3.0.md +11 -0
  97. pkpdutils-1.0.0/release-notes/0.3.1.md +11 -0
  98. pkpdutils-1.0.0/release-notes/1.0.0.md +91 -0
  99. pkpdutils-1.0.0/scripts/llms_txt.py +295 -0
  100. pkpdutils-1.0.0/src/pkpdutils/__init__.py +73 -0
  101. pkpdutils-1.0.0/src/pkpdutils/console.py +30 -0
  102. pkpdutils-1.0.0/src/pkpdutils/fit/__init__.py +47 -0
  103. pkpdutils-1.0.0/src/pkpdutils/fit/compare.py +149 -0
  104. pkpdutils-1.0.0/src/pkpdutils/fit/engine.py +1266 -0
  105. pkpdutils-1.0.0/src/pkpdutils/fit/frontends.py +193 -0
  106. pkpdutils-1.0.0/src/pkpdutils/fit/model.py +163 -0
  107. pkpdutils-1.0.0/src/pkpdutils/fit/models.py +20 -0
  108. pkpdutils-1.0.0/src/pkpdutils/fit/models_exponential.py +362 -0
  109. pkpdutils-1.0.0/src/pkpdutils/fit/models_linear.py +168 -0
  110. pkpdutils-1.0.0/src/pkpdutils/fit/models_response.py +158 -0
  111. pkpdutils-1.0.0/src/pkpdutils/fit/options.py +159 -0
  112. pkpdutils-1.0.0/src/pkpdutils/fit/proportionality.py +76 -0
  113. pkpdutils-1.0.0/src/pkpdutils/fit/result.py +177 -0
  114. pkpdutils-1.0.0/src/pkpdutils/log.py +79 -0
  115. pkpdutils-1.0.0/src/pkpdutils/nca/__init__.py +45 -0
  116. pkpdutils-1.0.0/src/pkpdutils/nca/auc.py +210 -0
  117. pkpdutils-1.0.0/src/pkpdutils/nca/nca.py +710 -0
  118. pkpdutils-1.0.0/src/pkpdutils/nca/options.py +243 -0
  119. pkpdutils-1.0.0/src/pkpdutils/nca/result.py +58 -0
  120. pkpdutils-1.0.0/src/pkpdutils/nca/steady_state.py +233 -0
  121. pkpdutils-1.0.0/src/pkpdutils/nca/terminal.py +233 -0
  122. pkpdutils-1.0.0/src/pkpdutils/nca/uncertainty.py +606 -0
  123. pkpdutils-1.0.0/src/pkpdutils/plot/__init__.py +33 -0
  124. pkpdutils-1.0.0/src/pkpdutils/plot/fit.py +389 -0
  125. pkpdutils-1.0.0/src/pkpdutils/plot/meta.py +102 -0
  126. pkpdutils-1.0.0/src/pkpdutils/plot/nca.py +216 -0
  127. pkpdutils-1.0.0/src/pkpdutils/plot/parameters.py +124 -0
  128. pkpdutils-1.0.0/src/pkpdutils/plot/ratio.py +131 -0
  129. pkpdutils-1.0.0/src/pkpdutils/plot/style.py +42 -0
  130. pkpdutils-1.0.0/src/pkpdutils/plot/timecourse.py +165 -0
  131. pkpdutils-1.0.0/src/pkpdutils/py.typed +0 -0
  132. pkpdutils-1.0.0/src/pkpdutils/result.py +579 -0
  133. pkpdutils-1.0.0/src/pkpdutils/stats/__init__.py +92 -0
  134. pkpdutils-1.0.0/src/pkpdutils/stats/bioequivalence.py +398 -0
  135. pkpdutils-1.0.0/src/pkpdutils/stats/ddi.py +284 -0
  136. pkpdutils-1.0.0/src/pkpdutils/stats/meta.py +525 -0
  137. pkpdutils-1.0.0/src/pkpdutils/stats/ratio.py +176 -0
  138. pkpdutils-1.0.0/src/pkpdutils/stats/sample.py +590 -0
  139. pkpdutils-1.0.0/src/pkpdutils/stats/tests.py +559 -0
  140. pkpdutils-1.0.0/src/pkpdutils/timecourse.py +1287 -0
  141. pkpdutils-1.0.0/src/pkpdutils/units.py +144 -0
  142. pkpdutils-1.0.0/tests/data/Divoll1982_Fig1.tsv +15 -0
  143. pkpdutils-1.0.0/tests/data/Kim2011_Fig2.tsv +27 -0
  144. pkpdutils-1.0.0/tests/data/Lane2014_Fig1.tsv +9 -0
  145. pkpdutils-1.0.0/tests/data/data_example1.csv +41 -0
  146. pkpdutils-1.0.0/tests/data/data_example2.csv +33 -0
  147. pkpdutils-1.0.0/tests/data/midazolam.tsv +2002 -0
  148. pkpdutils-1.0.0/tests/data/reference/meta_bcg.json +22 -0
  149. pkpdutils-1.0.0/tests/data/reference/nca_reference.json +4899 -0
  150. pkpdutils-1.0.0/tests/examples/__init__.py +0 -0
  151. pkpdutils-1.0.0/tests/examples/test_examples.py +48 -0
  152. pkpdutils-1.0.0/tests/fit/__init__.py +0 -0
  153. pkpdutils-1.0.0/tests/fit/test_engine.py +490 -0
  154. pkpdutils-1.0.0/tests/fit/test_engine_advanced.py +298 -0
  155. pkpdutils-1.0.0/tests/fit/test_fit_options.py +57 -0
  156. pkpdutils-1.0.0/tests/fit/test_frontends.py +275 -0
  157. pkpdutils-1.0.0/tests/fit/test_model.py +71 -0
  158. pkpdutils-1.0.0/tests/fit/test_models_exponential.py +152 -0
  159. pkpdutils-1.0.0/tests/fit/test_models_linear.py +60 -0
  160. pkpdutils-1.0.0/tests/fit/test_models_response.py +90 -0
  161. pkpdutils-1.0.0/tests/nca/__init__.py +0 -0
  162. pkpdutils-1.0.0/tests/nca/test_auc.py +126 -0
  163. pkpdutils-1.0.0/tests/nca/test_nca.py +376 -0
  164. pkpdutils-1.0.0/tests/nca/test_options.py +114 -0
  165. pkpdutils-1.0.0/tests/nca/test_partial_auc.py +90 -0
  166. pkpdutils-1.0.0/tests/nca/test_reference.py +83 -0
  167. pkpdutils-1.0.0/tests/nca/test_result.py +138 -0
  168. pkpdutils-1.0.0/tests/nca/test_steady_state.py +224 -0
  169. pkpdutils-1.0.0/tests/nca/test_summarize.py +93 -0
  170. pkpdutils-1.0.0/tests/nca/test_terminal.py +172 -0
  171. pkpdutils-1.0.0/tests/nca/test_uncertainty.py +497 -0
  172. pkpdutils-1.0.0/tests/plot/__init__.py +0 -0
  173. pkpdutils-1.0.0/tests/plot/test_plot_fit.py +101 -0
  174. pkpdutils-1.0.0/tests/plot/test_plot_meta.py +47 -0
  175. pkpdutils-1.0.0/tests/plot/test_plot_nca.py +125 -0
  176. pkpdutils-1.0.0/tests/plot/test_plot_parameters.py +119 -0
  177. pkpdutils-1.0.0/tests/plot/test_plot_ratio.py +54 -0
  178. pkpdutils-1.0.0/tests/stats/__init__.py +0 -0
  179. pkpdutils-1.0.0/tests/stats/test_bioequivalence.py +241 -0
  180. pkpdutils-1.0.0/tests/stats/test_ddi.py +96 -0
  181. pkpdutils-1.0.0/tests/stats/test_meta.py +166 -0
  182. pkpdutils-1.0.0/tests/stats/test_ratio.py +119 -0
  183. pkpdutils-1.0.0/tests/stats/test_sample.py +237 -0
  184. pkpdutils-1.0.0/tests/stats/test_tests.py +216 -0
  185. pkpdutils-1.0.0/tests/test_log.py +19 -0
  186. pkpdutils-1.0.0/tests/test_package.py +55 -0
  187. pkpdutils-1.0.0/tests/test_result.py +160 -0
  188. pkpdutils-1.0.0/tests/test_timecourse.py +253 -0
  189. pkpdutils-1.0.0/tests/test_timecourses.py +483 -0
  190. pkpdutils-1.0.0/tests/test_units.py +64 -0
  191. pkpdutils-1.0.0/tox.ini +20 -0
  192. pkpdutils-1.0.0/zensical.toml +167 -0
@@ -0,0 +1,28 @@
1
+ [tool.bumpversion]
2
+ current_version = "1.0.0"
3
+ commit = true
4
+ parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(\\.dev(?P<dev>\\d+))?"
5
+ serialize = ["{major}.{minor}.{patch}.dev{dev}", "{major}.{minor}.{patch}"]
6
+ search = "{current_version}"
7
+ replace = "{new_version}"
8
+ regex = false
9
+ ignore_missing_version = false
10
+ # no tag: the bump is merged into develop through a pull request, which
11
+ # rewrites the commit, so the tag is created on develop afterwards
12
+ tag = false
13
+ sign_tags = false
14
+ tag_name = "{new_version}"
15
+ tag_message = "Bump version: {current_version} → {new_version}"
16
+ allow_dirty = false
17
+ message = "Bump version: {current_version} → {new_version}"
18
+ commit_args = ""
19
+
20
+ [tool.bumpversion.parts.dev]
21
+ optional_value = "final"
22
+ values = ["0", "final"]
23
+
24
+ [[tool.bumpversion.files]]
25
+ filename = "./src/pkpdutils/__init__.py"
26
+
27
+ [[tool.bumpversion.files]]
28
+ filename = "./CITATION.cff"
@@ -0,0 +1,20 @@
1
+ # Editor Configuration (http://editorconfig.org)
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ indent_style = space
7
+ indent_size = 4
8
+ end_of_line = lf
9
+ insert_final_newline = true
10
+ trim_trailing_whitespace = true
11
+ max_line_length = 88
12
+
13
+ [*.{json,yml}]
14
+ indent_size = 2
15
+
16
+ [*.{md,rst}]
17
+ trim_trailing_whitespace = false
18
+
19
+ [Makefile]
20
+ indent_style = tab
@@ -0,0 +1 @@
1
+ * @matthiaskoenig
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report a bug to help improve this project
4
+ ---
5
+
6
+ <!--
7
+
8
+ Before you create a new problem report, please look through the list of existing open
9
+ and closed issues to see if there are similar ones.
10
+
11
+ https://github.com/matthiaskoenig/pkdb_analysis/issues
12
+
13
+ -->
14
+
15
+ #### Problem description
16
+
17
+ Please explain:
18
+ * **what** you tried to achieve,
19
+ * **how** you went about it (referring to the code sample), and
20
+ * **why** the current behaviour is a problem and what output
21
+ you expected instead.
22
+
23
+ #### Code Sample
24
+
25
+ Create a [minimal, complete, verifiable example](https://stackoverflow.com/help/mcve).
26
+
27
+ <!-- Paste your code between the ``` tickmarks below or link to a gist. -->
28
+ ```python
29
+ ```
30
+
31
+ <!-- If there was a crash, please include the traceback between the ``` tickmarks below. -->
32
+ ```
33
+ ```
34
+
35
+ ### Context
36
+
37
+ <!-- Run the following code and paste the output between the ``` tickmarks below
38
+ inside the details block.
39
+
40
+ python -c "import pkdb_analysis;pkdb_analysis.show_versions()"
41
+
42
+ -->
43
+
44
+ <details>
45
+
46
+ ```
47
+ ```
48
+
49
+ </details>
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: Question
3
+ about: Ask a question
4
+ ---
5
+
6
+ ### Checklist
7
+
8
+ <!-- To help keep this issue tracker clean and focused, please make sure that you have
9
+ tried *all* of the following resources before submitting your question. -->
10
+
11
+ - [ ] I searched the [documentation](https://pkdb-analysis.readthedocs.io).
12
+ - [ ] I looked through [similar issues on GitHub](https://github.com/matthiaskoenig/pkdb_analysis/issues).
13
+
14
+ ### Question
15
+
16
+ <!-- Please ask your question here. -->
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ ---
5
+
6
+ ### Checklist
7
+
8
+ <!-- Please make sure you check all these items before submitting your feature request. -->
9
+
10
+ - [ ] There are [no similar issues or pull requests](https://github.com/matthiaskoenig/pkdb_analysis/issues) for this yet.
11
+
12
+ ### Is your feature related to a problem? Please describe it.
13
+
14
+ <!--
15
+ A clear and concise description of what you are trying to achieve.
16
+ "I want to be able to [...] but I can't because [...]".
17
+ -->
18
+
19
+ ## Describe the solution you would like.
20
+
21
+ <!--
22
+ A clear and concise description of what you would want to happen.
23
+ For API changes, try to provide a code snippet of what you would like the new API to
24
+ look like.
25
+ -->
26
+
27
+ ## Describe alternatives you considered
28
+
29
+ <!--
30
+ Please describe any alternative solutions or features you've considered to solve
31
+ your problem and why they wouldn't solve it.
32
+ -->
33
+
34
+ ## Additional context
35
+
36
+ <!-- Provide any additional context, screenshots, tracebacks, etc. about the feature here. -->
@@ -0,0 +1,2 @@
1
+ # Ref: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
2
+ blank_issues_enabled: true
@@ -0,0 +1,16 @@
1
+ # Keep the GitHub Actions used in the workflows up to date.
2
+ # See https://docs.github.com/code-security/dependabot/dependabot-version-updates
3
+ version: 2
4
+ updates:
5
+ - package-ecosystem: "github-actions"
6
+ directory: "/"
7
+ schedule:
8
+ interval: "weekly"
9
+ # a single pull request for all action updates instead of one per action
10
+ groups:
11
+ github-actions:
12
+ patterns:
13
+ - "*"
14
+ open-pull-requests-limit: 5
15
+ commit-message:
16
+ prefix: "ci"
@@ -0,0 +1,12 @@
1
+ ## Summary
2
+
3
+ <!-- what does this change and why -->
4
+
5
+ ## Checklist
6
+
7
+ - [ ] the pull request targets `develop`
8
+ - [ ] tests were added or updated for the change
9
+ - [ ] `tox run-parallel` passes locally (tests and `ty`)
10
+ - [ ] `ruff check` and `ruff format` are clean, e.g., via `pre-commit run --all-files`
11
+ - [ ] public functions and classes have type annotations and a docstring
12
+ - [ ] user visible changes are in `release-notes/` and, if needed, in `docs/`
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Apply the repository policies of pkpdutils: the merge settings of the
4
+ # repository and the rulesets in this directory. The script is idempotent, i.e.,
5
+ # a ruleset which already exists is updated instead of added a second time, so
6
+ # it can be run again after every change of the json files.
7
+ #
8
+ # The file name of a ruleset has to match the "name" in the json. A ruleset which
9
+ # is removed from this directory stays on the repository, delete it with
10
+ # `gh api -X DELETE repos/<owner>/<repo>/rulesets/<id>`.
11
+ #
12
+ # Requires the github cli (https://cli.github.com) authenticated as a user with
13
+ # admin permission on the repository:
14
+ #
15
+ # gh auth login
16
+ # .github/rulesets/apply.sh [owner/repo]
17
+ #
18
+ set -euo pipefail
19
+
20
+ REPO="${1:-matthiaskoenig/pkpdutils}"
21
+ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
22
+
23
+ echo "repository settings of ${REPO}"
24
+ gh api -X PATCH "repos/${REPO}" \
25
+ -F allow_auto_merge=true \
26
+ -F delete_branch_on_merge=true \
27
+ -F allow_update_branch=true \
28
+ -F allow_squash_merge=true \
29
+ -F allow_rebase_merge=true \
30
+ -F allow_merge_commit=false \
31
+ --silent
32
+
33
+ for path in "${DIR}"/*.json; do
34
+ name="$(basename "${path}" .json)"
35
+ id="$(gh api "repos/${REPO}/rulesets" --jq "map(select(.name == \"${name}\")) | .[0].id // empty")"
36
+ if [[ -n "${id}" ]]; then
37
+ gh api -X PUT "repos/${REPO}/rulesets/${id}" --input "${path}" --silent
38
+ echo "ruleset ${name} updated (${id})"
39
+ else
40
+ id="$(gh api -X POST "repos/${REPO}/rulesets" --input "${path}" --jq .id)"
41
+ echo "ruleset ${name} created (${id})"
42
+ fi
43
+ done
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "develop",
3
+ "target": "branch",
4
+ "enforcement": "active",
5
+ "bypass_actors": [],
6
+ "conditions": {
7
+ "ref_name": {
8
+ "include": [
9
+ "refs/heads/develop"
10
+ ],
11
+ "exclude": []
12
+ }
13
+ },
14
+ "rules": [
15
+ {
16
+ "type": "deletion"
17
+ },
18
+ {
19
+ "type": "non_fast_forward"
20
+ },
21
+ {
22
+ "type": "required_linear_history"
23
+ },
24
+ {
25
+ "type": "pull_request",
26
+ "parameters": {
27
+ "required_approving_review_count": 0,
28
+ "dismiss_stale_reviews_on_push": true,
29
+ "require_code_owner_review": false,
30
+ "require_last_push_approval": false,
31
+ "required_review_thread_resolution": true,
32
+ "allowed_merge_methods": [
33
+ "squash",
34
+ "rebase"
35
+ ],
36
+ "require_extra_approval_for_unattributed_changes": false
37
+ }
38
+ },
39
+ {
40
+ "type": "required_status_checks",
41
+ "parameters": {
42
+ "strict_required_status_checks_policy": false,
43
+ "do_not_enforce_on_create": false,
44
+ "required_status_checks": [
45
+ {
46
+ "context": "tests"
47
+ },
48
+ {
49
+ "context": "ruff"
50
+ },
51
+ {
52
+ "context": "ty"
53
+ },
54
+ {
55
+ "context": "docs"
56
+ }
57
+ ]
58
+ }
59
+ }
60
+ ]
61
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "main",
3
+ "target": "branch",
4
+ "enforcement": "active",
5
+ "bypass_actors": [],
6
+ "conditions": {
7
+ "ref_name": {
8
+ "include": [
9
+ "refs/heads/main"
10
+ ],
11
+ "exclude": []
12
+ }
13
+ },
14
+ "rules": [
15
+ {
16
+ "type": "deletion"
17
+ },
18
+ {
19
+ "type": "non_fast_forward"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "tags",
3
+ "target": "tag",
4
+ "enforcement": "active",
5
+ "bypass_actors": [],
6
+ "conditions": {
7
+ "ref_name": {
8
+ "include": ["~ALL"],
9
+ "exclude": []
10
+ }
11
+ },
12
+ "rules": [
13
+ {"type": "deletion"},
14
+ {"type": "non_fast_forward"}
15
+ ]
16
+ }
@@ -0,0 +1,117 @@
1
+ name: CI-CD
2
+
3
+ on:
4
+ push:
5
+ # feature branches are tested through their pull request, tags release
6
+ branches: [develop, main]
7
+ tags: ['*']
8
+ pull_request:
9
+ branches: [develop, main]
10
+ workflow_dispatch:
11
+
12
+ # least privilege by default, the release job raises what it needs
13
+ permissions:
14
+ contents: read
15
+
16
+ concurrency:
17
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
18
+ # superseded branch runs are cancelled, release runs are never cancelled
19
+ cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}
20
+
21
+ jobs:
22
+ test:
23
+ runs-on: ${{ matrix.os }}
24
+ timeout-minutes: 45
25
+ strategy:
26
+ fail-fast: false
27
+ matrix:
28
+ os: [ubuntu-latest, windows-latest, macos-latest]
29
+ python-version: ["3.13", "3.14"]
30
+ # linux covers the full range, windows and macos only the newest version
31
+ exclude:
32
+ - os: windows-latest
33
+ python-version: "3.13"
34
+ - os: macos-latest
35
+ python-version: "3.13"
36
+
37
+ steps:
38
+ - uses: actions/checkout@v7
39
+ with:
40
+ persist-credentials: false
41
+ - name: Install uv and set the python version
42
+ # astral-sh/setup-uv publishes no floating major tag beyond v7
43
+ uses: astral-sh/setup-uv@v10.0.1
44
+ with:
45
+ python-version: ${{ matrix.python-version }}
46
+ enable-cache: true
47
+ - name: Test with tox
48
+ run:
49
+ uvx --with tox-uv tox -e py${{ matrix.python-version }}
50
+
51
+ tests:
52
+ # the one check the branch protection requires; the names of the matrix
53
+ # jobs change with the matrix, this name does not, see .github/rulesets/
54
+ name: tests
55
+ needs: test
56
+ if: always()
57
+ runs-on: ubuntu-latest
58
+ timeout-minutes: 5
59
+ steps:
60
+ - name: Check the result of the test matrix
61
+ env:
62
+ RESULT: ${{ needs.test.result }}
63
+ run: |
64
+ echo "test matrix: $RESULT"
65
+ test "$RESULT" = "success"
66
+
67
+ release:
68
+ needs: tests
69
+ if: startsWith(github.ref, 'refs/tags/')
70
+ runs-on: ubuntu-latest
71
+ timeout-minutes: 20
72
+ environment:
73
+ name: pypi
74
+ url: https://pypi.org/p/pkpdutils
75
+ permissions:
76
+ id-token: write # trusted publishing to PyPI
77
+ contents: write # create the GitHub release
78
+ steps:
79
+ - uses: actions/checkout@v7
80
+ with:
81
+ persist-credentials: false
82
+ - name: Install uv
83
+ uses: astral-sh/setup-uv@v10.0.1
84
+ with:
85
+ python-version: "3.14"
86
+ enable-cache: true
87
+ - name: Build package
88
+ run: uvx hatch build
89
+ - name: Check the package
90
+ run: uvx twine check dist/*
91
+ - name: Publish to PyPI
92
+ uses: pypa/gh-action-pypi-publish@release/v1
93
+ with:
94
+ packages-dir: dist
95
+ - name: Create GitHub release
96
+ uses: softprops/action-gh-release@v3
97
+ with:
98
+ body_path: "release-notes/${{ github.ref_name }}.md"
99
+ draft: false
100
+ prerelease: false
101
+
102
+ sync-main:
103
+ # main tracks the latest published release, see docs/development.md
104
+ needs: release
105
+ if: startsWith(github.ref, 'refs/tags/')
106
+ runs-on: ubuntu-latest
107
+ timeout-minutes: 5
108
+ permissions:
109
+ contents: write # fast-forward main to the released commit
110
+ steps:
111
+ - uses: actions/checkout@v7
112
+ with:
113
+ # a shallow clone cannot be pushed to another branch
114
+ fetch-depth: 0
115
+ - name: Fast-forward main to the release
116
+ # no --force: the push fails loudly if it would not be a fast-forward
117
+ run: git push origin HEAD:main
@@ -0,0 +1,66 @@
1
+ name: documentation
2
+
3
+ on:
4
+ push:
5
+ # feature branches are built through their pull request
6
+ branches: [develop, main]
7
+ pull_request:
8
+ branches: [develop, main]
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ concurrency:
15
+ # one run per branch or pull request, so that a deployment of `develop` is
16
+ # never overtaken by the next one, which would leave the site half published
17
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
18
+ cancel-in-progress: false
19
+
20
+ jobs:
21
+ docs:
22
+ # the name the branch protection requires, see .github/rulesets/
23
+ name: docs
24
+ runs-on: ubuntu-latest
25
+ timeout-minutes: 20
26
+ steps:
27
+ - uses: actions/checkout@v7
28
+ with:
29
+ persist-credentials: false
30
+ - name: Configure GitHub Pages
31
+ uses: actions/configure-pages@v6
32
+ - name: Install uv and set the python version
33
+ uses: astral-sh/setup-uv@v10.0.1
34
+ with:
35
+ python-version: "3.14"
36
+ enable-cache: true
37
+ - name: Install dependencies
38
+ run: uv sync --extra dev
39
+ - name: Build the documentation
40
+ # the API reference is rendered from the docstrings by mkdocstrings,
41
+ # so the package has to be importable
42
+ run: uv run zensical build --clean --strict
43
+ - name: Generate the agent facing files
44
+ # llms.txt, llms-full.txt and the markdown of every page
45
+ run: uv run python scripts/llms_txt.py
46
+ - name: Upload the site
47
+ uses: actions/upload-pages-artifact@v5
48
+ with:
49
+ path: site
50
+
51
+ deploy:
52
+ needs: docs
53
+ # only the default branch publishes to https://matthiaskoenig.github.io/pkpdutils
54
+ if: github.ref == 'refs/heads/develop'
55
+ runs-on: ubuntu-latest
56
+ timeout-minutes: 10
57
+ permissions:
58
+ pages: write # deploy to GitHub Pages
59
+ id-token: write # verify the deployment originates from this workflow
60
+ environment:
61
+ name: github-pages
62
+ url: ${{ steps.deployment.outputs.page_url }}
63
+ steps:
64
+ - name: Deploy to GitHub Pages
65
+ id: deployment
66
+ uses: actions/deploy-pages@v5
@@ -0,0 +1,37 @@
1
+ name: ruff
2
+
3
+ on:
4
+ push:
5
+ # feature branches are checked through their pull request
6
+ branches: [develop, main]
7
+ pull_request:
8
+ branches: [develop, main]
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ concurrency:
15
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16
+ cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}
17
+
18
+ jobs:
19
+ ruff:
20
+ # required by the branch protection, see .github/rulesets/develop.json
21
+ name: ruff
22
+ runs-on: ubuntu-latest
23
+ timeout-minutes: 10
24
+ steps:
25
+ - uses: actions/checkout@v7
26
+ with:
27
+ persist-credentials: false
28
+ # the ruff version is read from the dev dependencies in pyproject.toml
29
+ - name: Lint
30
+ # astral-sh/ruff-action publishes no floating major tag beyond v3
31
+ uses: astral-sh/ruff-action@v4.1.0
32
+ with:
33
+ args: check --output-format=github
34
+ - name: Format
35
+ uses: astral-sh/ruff-action@v4.1.0
36
+ with:
37
+ args: format --check --diff
@@ -0,0 +1,38 @@
1
+ name: ty
2
+
3
+ on:
4
+ push:
5
+ # feature branches are checked through their pull request
6
+ branches: [develop, main]
7
+ pull_request:
8
+ branches: [develop, main]
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ concurrency:
15
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16
+ cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}
17
+
18
+ jobs:
19
+ ty:
20
+ # required by the branch protection, see .github/rulesets/develop.json
21
+ name: ty
22
+ runs-on: ubuntu-latest
23
+ timeout-minutes: 15
24
+ steps:
25
+ - uses: actions/checkout@v7
26
+ with:
27
+ persist-credentials: false
28
+ - name: Install uv and set the python version
29
+ uses: astral-sh/setup-uv@v10.0.1
30
+ with:
31
+ python-version: "3.14"
32
+ enable-cache: true
33
+ - name: Type check with tox
34
+ env:
35
+ # render diagnostics as GitHub Actions workflow annotations
36
+ TY_OUTPUT_FORMAT: github
37
+ run:
38
+ uvx --with tox-uv tox -e ty
@@ -0,0 +1,34 @@
1
+ # python
2
+ __pycache__/
3
+ *.pyc
4
+
5
+ # packaging artifacts (hatchling builds into dist/)
6
+ dist/
7
+ *.egg-info/
8
+
9
+ # environments, tool caches
10
+ .venv/
11
+ .tox/
12
+ .pytest_cache/
13
+ .ruff_cache/
14
+ .coverage
15
+ coverage.xml
16
+ # build cache of zensical
17
+ .cache/
18
+
19
+ # rendered documentation, built by the `documentation` workflow
20
+ site/
21
+
22
+ # the lock file is not committed, pkpdutils is a library and pins nothing
23
+ uv.lock
24
+
25
+ # output of the examples, they write into the working directory
26
+ examples/**/results/
27
+ /results/
28
+
29
+ # editors, operating system
30
+ .idea/
31
+ .vscode/
32
+ *~
33
+ .DS_Store
34
+ .ipynb_checkpoints/