Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHA: test python3.12 #2179

Merged
merged 17 commits into from
Dec 18, 2023
Merged

GHA: test python3.12 #2179

merged 17 commits into from
Dec 18, 2023

Conversation

dweindl
Copy link
Member

@dweindl dweindl commented Oct 18, 2023

Run nightly tests also on python3.12

Waiting for

@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Merging #2179 (00aae73) into develop (594b07e) will increase coverage by 0.00%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop    #2179    +/-   ##
=========================================
  Coverage    76.64%   76.65%            
=========================================
  Files           91       91            
  Lines        15112    14998   -114     
=========================================
- Hits         11583    11497    -86     
+ Misses        3529     3501    -28     
Flag Coverage Δ
cpp 73.11% <ø> (ø)
cpp_python 37.08% <ø> (ø)
petab 53.74% <ø> (-0.04%) ⬇️
python 78.00% <ø> (+0.55%) ⬆️
sbmlsuite ?

Flags with carried forward coverage won't be shown. Click here to find out more.

see 8 files with indirect coverage changes

@dweindl
Copy link
Member Author

dweindl commented Oct 18, 2023

@FFroehlich Can you please rebase https://github.com/FFroehlich/pysb/tree/fix_pattern_matching onto the latest pysb? In the current state it's not installable with python3.12.

Details

https://github.com/AMICI-dev/AMICI/actions/runs/6564520748/job/17831043835:

Collecting git+https://github.com/FFroehlich/pysb@fix_pattern_matching
  Cloning https://github.com/FFroehlich/pysb (to revision fix_pattern_matching) to /tmp/pip-req-build-5o91yuil
  Running command git clone --filter=blob:none --quiet https://github.com/FFroehlich/pysb /tmp/pip-req-build-5o91yuil
  Running command git checkout -b fix_pattern_matching --track origin/fix_pattern_matching
  Switched to a new branch 'fix_pattern_matching'
  branch 'fix_pattern_matching' set up to track 'origin/fix_pattern_matching'.
  Resolved https://github.com/FFroehlich/pysb to commit c400f1c49fc2f59b153b64e0a86e0e6886bedb41
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      /tmp/pip-req-build-5o91yuil/versioneer.py:467: SyntaxWarning: invalid escape sequence '\s'
        LONG_VERSION_PY['git'] = '''
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-req-build-5o91yuil/setup.py", line 53, in <module>
          main()
        File "/tmp/pip-req-build-5o91yuil/setup.py", line 16, in main
          version=versioneer.get_version(),
                  ^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-req-build-5o91yuil/versioneer.py", line 1405, in get_version
          return get_versions()["version"]
                 ^^^^^^^^^^^^^^
        File "/tmp/pip-req-build-5o91yuil/versioneer.py", line 1339, in get_versions
          cfg = get_config_from_root(root)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-req-build-5o91yuil/versioneer.py", line 399, in get_config_from_root
          parser = configparser.SafeConfigParser()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
      [end of output]

@FFroehlich
Copy link
Member

done, also bumping up getting that branch merged on my todo list

@dweindl
Copy link
Member Author

dweindl commented Oct 23, 2023

Generally works. Some sympy DeprecationWarnings (see also sympy/sympy#25837), one of them causing a BnglImportError (https://github.com/AMICI-dev/AMICI/actions/runs/6609653584/job/17950132739):

FAILED python/tests/test_bngl.py::test_compare_to_pysb_simulation[CaOscillate_Func] - DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_bngl.py::test_compare_to_pysb_simulation[gene_expr] - DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_bngl.py::test_compare_to_pysb_simulation[gene_expr_func] - DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_bngl.py::test_compare_to_pysb_simulation[gene_expr_simple] - DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_bngl.py::test_compare_to_pysb_simulation[Motivating_example_cBNGL] - DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_bngl.py::test_compare_to_pysb_simulation[motor] - pysb.importers.bngl.BnglImportError: Could not parse expression kPlus:  w*exp(((g1/2.0)*((1.0/2.0)-((CheYp/((cellVolume*_Na)*(10^-6)))/(Kd+(CheYp/((cellVolume*_Na)*(10^-6)))))))) 

Error: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_bngl.py::test_compare_to_pysb_simulation[test_setconc] - DeprecationWarning: ast.Num is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_bngl.py::test_compare_to_pysb_simulation[Repressilator] - DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_bngl.py::test_compare_to_pysb_simulation[test_paramname] - DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_pysb.py::test_compare_to_pysb_simulation[localfunc] - DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_pysb.py::test_energy - DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_splines_short.py::test_spline_piecewise - DeprecationWarning: ast.Num is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_splines_short.py::test_two_splines - DeprecationWarning: ast.Num is deprecated and will be removed in Python 3.14; use ast.Constant instead
FAILED python/tests/test_splines_short.py::test_splines_plist - DeprecationWarning: ast.Num is deprecated and will be removed in Python 3.14; use ast.Constant instead

@dweindl dweindl self-assigned this Nov 1, 2023
dweindl added a commit that referenced this pull request Nov 3, 2023
We had to require setuptools<64 because it change its temporary build directory from a known path to a randomly named temporary directory. However, setuptools<64 doesn't work with for Python3.12 (#2179). Therefore, this adds an option to change the setuptools temporary build directory via the `AMICI_BUILD_TEMP` environment variable, so we have those temp files in a known path for coverage analysis. Not meant to be used by users.
@dweindl
Copy link
Member Author

dweindl commented Dec 14, 2023

PySB is currently restricts sympy to <1.12 pysb/pysb@e83937c

@dweindl
Copy link
Member Author

dweindl commented Dec 14, 2023

@dweindl dweindl marked this pull request as ready for review December 14, 2023 22:09
@dweindl dweindl requested a review from a team as a code owner December 14, 2023 22:09
Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
Member

@FFroehlich FFroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dweindl dweindl merged commit 5ba5821 into develop Dec 18, 2023
34 checks passed
@dweindl dweindl deleted the py312 branch December 18, 2023 13:22
dweindl added a commit to dweindl/AMICI that referenced this pull request Dec 18, 2023
Run nightly tests also on python3.12
dweindl added a commit that referenced this pull request Dec 18, 2023
Improves model code generation by collapsing cases with identical statements.

I.e.
```
switch(a)
 case b:
 case c:
  statements;
  break;
```
instead of

```
switch(a)
 case b:
  statements;
  break;
 case c:
  statements;
  break;
```

For my current model of interest, containing many events, this significantly reduces the generated code:

E.g.:
```
 16K my_model/deltasx.cpp
6,6M my_model_old/deltasx.cpp
```

Overall, for this model, I got from 204201 LOC down to 7936 LOC (i.e. -96%).

* ..

* Apply suggestions from code review

Co-authored-by: Dilan Pathirana <[email protected]>

* GHA: test python3.12 (#2179)

Run nightly tests also on python3.12

* Deterministic order of event assignments (#2242)

Ensure event assignments targets are processed in deterministic order.
Otherwise the ordering of state variables may change between subsequent
model imports, which we'd like to avoid.

Closes #2241.

* Fix AMICI hiding all warnings (#2243)

Previously, importing amici would result in all warnings of the program being hidden, due to `logging.captureWarnings(True)`:

```sh
$ python -c "import warnings; warnings.warn('bla');"
<string>:1: UserWarning: bla
$ python -c "import amici; import warnings; warnings.warn('bla');"
$
```

This can't be the desired default.

Changes:
* Default to not capturing warnings
* If warnings are to be captured, at least handle them by amici loggers

Closes ICB-DCM/pyPESTO#1252


---------

Co-authored-by: Dilan Pathirana <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants