Skip to content

Commit 65178c5

Browse files
authored
Merge pull request #101 from lycosystem/release-1.3.4
Release 1.3.4
2 parents 80193e7 + c199090 commit 65178c5

19 files changed

+2473
-115
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and release Python package on PyPI
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
name: Build package from source
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
persist-credentials: false
18+
fetch-depth: 0
19+
- name: Install Python 3
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.10'
23+
- name: Install build tools
24+
run: |
25+
python3 -m pip install build --user
26+
- name: Build package
27+
run: |
28+
python3 -m build
29+
- name: Upload to CI runner
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: built-package
33+
path: dist/
34+
35+
pypi-publish:
36+
name: Publish built package on PyPI
37+
runs-on: ubuntu-latest
38+
needs:
39+
- build
40+
41+
# Specifying a GitHub environment is optional, but strongly encouraged
42+
environment:
43+
name: pypi
44+
url: https://pypi.org/p/lymph-model
45+
permissions:
46+
# IMPORTANT: this permission is mandatory for Trusted Publishing
47+
id-token: write
48+
steps:
49+
# retrieve your distributions here
50+
- name: Download from CI runner
51+
uses: actions/download-artifact@v4
52+
with:
53+
name: built-package
54+
path: dist/
55+
- name: Publish on PyPI
56+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/testpypi.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build and release Python package on TestPyPI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
name: Build package from source
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false
19+
fetch-depth: 0
20+
- name: Install Python 3
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.10'
24+
- name: Install build tools
25+
run: |
26+
python3 -m pip install build --user
27+
- name: Build package
28+
run: |
29+
python3 -m build
30+
- name: Upload to CI runner
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: built-package
34+
path: dist/
35+
36+
testpypi-publish:
37+
name: Publish built package on TestPyPI
38+
runs-on: ubuntu-latest
39+
needs:
40+
- build
41+
42+
# Specifying a GitHub environment is optional, but strongly encouraged
43+
environment:
44+
name: testpypi
45+
url: https://test.pypi.org/p/lymph-model
46+
permissions:
47+
# IMPORTANT: this permission is mandatory for Trusted Publishing
48+
id-token: write
49+
steps:
50+
# retrieve your distributions here
51+
- name: Download from CI runner
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: built-package
55+
path: dist/
56+
- name: Publish on PyPI
57+
uses: pypa/gh-action-pypi-publish@release/v1
58+
with:
59+
repository-url: https://test.pypi.org/legacy/

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,46 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.3.4] - 2025-05-27
6+
7+
### Bug Fixes
8+
9+
- Don't use `or` when param may be 0.\
10+
Since Python's expression `a = b or c` will assign `c` to `a` as soon as
11+
`b` is "falsy", e.g. also when `b = 0.0`, I should not use this to check
12+
if a parameter in the model is `None`.
13+
14+
### Documentation
15+
16+
- Fix misspelled repo link.
17+
- Remove empty mixins page.
18+
- Better reuse of README.
19+
- Move social card to repo root.\
20+
This is actually for LyProX: I want to display the social card of all
21+
repos in the lycosystem on LyProX's landing page. Therefore, they all
22+
need to be in their expected places.
23+
24+
### Miscellaneous Tasks
25+
26+
- Add year range to license.
27+
28+
### Testing
29+
30+
- Use val != 0.5 to test matrix deletion.\
31+
0.5 is the new initial value for most parameters, so it does not make
32+
sense to use this to check if upon changing a parameter, the transition
33+
matrix gets deleted.
34+
35+
### Change
36+
37+
- Init most params with 0.5 instead of 0.0.\
38+
In some cases, initializing with 0.0 may have unintended consequences.
39+
E.g., a probability of 0.0 cannot be renormalized.
40+
41+
### Ci
42+
43+
- Use OIDC for publishing.
44+
545
## [1.3.3] - 2025-03-11
646

747
### Bug Fixes
@@ -866,6 +906,7 @@ Almost the entire API has changed. I'd therefore recommend to have a look at the
866906
- fix pyproject.toml typo
867907
- add pre-commit hook to check commit msg
868908

909+
[1.3.4]: https://github.com/rmnldwg/lymph/compare/1.3.3...1.3.4
869910
[1.3.3]: https://github.com/rmnldwg/lymph/compare/1.3.2...1.3.3
870911
[1.3.2]: https://github.com/rmnldwg/lymph/compare/1.3.1...1.3.2
871912
[1.3.1]: https://github.com/rmnldwg/lymph/compare/1.3.0...1.3.1

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2020 Roman Ludwig & contributors
1+
Copyright (c) 2020 - 2025 Roman Ludwig & contributors
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal
@@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1616
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1717
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1818
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19-
SOFTWARE.
19+
SOFTWARE.

README.rst

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -68,34 +68,7 @@ LyProX interface
6868

6969
The above mentioned data can also be explored interactively using our online interface `LyProX <https://lyprox.org>`_ `(GitHub repo) <https://github.com/rmnldwg/lyprox>`_.
7070

71-
72-
73-
74-
75-
76-
77-
78-
79-
80-
81-
82-
83-
84-
85-
86-
87-
88-
89-
90-
91-
92-
93-
94-
95-
96-
97-
98-
71+
.. SEPARATOR
9972
10073
References
10174
==========

docs/source/api.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ Detailed API
77

88
graph
99
models
10-
mixins
1110
components
1211
types
1312
utils
14-
15-
16-
Index & search
17-
--------------
18-
19-
* :ref:`genindex`
20-
* :ref:`search`

docs/source/badges.rst

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/source/explanation.rst

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/source/index.rst

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
.. image:: ./_static/github-social-card.png
2-
:width: 800 px
3-
4-
.. include:: badges.rst
5-
6-
----
7-
8-
.. include:: explanation.rst
1+
.. include:: ../../README.rst
2+
:end-before: .. SEPARATOR
93

104
----
115

@@ -15,20 +9,13 @@ Documentation
159

1610
.. toctree::
1711
:maxdepth: 3
18-
:caption: Content
1912

2013
install
2114
quickstart
2215
api
2316
license
2417

25-
26-
Index & search
27-
--------------
28-
29-
* :ref:`genindex`
30-
* :ref:`search`
31-
3218
----
3319

34-
.. include:: refs.rst
20+
.. include:: ../../README.rst
21+
:start-after: .. SEPARATOR

docs/source/mixins.rst

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/source/refs.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.
File renamed without changes.

lymph/diagnosis_times.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,10 @@ def set_params(self, *args: float, **kwargs: float) -> tuple[float]:
247247

248248
for name, value in self._func.keywords.items():
249249
first, args = popfirst(args)
250-
self._func.keywords[name] = first or kwargs.get(name, value)
250+
if first is not None:
251+
self._func.keywords[name] = first
252+
else:
253+
self._func.keywords[name] = kwargs.get(name, value)
251254
if hasattr(self, "_frozen"):
252255
del self._frozen
253256

lymph/graph.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def __init__(
221221
self,
222222
parent: Tumor | LymphNodeLevel,
223223
child: LymphNodeLevel,
224-
spread_prob: float = 0.0,
224+
spread_prob: float = 0.5,
225225
micro_mod: float = 1.0,
226226
) -> None:
227227
"""Create a new edge between two nodes.
@@ -362,7 +362,7 @@ def set_micro_mod(self, new_micro_mod: float | None) -> None:
362362
def get_spread_prob(self) -> float:
363363
"""Return the spread probability."""
364364
if not hasattr(self, "_spread_prob"):
365-
self._spread_prob = 0.0
365+
self._spread_prob = 0.5
366366
return self._spread_prob
367367

368368
def set_spread_prob(self, new_spread_prob: float | None) -> None:
@@ -433,7 +433,7 @@ def set_params(self, *args, **kwargs) -> tuple[float]:
433433
0.4
434434
"""
435435
first, args = popfirst(args)
436-
value = first or self.get_spread_prob()
436+
value = first if first is not None else self.get_spread_prob()
437437

438438
if self.is_growth:
439439
self.set_spread_prob(kwargs.get("growth", value))
@@ -446,7 +446,7 @@ def set_params(self, *args, **kwargs) -> tuple[float]:
446446
and not self.is_growth
447447
):
448448
first, args = popfirst(args)
449-
value = first or self.get_micro_mod()
449+
value = first if first is not None else self.get_micro_mod()
450450
self.set_micro_mod(kwargs.get("micro", value))
451451

452452
return args

lymph/models/midline.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ def __init__(
147147
other_children["unknown"] = self.unknown
148148

149149
if use_mixing:
150-
self.mixing_param = 0.0
150+
self.mixing_param = 0.5
151151

152-
self.midext_prob = 0.0
152+
self.midext_prob = 0.5
153153

154154
diagnosis_times.Composite.__init__(
155155
self,
@@ -489,7 +489,9 @@ def set_params(
489489
"""
490490
last_param_idx = self.get_num_dims() - 1
491491
before, last, after = utils.popat(args, idx=last_param_idx)
492-
self.midext_prob = kwargs.get("midext_prob", last) or self.midext_prob
492+
if kwargs.get("midext_prob", last) is not None:
493+
self.midext_prob = kwargs.get("midext_prob", last)
494+
493495
args = self.set_spread_params(*(before + after), **kwargs)
494496
return self.set_distribution_params(*args, **kwargs)
495497

0 commit comments

Comments
 (0)