OMS-NetZero / FAIR

Finite-amplitude Impulse Response simple climate model
https://docs.fairmodel.net
Apache License 2.0
120 stars 61 forks source link

Add py3.12 CI and support #140

Closed chrisroadmap closed 3 days ago

chrisroadmap commented 7 months ago

py3.12 at the moment does not seem to be compatible with tqdm and possibly xarray

known issue: https://github.com/tqdm/tqdm/issues/1517

output failing test in fair with py3.12:

___________________________ test_run_runtime_warning ___________________________

    def test_run_runtime_warning():
        # need to run stochastic (to trigger the problem in the first place) and at a
        # big enough time step to trigger the warning but not too big, else the matrix
        # really is wrong. Doesn't seem the most robust test to future scipy whims.
        ftest = minimal_ghg_run(stochastic_run=True, timestep=27)
        # I want a warning (Idlewild; 2005)
        with pytest.warns(RuntimeWarning):
            ftest.run(suppress_warnings=False)
        # I don't want a warning
        with warnings.catch_warnings():
            warnings.simplefilter("error")
>           ftest.run(suppress_warnings=True)

tests/unit_tests/fair_test.py:241: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/fair/fair.py:1555: in run
    for i_timepoint in tqdm(
venv/lib/python3.12/site-packages/tqdm/asyncio.py:24: in __init__
    super(tqdm_asyncio, self).__init__(iterable, *args, **kwargs)
venv/lib/python3.12/site-packages/tqdm/std.py:1099: in __init__
    self.refresh(lock_args=self.lock_args)
venv/lib/python3.12/site-packages/tqdm/std.py:1348: in refresh
    self.display()
venv/lib/python3.12/site-packages/tqdm/std.py:1496: in display
    self.sp(self.__str__() if msg is None else msg)
venv/lib/python3.12/site-packages/tqdm/std.py:1152: in __str__
    return self.format_meter(**self.format_dict)

On hold until tdqm is updated.

chrisroadmap commented 3 days ago

Now fixed by #153 and merged into master.