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

Add support for python 3.12 #2

Open
wants to merge 4 commits into
base: next
Choose a base branch
from
Open

Conversation

zephyrj
Copy link

@zephyrj zephyrj commented May 24, 2024

Background

I primarily use parallel-ssh rather than this library directly and wanted to update my environment to python 3.12. I had to go through a few steps to get it working so thought I'd try to contribute some effort in an attempt to hopefully help others.

I've noticed that the main repo under the ParallelSSH org only has wheels built on PyPi for up to python 3.10 and the main maintainer of the project has not been keeping it up-to-date; as such I've been following on from the work done here that has been tracked through ParallelSSH/parallel-ssh#386 and initially added through #1

When trying to install ssh-python directly from the next branch I encounter the following error (note: without cython installed in my python environment)

pip install git+https://github.com/parallel-ssh/ssh-python@next
...  
  
Building wheels for collected packages: ssh-python
  Building wheel for ssh-python (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
...  
  
ssh/callbacks.c: In function ‘__Pyx_PyInt_As_int’:
ssh/callbacks.c:3931:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
                   const digit* digits = ((PyLongObject*)x)->ob_digit;
                                                           ^~
ssh/callbacks.c:3986:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
                   const digit* digits = ((PyLongObject*)x)->ob_digit;
                                                           ^~
ssh/callbacks.c: In function ‘__Pyx_PyInt_As_long’:
ssh/callbacks.c:4203:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
                   const digit* digits = ((PyLongObject*)x)->ob_digit;
                                                           ^~
ssh/callbacks.c:4258:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
                   const digit* digits = ((PyLongObject*)x)->ob_digit;
                                                           ^~
ssh/callbacks.c: In function ‘__Pyx_PyIndex_AsSsize_t’:
ssh/callbacks.c:4763:45: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
           const digit* digits = ((PyLongObject*)b)->ob_digit;
                                                   ^~
error: command '/usr/bin/gcc' failed with exit code 1

If I install cython into my python environment then the above command works as, from my limited understanding, that results in it rebuilding the .c files which will subsequently be compatible with python 3.12

Changes made

I've updated the libssh version to latest stable version of 0.10.6 + a patch with a fix for some IPv6 regressions see here. This includes updating the source in the libssh folder of the repo and including a tar.gz package that is used in the manylinux docker files.

I've updated the manylinux docker files to use the latest openssl version of 3.3.0 and krb5 version of 1.21.2 alongside the new libssh version

I've updated the setup.py file to match the work done in the sibling ssh2-python project for python 3.12 support and then regenerated the .c files with cython 3.0.10 so that they are compatible with python 3.12. You can now install ssh-python from the repos setup.py file without cython needing to be installed in your environment

I've also updated some CI config to reference 3.12 but this is beyond my knowledge so some additional work may be required here by those more familiar

Initial cibuidwheel support

I also played around with cibuildwheel as I wanted to build wheels locally to test them; I've added some basic support for building manylinux wheels with it in the ci/cibuildwheel directory. It's only setup for CPython on x86_64 and aarch64 at present but could be expanded upon if desired

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

Successfully merging this pull request may close these issues.

1 participant