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

Change in Python3.10 from collections.Callable to collections.abc.Callable #1122

Open
CarloCogni opened this issue Mar 25, 2022 · 7 comments

Comments

@CarloCogni
Copy link

As of Python 3.10, collections.Callable as been replaced with collections.abs.Callable.

This will make nose crash with an AttributeError.

@EwoutH
Copy link

EwoutH commented May 2, 2022

I'm encountering the same problem here in our CI setup.

@CarloCogni
Copy link
Author

@EwoutH, I just changed the code in the installed package (perhaps not elegant, but simple and quick)

matthewhughes934 added a commit to matthewhughes934/pystatsd that referenced this issue Jul 8, 2022
Drop support for pythons <3.7 (including python 2).

Since this makes it part of the standard library, replace `mock` with
`unittest.mock` in tests.

This also required replacing `nose` with `pytest` in tests This is
because `nose` is not under active development[1], and the version
specified fails to run on python3 (and newer versions fail to run on
python3.10[2]):

    $ python -m nose
    Traceback (most recent call last):
      File "/usr/lib/python3.10/runpy.py", line 187, in _run_module_as_main
        mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
      File "/usr/lib/python3.10/runpy.py", line 146, in _get_module_details
        return _get_module_details(pkg_main_name, error)
      File "/usr/lib/python3.10/runpy.py", line 110, in _get_module_details
        __import__(pkg_name)
      File "/home/mjh/src/pystatsd/.venv/lib/python3.10/site-packages/nose/__init__.py", line 1, in <module>
        from nose.core import collector, main, run, run_exit, runmodule
      File "/home/mjh/src/pystatsd/.venv/lib/python3.10/site-packages/nose/core.py", line 143
        print "%s version %s" % (os.path.basename(sys.argv[0]), __version__)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

`pytest` is pinned at the lowest version supporting python3.10[3],
similarly for coverage[4], `flake8` was also bump to a more recent
version.

[1] https://nose.readthedocs.io/en/latest/#note-to-users
[2] nose-devs/nose#1122
[3] https://docs.pytest.org/en/7.1.x/changelog.html#pytest-6-2-5-2021-08-29
[4] https://coverage.readthedocs.io/en/6.4.1/changes.html#version-6-0-2021-10-03
matthewhughes934 added a commit to matthewhughes934/pystatsd that referenced this issue Jul 8, 2022
Drop support for pythons <3.7 (including python 2).

Since this makes it part of the standard library, replace `mock` with
`unittest.mock` in tests.

This also required replacing `nose` with `pytest` in tests This is
because `nose` is not under active development[1], and the version
specified fails to run on python3 (and newer versions fail to run on
python3.10[2]):

    $ python -m nose
    Traceback (most recent call last):
      File "/usr/lib/python3.10/runpy.py", line 187, in _run_module_as_main
        mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
      File "/usr/lib/python3.10/runpy.py", line 146, in _get_module_details
        return _get_module_details(pkg_main_name, error)
      File "/usr/lib/python3.10/runpy.py", line 110, in _get_module_details
        __import__(pkg_name)
      File "/home/mjh/src/pystatsd/.venv/lib/python3.10/site-packages/nose/__init__.py", line 1, in <module>
        from nose.core import collector, main, run, run_exit, runmodule
      File "/home/mjh/src/pystatsd/.venv/lib/python3.10/site-packages/nose/core.py", line 143
        print "%s version %s" % (os.path.basename(sys.argv[0]), __version__)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

`pytest` is pinned at the lowest version supporting python3.10[3],
similarly for coverage[4], `flake8` was also bump to a more recent
version.

[1] https://nose.readthedocs.io/en/latest/#note-to-users
[2] nose-devs/nose#1122
[3] https://docs.pytest.org/en/7.1.x/changelog.html#pytest-6-2-5-2021-08-29
[4] https://coverage.readthedocs.io/en/6.4.1/changes.html#version-6-0-2021-10-03
matthewhughes934 added a commit to matthewhughes934/pystatsd that referenced this issue Jul 8, 2022
Drop support for pythons <3.7 (including python 2).

Since this makes it part of the standard library, replace `mock` with
`unittest.mock` in tests.

This also required replacing `nose` with `pytest` in tests This is
because `nose` is not under active development[1], and the version
specified fails to run on python3 (and newer versions fail to run on
python3.10[2]):

    $ python -m nose
    Traceback (most recent call last):
      File "/usr/lib/python3.10/runpy.py", line 187, in _run_module_as_main
        mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
      File "/usr/lib/python3.10/runpy.py", line 146, in _get_module_details
        return _get_module_details(pkg_main_name, error)
      File "/usr/lib/python3.10/runpy.py", line 110, in _get_module_details
        __import__(pkg_name)
      File "/home/mjh/src/pystatsd/.venv/lib/python3.10/site-packages/nose/__init__.py", line 1, in <module>
        from nose.core import collector, main, run, run_exit, runmodule
      File "/home/mjh/src/pystatsd/.venv/lib/python3.10/site-packages/nose/core.py", line 143
        print "%s version %s" % (os.path.basename(sys.argv[0]), __version__)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

`pytest` is pinned at the lowest version supporting python3.10[3],
similarly for coverage[4], `flake8` was also bump to a more recent
version.

[1] https://nose.readthedocs.io/en/latest/#note-to-users
[2] nose-devs/nose#1122
[3] https://docs.pytest.org/en/7.1.x/changelog.html#pytest-6-2-5-2021-08-29
[4] https://coverage.readthedocs.io/en/6.4.1/changes.html#version-6-0-2021-10-03
matthewhughes934 added a commit to matthewhughes934/pystatsd that referenced this issue Jul 8, 2022
Drop support for pythons <3.7 (including python 2).

Since this makes it part of the standard library, replace `mock` with
`unittest.mock` in tests.

This also required replacing `nose` with `pytest` in tests This is
because `nose` is not under active development[1], and the version
specified fails to run on python3 (and newer versions fail to run on
python3.10[2]):

    $ python -m nose
    Traceback (most recent call last):
      File "/usr/lib/python3.10/runpy.py", line 187, in _run_module_as_main
        mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
      File "/usr/lib/python3.10/runpy.py", line 146, in _get_module_details
        return _get_module_details(pkg_main_name, error)
      File "/usr/lib/python3.10/runpy.py", line 110, in _get_module_details
        __import__(pkg_name)
      File "/home/mjh/src/pystatsd/.venv/lib/python3.10/site-packages/nose/__init__.py", line 1, in <module>
        from nose.core import collector, main, run, run_exit, runmodule
      File "/home/mjh/src/pystatsd/.venv/lib/python3.10/site-packages/nose/core.py", line 143
        print "%s version %s" % (os.path.basename(sys.argv[0]), __version__)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

`pytest` is pinned at the lowest version supporting python3.10[3],
similarly for coverage[4], `flake8` was also bump to a more recent
version.

[1] https://nose.readthedocs.io/en/latest/#note-to-users
[2] nose-devs/nose#1122
[3] https://docs.pytest.org/en/7.1.x/changelog.html#pytest-6-2-5-2021-08-29
[4] https://coverage.readthedocs.io/en/6.4.1/changes.html#version-6-0-2021-10-03
matthewhughes934 added a commit to matthewhughes934/pystatsd that referenced this issue Jul 8, 2022
Drop support for pythons <3.7 (including python 2).

Since this makes it part of the standard library, replace `mock` with
`unittest.mock` in tests. I also bumped the ubuntu version used in CI to
one that has python3.10 installable.

This also required replacing `nose` with `pytest` in tests This is
because `nose` is not under active development[1], and the version
specified fails to run on python3 (and newer versions fail to run on
python3.10[2]):

    $ python -m nose
    Traceback (most recent call last):
      File "/usr/lib/python3.10/runpy.py", line 187, in _run_module_as_main
        mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
      File "/usr/lib/python3.10/runpy.py", line 146, in _get_module_details
        return _get_module_details(pkg_main_name, error)
      File "/usr/lib/python3.10/runpy.py", line 110, in _get_module_details
        __import__(pkg_name)
      File "/home/mjh/src/pystatsd/.venv/lib/python3.10/site-packages/nose/__init__.py", line 1, in <module>
        from nose.core import collector, main, run, run_exit, runmodule
      File "/home/mjh/src/pystatsd/.venv/lib/python3.10/site-packages/nose/core.py", line 143
        print "%s version %s" % (os.path.basename(sys.argv[0]), __version__)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

`pytest` is pinned at the lowest version supporting python3.10[3],
similarly for coverage[4], `flake8` was also bump to a more recent
version.

[1] https://nose.readthedocs.io/en/latest/#note-to-users
[2] nose-devs/nose#1122
[3] https://docs.pytest.org/en/7.1.x/changelog.html#pytest-6-2-5-2021-08-29
[4] https://coverage.readthedocs.io/en/6.4.1/changes.html#version-6-0-2021-10-03
@ppizarror
Copy link

@alonbl
Copy link

alonbl commented Sep 12, 2022

Last commit 7 years ago, is this component maintained?

@jnns
Copy link

jnns commented Sep 16, 2022

@alonbl The project's website says:

Nose has been in maintenance mode for the past several years and will likely cease without a new person/team to take over maintainership. New projects should consider using Nose2, py.test, or just plain unittest/unittest2.

@dirkf
Copy link

dirkf commented Sep 26, 2022

#1099

maxim-h added a commit to maxim-h/snakemake that referenced this issue Apr 5, 2023
Starting with Python3.10 collections.Callable to collections.abc.Callable, which [breaks nose](nose-devs/nose#1122).
Seems that for now testing can only be done with earlier versions. In the long run some other testing solution might be needed.
@adiroiban
Copy link
Contributor

I guess that we should all say goodby to nose and try to move to nose2

Meanwhile, somewhere in the nose start script I have added the following hack.
It just put back the aliases :)

    for member in ['Callable', 'Iterable', 'Sequence']:
        if not hasattr(collections, member):
            setattr(collections, member, getattr(collections.abc, member))

kevincai added a commit to kevincai/starrocks that referenced this issue Jul 23, 2024
* `nose` is too old to compatible with python3.10+
  nose-devs/nose#1122
* turn to pynose to fix the compatibility issue
  https://pypi.org/project/pynose/1.4.8/#description

Signed-off-by: Kevin Xiaohua Cai <[email protected]>
alvin-celerdata pushed a commit to StarRocks/starrocks that referenced this issue Jul 24, 2024
* `nose` is too old to compatible with python3.10+ nose-devs/nose#1122
* turn to pynose to fix the compatibility issue https://pypi.org/project/pynose/1.4.8/#description

Signed-off-by: Kevin Xiaohua Cai <[email protected]>
mergify bot pushed a commit to StarRocks/starrocks that referenced this issue Jul 24, 2024
* `nose` is too old to compatible with python3.10+ nose-devs/nose#1122
* turn to pynose to fix the compatibility issue https://pypi.org/project/pynose/1.4.8/#description

Signed-off-by: Kevin Xiaohua Cai <[email protected]>
(cherry picked from commit 97d861f)
mergify bot pushed a commit to StarRocks/starrocks that referenced this issue Jul 24, 2024
* `nose` is too old to compatible with python3.10+ nose-devs/nose#1122
* turn to pynose to fix the compatibility issue https://pypi.org/project/pynose/1.4.8/#description

Signed-off-by: Kevin Xiaohua Cai <[email protected]>
(cherry picked from commit 97d861f)
mergify bot pushed a commit to StarRocks/starrocks that referenced this issue Jul 24, 2024
* `nose` is too old to compatible with python3.10+ nose-devs/nose#1122
* turn to pynose to fix the compatibility issue https://pypi.org/project/pynose/1.4.8/#description

Signed-off-by: Kevin Xiaohua Cai <[email protected]>
(cherry picked from commit 97d861f)
dujijun007 pushed a commit to dujijun007/starrocks that referenced this issue Jul 29, 2024
* `nose` is too old to compatible with python3.10+ nose-devs/nose#1122
* turn to pynose to fix the compatibility issue https://pypi.org/project/pynose/1.4.8/#description

Signed-off-by: Kevin Xiaohua Cai <[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

No branches or pull requests

7 participants