Skip to content

Commit cae6cfb

Browse files
Merge pull request #568 from ICB-DCM/develop
Release 0.12.4
2 parents 9474075 + 3732d37 commit cae6cfb

9 files changed

+54
-20
lines changed

.flake8

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ per-file-ignores =
1616
# Imported but unused
1717
*/__init__.py:F401
1818
# Print
19-
*/cli.py:T001
20-
pyabc/storage/migrate.py:T001
19+
*/cli.py:T201
20+
pyabc/storage/migrate.py:T201
2121
# Print and asserts
22-
test*/*.py:T001,S101
22+
test*/*.py:T201,S101
2323
# Module level import not at top of file
2424
test/external/test_pyjulia.py:E402

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
repos:
1313
- repo: https://github.com/psf/black
14-
rev: 22.1.0
14+
rev: 22.3.0
1515
hooks:
1616
- id: black
1717
description: The uncompromising code formatter
@@ -34,7 +34,7 @@ repos:
3434
args: [--py36-plus]
3535
- id: nbqa-isort
3636
- repo: https://github.com/pre-commit/pre-commit-hooks
37-
rev: v3.2.0
37+
rev: v4.2.0
3838
hooks:
3939
- id: check-yaml
4040
description: Check yaml files for parseable syntax

CHANGELOG.rst

+10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ Release Notes
88
...........
99

1010

11+
0.12.4 (2022-05-05)
12+
-------------------
13+
14+
Minor:
15+
16+
* Move near-zero population weight to warning (#563)
17+
* Improve test installation instructions;
18+
fix for updates of flake8-print and black (#567)
19+
20+
1121
0.12.3 (2022-04-05)
1222
-------------------
1323

CONTRIBUTE.rst

+24-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ get your work merged, please:
1919
3. check that the documentation is up-to-date,
2020
4. request a code review from the main developers.
2121

22+
.. _environment:
23+
2224
Environment
2325
-----------
2426

@@ -30,8 +32,8 @@ via::
3032
Pre-commit hooks
3133
~~~~~~~~~~~~~~~~
3234

33-
Firstly, this installs a `pre-commit <https://pre-commit.com/>`_ tool.
34-
To add those hooks to the `.git` folder of your local clone such that they are
35+
First, this installs a `pre-commit <https://pre-commit.com/>`_ tool.
36+
To add those hooks to the ``.git`` folder of your local clone such that they are
3537
run on every commit, run::
3638

3739
pre-commit install
@@ -43,7 +45,7 @@ once as usually only the diff is checked. The configuration is specified in
4345
Tox
4446
~~~
4547

46-
Secondly, this installs the virtual testing tool
48+
Second, this installs the virtual testing tool
4749
`tox <https://tox.readthedocs.io/en/latest/>`_, which we use for all tests,
4850
format and quality checks. Its configuration is specified in ``tox.ini``.
4951
To run it locally, simply execute::
@@ -53,6 +55,15 @@ To run it locally, simply execute::
5355
with optional ``-e`` options specifying the environments to run, see
5456
``tox.ini`` for details.
5557

58+
Extra dependencies
59+
~~~~~~~~~~~~~~~~~~
60+
61+
Not all dependencies in particular of tests and documentation are managed via
62+
tox, e.g. installations of R and Julia, pandoc, and AMICI dependencies.
63+
To set these up locally, see e.g. ``.github/workflows/ci.yml`` and
64+
``.github/workflows/install_deps.sh`` (which can also be invoked locally)
65+
on how these are installed on GitHub Actions.
66+
5667
GitHub Actions
5768
~~~~~~~~~~~~~~
5869

@@ -79,7 +90,8 @@ and then compile the documentation via::
7990

8091
The documentation is then under ``doc/_build``.
8192

82-
Alternatively, the documentation can be compiled and tested via a single line::
93+
Alternatively, the documentation can be compiled and tested via a single
94+
command::
8395

8496
tox -e doc
8597

@@ -101,11 +113,17 @@ Run them locally via e.g.::
101113
tox -e base
102114

103115
with ``base`` covering basic tests, but some parts (``external,petab,...``)
104-
being in separate subfolders. This boils mostly down to e.g.::
116+
are in separate subfolders.
117+
Some dependencies are not managed via tox, see the above
118+
:ref:`environment` section.
119+
120+
Tox basically mostly executes pytest on subsets of the tests, e.g.::
105121

106122
pytest test/base
107123

108-
You can also run only specific tests.
124+
pytest (install via ``pip install pytest``) can also be invoked directly
125+
like this, but may then require various further dependencies,
126+
see the environments in ``tox.ini``.
109127

110128
Unit tests can be written with `pytest <https://docs.pytest.org/en/latest/>`_
111129
or `unittest <https://docs.python.org/3/library/unittest.html>`_.

pyabc/population.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,13 @@ def normalize_weights(self):
413413
weights by the same factor ensures that weights stay comparable.
414414
"""
415415
total_weight_accepted = sum(p.weight for p in self.accepted_particles)
416-
if np.isclose(total_weight_accepted, 0):
416+
417+
if np.isclose(total_weight_accepted, 0.0):
418+
logger.warning(
419+
f"The total population weight {total_weight_accepted} is "
420+
"close to zero, which can be numerically problematic"
421+
)
422+
if total_weight_accepted == 0.0:
417423
raise AssertionError("The total population weight is zero")
418424
for p in self.all_particles:
419425
p.weight /= total_weight_accepted

pyabc/sge/db.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def wait_for_job(self, ID, max_run_time_h):
6464
job_start_time = results[0][1]
6565
# job took to long
6666
if not within_time(job_start_time, max_run_time_h):
67-
print('Job ' + str(ID) + ' timed out.') # noqa: T001
67+
print('Job ' + str(ID) + ' timed out.') # noqa: T201
6868
return False # job took too long
6969
else: # still time left
7070
return True

pyabc/sge/test_sge.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ def f(x):
88
sleep(30)
99
return x * 2
1010

11-
print("Start sge test", flush=True) # noqa: T001
11+
print("Start sge test", flush=True) # noqa: T201
1212
sge = SGE(priority=0, memory="1G", name="test", time_h=1)
1313

14-
print("Do map", flush=True) # noqa: T001
14+
print("Do map", flush=True) # noqa: T201
1515
res = sge.map(f, [1, 2, 3, 4])
1616

17-
print("Got results", flush=True) # noqa: T001
17+
print("Got results", flush=True) # noqa: T201
1818
if res != [2, 4, 6, 8]:
1919
raise AssertionError("Wrong result, got {}".format(res))
2020

21-
print("Finished", flush=True) # noqa: T001
21+
print("Finished", flush=True) # noqa: T201

pyabc/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.12.3'
1+
__version__ = '0.12.4'

tox.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ skip_install = true
150150
deps =
151151
# TODO unfix when bandit dep fixed
152152
bandit < 1.7.3
153-
black >= 22.1.0
153+
black >= 22.3.0
154154
flake8 >= 3.8.3
155155
flake8-bandit >= 2.1.2
156156
flake8-bugbear >= 20.1.4
157157
flake8-colors >= 0.1.6
158158
#flake8-commas >= 2.0.0
159159
flake8-comprehensions >= 3.2.3
160-
flake8-print >= 3.1.4
160+
flake8-print >= 5.0.0
161161
flake8-black >= 0.2.3
162162
flake8-isort >= 4.0.0
163163
# flake8-docstrings >= 1.5.0

0 commit comments

Comments
 (0)