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

FTBFS with Python 3.13 #163

Closed
olebole opened this issue Sep 14, 2024 · 6 comments · Fixed by #164
Closed

FTBFS with Python 3.13 #163

olebole opened this issue Sep 14, 2024 · 6 comments · Fixed by #164
Labels

Comments

@olebole
Copy link
Contributor

olebole commented Sep 14, 2024

Forwarding Debian#1082695 (for PyRAF), which I also filed as iraf-community/pyraf#175. This is probably relevant for stsci.tools, as the code was imported from here:

This package failed build from source when test-built against a version of python3-defaults that includes 3.13 as a supported version.

To reproduce this issue, build against python3-defaults (python3-all-dev etc.) from Debian experimental.

What's new in Python 3.13:
https://docs.python.org/3.13/whatsnew/3.13.html

Log snippet:

   dh_auto_test -a -O--buildsystem=pybuild
I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_pyraf/build; python3.13 -m pytest 
tput: No value for $TERM and no -T specified
============================= test session starts ==============================
platform linux -- Python 3.13.0rc2, pytest-8.3.2, pluggy-1.5.0
rootdir: /<<PKGBUILDDIR>>
configfile: setup.cfg
plugins: filter-subpackage-0.2.0, cov-5.0.0, doctestplus-1.2.1, astropy-header-0.2.2, astropy-0.11.0, hypothesis-6.112.0, mock-3.14.0, arraydiff-0.6.1, remotedata-0.4.1, typeguard-4.3.0

No graphics display available for this session.
Graphics tasks that attempt to plot to an interactive screen will fail.
For help, search "PyRAF FAQ 5.13"

Created directory /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_pyraf/.iraf/pyraf for cache
collected 404 items

pyraf/tests/test_basic.py ....
pyraf/tests/test_clcache.py .
pyraf/tests/test_cli.py ..........................................................................................................................................................................................
pyraf/tests/test_core_nongraphics.py .....................x..
pyraf/tests/test_graphics.py ..........s
pyraf/tests/test_invocation.py ........................x........x........ssss..s
pyraf/tests/test_plot.py ssssssssssssssssssssssssssss
pyraf/tests/test_tasks.py .........................................................
pyraf/tests/test_using_tasks.py sssssss
pyraf/tools/tests/test_cfgobj.py .
pyraf/tools/tests/test_compmixin.py .F..
pyraf/tools/tests/test_irafutils.py .............
pyraf/tools/tests/test_minmatch.py ...................

=================================== FAILURES ===================================
_________________________________ test_AnyType _________________________________

    def test_AnyType():
        x = AnyType('x')
        y = AnyType('yyy')
        z = AnyType(0)
        nn = AnyType(None)
    
        # compare two AnyType objects
        assert str(x > y) == "False"
        assert str(x < y) == "True"
        assert str(x <= y) == "True"
        assert str(x == y) == "False"
        assert str(y == y) == "True"
        assert str(x < z) == "False"
        assert str(x <= z) == "False"
        assert str(x > z) == "True"
        assert str(x != z) == "True"
        assert str(z != z) == "False"
        assert str(z == z) == "True"
        assert str(y < nn) == "False"
        assert str(y >= nn) == "True"
        assert str(y == nn) == "False"
        assert str(nn == nn) == "True"
>       assert str([str(jj) for jj in sorted([y, x, nn, z])]
                   ) == "['None', '0', 'x', 'yyy']"

pyraf/tools/tests/test_compmixin.py:97: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyraf/tools/compmixin.py:33: in __lt__
    return self._compare(other, lambda s,o: s < o)
pyraf/tools/tests/test_compmixin.py:30: in _compare
    return self._compare(other.val, method)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pyraf.tools.tests.test_compmixin.AnyType object at 0xffff83a86650>
other = 0
method = <function ComparableMixin.__lt__.<locals>.<lambda> at 0xffff836918a0>

    def _compare(self, other, method):
        if isinstance(other, self.__class__):
            # recurse, get 2 logic below
            return self._compare(other.val, method)
        if isinstance(other, str):
            return method(str(self.val), other)
        elif other is None and self.val is None:
            return method(0, 0)
        elif other is None:
            # coerce to str compare
            return method(str(self.val), '')
        elif isinstance(other, int):
            # handle ONLY case where self.val is a single char or an int
            if isinstance(self.val, str) and len(self.val) == 1:
                return method(ord(self.val), other)
            else:
                # assume we are int-like
>               return method(int(self.val), other)
E               TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

pyraf/tools/tests/test_compmixin.py:44: TypeError
=============================== warnings summary ===============================
pyraf/iraffunctions.py:96
  /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_pyraf/build/pyraf/iraffunctions.py:96: DeprecationWarning: finfo() dtype cannot be None. This behavior will raise an error in the future. (Deprecated in NumPy 1.25)
    FP_EPSILON = _numpy.finfo(None).eps

.pybuild/cpython3_3.13_pyraf/build/pyraf/tools/tests/test_minmatch.py::test_getall
  /usr/lib/python3/dist-packages/_pytest/python.py:163: PytestReturnNotNoneWarning: Expected None, but .pybuild/cpython3_3.13_pyraf/build/pyraf/tools/tests/test_minmatch.py::test_getall returned [1, 2, 10], which will be an error in a future version of pytest.  Did you mean to use `assert` instead of `return`?
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED pyraf/tools/tests/test_compmixin.py::test_AnyType - TypeError: int() a...
====== 1 failed, 359 passed, 41 skipped, 3 xfailed, 2 warnings in 42.48s =======
could not open XWindow display
could not open XWindow display
E: pybuild pybuild:389: test: plugin distutils failed with: exit code=1: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_pyraf/build; python3.13 -m pytest 
I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pyraf/build; python3.12 -m pytest 
tput: No value for $TERM and no -T specified
============================= test session starts ==============================
platform linux -- Python 3.12.6, pytest-8.3.2, pluggy-1.5.0
rootdir: /<<PKGBUILDDIR>>
configfile: setup.cfg
plugins: filter-subpackage-0.2.0, cov-5.0.0, doctestplus-1.2.1, astropy-header-0.2.2, astropy-0.11.0, hypothesis-6.112.0, mock-3.14.0, arraydiff-0.6.1, remotedata-0.4.1, typeguard-4.3.0

No graphics display available for this session.
Graphics tasks that attempt to plot to an interactive screen will fail.
For help, search "PyRAF FAQ 5.13"

Created directory /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pyraf/.iraf/pyraf for cache
collected 404 items

pyraf/tests/test_basic.py ....
pyraf/tests/test_clcache.py .
pyraf/tests/test_cli.py ..........................................................................................................................................................................................
pyraf/tests/test_core_nongraphics.py .....................x..
pyraf/tests/test_graphics.py ..........s
pyraf/tests/test_invocation.py ........................x........x........ssss..s
pyraf/tests/test_plot.py ssssssssssssssssssssssssssss
pyraf/tests/test_tasks.py .........................................................
pyraf/tests/test_using_tasks.py sssssss
pyraf/tools/tests/test_cfgobj.py .
pyraf/tools/tests/test_compmixin.py ....
pyraf/tools/tests/test_irafutils.py .............
pyraf/tools/tests/test_minmatch.py ...................

=============================== warnings summary ===============================
pyraf/iraffunctions.py:96
  /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pyraf/build/pyraf/iraffunctions.py:96: DeprecationWarning: finfo() dtype cannot be None. This behavior will raise an error in the future. (Deprecated in NumPy 1.25)
    FP_EPSILON = _numpy.finfo(None).eps

.pybuild/cpython3_3.12_pyraf/build/pyraf/tools/tests/test_minmatch.py::test_getall
  /usr/lib/python3/dist-packages/_pytest/python.py:163: PytestReturnNotNoneWarning: Expected None, but .pybuild/cpython3_3.12_pyraf/build/pyraf/tools/tests/test_minmatch.py::test_getall returned [1, 2, 10], which will be an error in a future version of pytest.  Did you mean to use `assert` instead of `return`?
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========== 360 passed, 41 skipped, 3 xfailed, 2 warnings in 38.40s ============
could not open XWindow display
could not open XWindow display
dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p "3.13 3.12" returned exit code 13
make: *** [debian/rules:7: binary-arch] Error 25
dpkg-buildpackage: error: debian/rules binary-arch subprocess returned exit status 2
--------------------------------------------------------------------------------
Build finished at 2024-09-13T20:31:05Z

If required, the full build log is available here (for the next 30 days):
https://debusine.debian.net/artifact/712814/

This bug has been filed at "normal" severity, as we haven't started the transition to add 3.13 as a supported version, yet. This will be raised to RC as soon as that happens, hopefully well before trixie.

Thanks,

Stefano

@olebole olebole added the bug label Sep 14, 2024
@pllim
Copy link
Contributor

pllim commented Sep 16, 2024

Thanks for the heads up, @olebole ! I switched the predeps job to use Python 3.13 and indeed I see the same error: https://github.com/spacetelescope/stsci.tools/actions/runs/10885318193/job/30202634692

At a glance, I cannot tell if it is just a ill-written test or actual incompatibility in the code.

@pllim
Copy link
Contributor

pllim commented Sep 16, 2024

I think it is just a bug in the test code. Are you satisfied with the proposed patch in #164 ?

@olebole
Copy link
Contributor Author

olebole commented Sep 16, 2024

Whow, that was quick! Yes, that is OK for me. I will take this over in PyRAF.

@pllim
Copy link
Contributor

pllim commented Sep 16, 2024

Great! Do you also need a new release here?

@olebole
Copy link
Contributor Author

olebole commented Sep 16, 2024

No; I removed the dependecny from stsci.tools a while ago and copied the relevant files into PyRAF because only a few files were needed anyway and PyRAF support isn't on STScI's agenda anymore. So, I will just take over the change into PyRAF. Thank you for the fix!

@pllim
Copy link
Contributor

pllim commented Sep 16, 2024

Sounds good. Glad to help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants