Azure / azure-uamqp-python

AMQP 1.0 client library for Python
MIT License
56 stars 47 forks source link

Add PyPy support #363

Closed auvipy closed 1 year ago

auvipy commented 1 year ago

I want to able to use or install this package pre compiled to be used with pypy 3.8/3.9

kashifkhan commented 1 year ago

Hi @auvipy , as we discussed in the azure-sdk github repo that we dont have plans to add pypy support for uamqp. My teams focus is on the pure python-based implementation of the amqp library. Please let me know if you run in to any issues with the servicebus beta using the new library.

Thank you :)

auvipy commented 1 year ago

that is completely OK

oberstetpanamax commented 1 year ago

the current PyPI release runs into

      /tmp/pip-install-6d3_7wde/uamqp_d102cb4bdcb4430782786bd4aa949aff/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/x509_openssl.c:353:24: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
        353 |             bio_method = BIO_s_mem();

but installation from trunk works on PyPy

Python 3.9.16 (feeb267ead3e6771d3f2f49b83e1894839f64fb7, Dec 29 2022, 14:23:21)
[PyPy 7.3.11 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]

(pypy39_1) oberstet@thinkpad-t430s:~/scm/3rdparty/azure-uamqp-python$ pip install .
Processing /home/oberstet/scm/3rdparty/azure-uamqp-python
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: certifi>=2017.4.17 in /home/oberstet/pypy39_1/lib/pypy3.9/site-packages (from uamqp==1.6.4) (2022.12.7)
Building wheels for collected packages: uamqp
  Building wheel for uamqp (pyproject.toml) ... done
  Created wheel for uamqp: filename=uamqp-1.6.4-pp39-pypy39_pp73-linux_x86_64.whl size=1215292 sha256=73e5bb7047866efb230558b6d85124a041229d8b674c85d11024c55f2209b990
  Stored in directory: /home/oberstet/.cache/pip/wheels/c8/24/96/6c7c494109de3235fb06e76c53135aad0afb9e8a6f2d28f79f
Successfully built uamqp
Installing collected packages: uamqp
Successfully installed uamqp-1.6.4
(pypy39_1) oberstet@thinkpad-t430s:~/scm/3rdparty/azure-uamqp-python$ pip show uamqp
Name: uamqp
Version: 1.6.4
Summary: AMQP 1.0 Client Library for Python
Home-page: https://github.com/Azure/azure-uamqp-python
Author: Microsoft Corporation
Author-email: azpysdkhelp@microsoft.com
License: MIT License
Location: /home/oberstet/pypy39_1/lib/pypy3.9/site-packages
Requires: certifi
Required-by: 

fwiw, installation in editable mode fails with

(pypy39_1) oberstet@thinkpad-t430s:~/scm/3rdparty/azure-uamqp-python$ pip install -e .
Obtaining file:///home/oberstet/scm/3rdparty/azure-uamqp-python
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Requirement already satisfied: certifi>=2017.4.17 in /home/oberstet/pypy39_1/lib/pypy3.9/site-packages (from uamqp==1.6.4) (2022.12.7)
Building wheels for collected packages: uamqp
  Building editable for uamqp (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building editable for uamqp (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [64 lines of output]
      running editable_wheel
      creating /tmp/pip-wheel-ntrptoa_/.tmp-_h0for6f/uamqp.egg-info
      writing /tmp/pip-wheel-ntrptoa_/.tmp-_h0for6f/uamqp.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-wheel-ntrptoa_/.tmp-_h0for6f/uamqp.egg-info/dependency_links.txt
      writing requirements to /tmp/pip-wheel-ntrptoa_/.tmp-_h0for6f/uamqp.egg-info/requires.txt
      writing top-level names to /tmp/pip-wheel-ntrptoa_/.tmp-_h0for6f/uamqp.egg-info/top_level.txt
      writing manifest file '/tmp/pip-wheel-ntrptoa_/.tmp-_h0for6f/uamqp.egg-info/SOURCES.txt'
      reading manifest file '/tmp/pip-wheel-ntrptoa_/.tmp-_h0for6f/uamqp.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file '/tmp/pip-wheel-ntrptoa_/.tmp-_h0for6f/uamqp.egg-info/SOURCES.txt'
      creating '/tmp/pip-wheel-ntrptoa_/.tmp-_h0for6f/uamqp-1.6.4.dist-info'
      creating /tmp/pip-wheel-ntrptoa_/.tmp-_h0for6f/uamqp-1.6.4.dist-info/WHEEL
      running build_py
      running build_ext
      will build uamqp in /tmp/tmpt9t955lj.build-temp/cmake
      Traceback (most recent call last):
        File "/tmp/pip-build-env-2621i54n/overlay/lib/pypy3.9/site-packages/setuptools/command/editable_wheel.py", line 155, in run
          self._create_wheel_file(bdist_wheel)
        File "/tmp/pip-build-env-2621i54n/overlay/lib/pypy3.9/site-packages/setuptools/command/editable_wheel.py", line 344, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
        File "/tmp/pip-build-env-2621i54n/overlay/lib/pypy3.9/site-packages/setuptools/command/editable_wheel.py", line 267, in _run_build_commands
          self._run_build_subcommands()
        File "/tmp/pip-build-env-2621i54n/overlay/lib/pypy3.9/site-packages/setuptools/command/editable_wheel.py", line 294, in _run_build_subcommands
          self.run_command(name)
        File "/tmp/pip-build-env-2621i54n/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-2621i54n/overlay/lib/pypy3.9/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-2621i54n/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "<string>", line 134, in run
        File "<string>", line 161, in build_cmake
      FileNotFoundError: [Errno 2] No such file or directory: '/home/oberstet/scm/3rdparty/azure-uamqp-python//tmp/tmpt9t955lj.build-temp/cmake'
      /tmp/pip-build-env-2621i54n/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/dist.py:988: _DebuggingTips: Problem in editable installation.
      !!

              ********************************************************************************
              An error happened while installing `uamqp` in editable mode.

              The following steps are recommended to help debug this problem:

              - Try to install the project normally, without using the editable mode.
                Does the error still persist?
                (If it does, try fixing the problem before attempting the editable mode).
              - If you are using binary extensions, make sure you have all OS-level
                dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
              - Try the latest version of setuptools (maybe the error was already fixed).
              - If you (or your project dependencies) are using any setuptools extension
                or customization, make sure they support the editable mode.

              After following the steps above, if the problem still persists and
              you think this is related to how setuptools handles editable installations,
              please submit a reproducible example
              (see https://stackoverflow.com/help/minimal-reproducible-example) to:

                  https://github.com/pypa/setuptools/issues

              See https://setuptools.pypa.io/en/latest/userguide/development_mode.html for details.
              ********************************************************************************

      !!
        cmd_obj.run()
      error: [Errno 2] No such file or directory: '/home/oberstet/scm/3rdparty/azure-uamqp-python//tmp/tmpt9t955lj.build-temp/cmake'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building editable for uamqp
Failed to build uamqp
ERROR: Could not build wheels for uamqp, which is required to install pyproject.toml-based projects
kashifkhan commented 1 year ago

Hi @oberstetpanamax , we have no plans for uamqp supporting pypy. The original issue was because the customer was trying to run the servicebus client library on pypy and because of uamqp, it was not possible. Now that we have moved over to the new pure python AMQP library, servicebus and eventhub can work without it. If there is interest from the community in us releasing a stand a lone version of the python AMQP library, then please let us know so we can prioritize.

oberstetpanamax commented 1 year ago

@kashifkhan thanks for commenting and stating your perspective!

my interest is solely: talk to RabbitMQ Streams from PyPy as fast as possible, whatever libraries allow me to.

currently, I am using https://github.com/qweeze/rstream which has uamqp as a dependency, and it does work with PyPy / RabbitMQ Streams.

Is there are better/faster way? If so I would be very interested!

my comment here was just to share my experience, be a good community citizen, I didn't want to imply/request any work ... however, let me say: PyPy is awesome and I am supporting it where I can. Pure Python libraries are often faster than CPyExt based native ones, and if absolutely needed, libraries should use CFFI not CPyExt.