scikit-hep / cabinetry

design and steer profile likelihood fits
https://cabinetry.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
27 stars 21 forks source link

fix: raise minimum Python version for type checking to 3.9 #416

Closed alexander-held closed 1 year ago

alexander-held commented 1 year ago

The latest version of numpy, 1.25.0, dropped compatibility with Python 3.8. When using mypy on cabinetry with Python 3.8 and the settings from the pyproject.toml, this results in errors getting raised in cabinetry. An example is the following:

import numpy as np

a = np.asarray([1, 2, 3])
b = a.copy()
c = a.copy().astype(float)
d: np.ndarray = a.copy().astype(float)

resulting in

test.py:5: error: Need type annotation for "c"  [var-annotated]
    c = a.copy().astype(float)
        ^~~~~~~~~~~~~~~~~~~~~~
Found 1 error in 1 file (checked 1 source file)

This is addressed here by raising the minimum Python version for the type checks being performed to Python 3.9.

* raise minimum Python version for mypy to Python 3.9 for compatibility with numpy 1.25.0
codecov[bot] commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (b1c4c40) 100.00% compared to head (fc6a688) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #416 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 22 22 Lines 2069 2069 Branches 334 334 ========================================= Hits 2069 2069 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.