spylon-kernel icon indicating copy to clipboard operation
spylon-kernel copied to clipboard

Outdated versioneer.py broken for Python 3.12

Open nielsreijers opened this issue 2 years ago • 1 comments

Python 3.12 removed the long deprecated configparser.SafeConfigParser class which old versions of versioneer depended on.

Expected Behavior

pip install spylon-kernel correctly installs the package.

Current Behavior

pip install spylon-kernel fails with this output:

...
              File "/tmp/pip-install-7tqi8u7z/spylon_2393384d9e244f009732dc4b8192d5fb/versioneer.py", line 412, in get_config_from_root
                parser = configparser.SafeConfigParser()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
            [end of output]
        
        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: subprocess-exited-with-error

      × Getting requirements to build wheel did not run successfully.
      │ exit code: 1
      ╰─> See above for output.

Steps to Reproduce

pip install spylon-kernel, using Python versions 3.12 and higher.

Detailed Description

SafeConfigParser had been deprecated since Python 3.2., and renamed to simply ConfigParser. In Python 3.12 it has finally been removed. The versioneer.py file in this repository has been generated with versioneer version 0.17, which generated code that uses SafeConfigParser. New versions of versioneer use ConfigParser instead, so generating a new versioneer.py with a more recent version fixes the issue.

See: https://docs.python.org/3/whatsnew/3.2.html#configparser and: https://docs.python.org/3/whatsnew/3.12.html#removed

Possible Solution

Update the code generated by versioneer to a more recent version.

nielsreijers avatar Jan 11 '24 09:01 nielsreijers

Python 3.12 removed the long deprecated configparser.SafeConfigParser class which old versions of versioneer depended on.

Expected Behavior

pip install spylon-kernel correctly installs the package.

Current Behavior

pip install spylon-kernel fails with this output:

...
              File "/tmp/pip-install-7tqi8u7z/spylon_2393384d9e244f009732dc4b8192d5fb/versioneer.py", line 412, in get_config_from_root
                parser = configparser.SafeConfigParser()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
            [end of output]
        
        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: subprocess-exited-with-error

      × Getting requirements to build wheel did not run successfully.
      │ exit code: 1
      ╰─> See above for output.

Steps to Reproduce

pip install spylon-kernel, using Python versions 3.12 and higher.

Detailed Description

SafeConfigParser had been deprecated since Python 3.2., and renamed to simply ConfigParser. In Python 3.12 it has finally been removed. The versioneer.py file in this repository has been generated with versioneer version 0.17, which generated code that uses SafeConfigParser. New versions of versioneer use ConfigParser instead, so generating a new versioneer.py with a more recent version fixes the issue.

See: https://docs.python.org/3/whatsnew/3.2.html#configparser and: https://docs.python.org/3/whatsnew/3.12.html#removed

Possible Solution

Update the code generated by versioneer to a more recent version.

Hi! I cloned your fork and tried to build locally library from source via python setup.py build command, I did it successfully however I still face error:

/venv/lib/python3.12/site-packages/setuptools/sandbox.py", line 47, in _execfile
    exec(code, globals, locals)
  File "/var/folders/hq/91x95dm54qgf88pl6c1wfhjh2x47n4/T/easy_install-ov7_km33/spylon-0.3.0/setup.py", line 32, in <module>
    'Intended Audience :: System Administrators',
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/folders/hq/91x95dm54qgf88pl6c1wfhjh2x47n4/T/easy_install-ov7_km33/spylon-0.3.0/versioneer.py", line 1473, in get_version
    Source tarballs conventionally unpack into a directory that includes both
           ^^^^^^^^^^^^^^
  File "/var/folders/hq/91x95dm54qgf88pl6c1wfhjh2x47n4/T/easy_install-ov7_km33/spylon-0.3.0/versioneer.py", line 1406, in get_versions
    # distance: number of commits since tag
      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/folders/hq/91x95dm54qgf88pl6c1wfhjh2x47n4/T/easy_install-ov7_km33/spylon-0.3.0/versioneer.py", line 412, in get_config_from_root
    if not section:
             ^^^^^^^
AttributeError: module 'configparser' has no attribute 'SafeConfigParser'

that was raised by:

python setup.py install

is it expected behaviour or I missed something?

maxim-lixakov avatar Jul 22 '24 16:07 maxim-lixakov