pylxd icon indicating copy to clipboard operation
pylxd copied to clipboard

What should I do about ws4py?

Open dimaqq opened this issue 1 year ago • 12 comments

This is what gets installed:

pylxd==2.3.5
  cryptography==43.0.1
    cffi==1.17.1
      pycparser==2.22
  python-dateutil==2.9.0.post0
    six==1.16.0
  requests==2.32.3
    certifi==2024.8.30
    charset-normalizer==3.3.2
    idna==3.10
    urllib3==1.26.20
  requests-toolbelt==1.0.0
    requests==2.32.3
      certifi==2024.8.30
      charset-normalizer==3.3.2
      idna==3.10
      urllib3==1.26.20
  ws4py==0.5.1

And that works fine in my local env, but the Jenkins job barfs... (I don't quite know what Jenkins does, but still?)

Building wheels for collected packages: juju, ws4py
  Building wheel for juju (pyproject.toml): started
  Building wheel for juju (pyproject.toml): finished with status 'done'
  Created wheel for juju: filename=juju-3.5.2.0-py3-none-any.whl size=283168 sha256=f19ece3d052a8acc76b27a8a0f0588b5ef15677554269325f877a053bf65d7e6
  Stored in directory: /home/jenkins/.cache/pip/wheels/74/32/a3/6fab14d05865e07fb4e28c16a9ff3abae6f17e145b87ce14a3
  Building wheel for ws4py (setup.py): started
  Building wheel for ws4py (setup.py): finished with status 'error'
  Running setup.py clean for ws4py
Successfully built juju
Failed to build ws4py
[31m  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [88 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib
      creating build/lib/ws4py
      copying ws4py/compat.py -> build/lib/ws4py
      copying ws4py/websocket.py -> build/lib/ws4py
      copying ws4py/async_websocket.py -> build/lib/ws4py
      copying ws4py/utf8validator.py -> build/lib/ws4py
      copying ws4py/messaging.py -> build/lib/ws4py
      copying ws4py/manager.py -> build/lib/ws4py
      copying ws4py/streaming.py -> build/lib/ws4py
      copying ws4py/framing.py -> build/lib/ws4py
      copying ws4py/__init__.py -> build/lib/ws4py
      copying ws4py/exc.py -> build/lib/ws4py
      creating build/lib/ws4py/client
      copying ws4py/client/geventclient.py -> build/lib/ws4py/client
      copying ws4py/client/threadedclient.py -> build/lib/ws4py/client
      copying ws4py/client/tornadoclient.py -> build/lib/ws4py/client
      copying ws4py/client/__init__.py -> build/lib/ws4py/client
      creating build/lib/ws4py/server
      copying ws4py/server/geventserver.py -> build/lib/ws4py/server
      copying ws4py/server/wsgirefserver.py -> build/lib/ws4py/server
      copying ws4py/server/cherrypyserver.py -> build/lib/ws4py/server
      copying ws4py/server/tulipserver.py -> build/lib/ws4py/server
      copying ws4py/server/wsgiutils.py -> build/lib/ws4py/server
      copying ws4py/server/__init__.py -> build/lib/ws4py/server
      /home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
      !!
      
              ********************************************************************************
              Please avoid running ``setup.py`` directly.
              Instead, use pypa/build, pypa/installer or other
              standards-based tools.
      
              See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
              ********************************************************************************
      
      !!
        self.initialize_options()
      installing to build/bdist.linux-x86_64/wheel
      running install
      running install_lib
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-xxao179z/ws4py_32bb9ce314c5496fa5cc0637a096257a/setup.py", line 40, in <module>
          setup(name = "ws4py",
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/dist.py", line 1233, in run_command
          super().run_command(command)
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 403, in run
          self.run_command("install")
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/dist.py", line 1233, in run_command
          super().run_command(command)
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/command/install.py", line 78, in run
          return orig.install.run(self)
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/command/install.py", line 708, in run
          self.run_command(cmd_name)
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/dist.py", line 1233, in run_command
          super().run_command(command)
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
          cmd_obj.ensure_finalized()
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
          self.finalize_options()
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/command/install_lib.py", line 17, in finalize_options
          self.set_undefined_options('install',('install_layout','install_layout'))
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 296, in set_undefined_options
          setattr(self, dst_option, getattr(src_cmd_obj, src_option))
        File "/home/jenkins/go/src/github.com/juju/python-libjuju/.tox/py38/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
          raise AttributeError(attr)
      AttributeError: install_layout
      [end of output]

dimaqq avatar Nov 22 '24 08:11 dimaqq

@dimaqq have you tried bringing this to the ws4py folks? I feel they would be in a better position to understand/help than us.

simondeziel avatar Nov 22 '24 13:11 simondeziel

The last release of ws4py was... Released: Mar 1, 2018

I'll open a ticket, but let's see if in space anyone can hear me whine.

dimaqq avatar Nov 25 '24 00:11 dimaqq

I've opened https://github.com/Lawouach/WebSocket-for-Python/issues/296

In the meantime, I've put the few tests that use pylxd behiond pytest.importorskip.

That means pylxd is no longer exercised in CI in python-libjuju but those two tests can be run manually, so I guess that's OK.

P.S. if WebSocket is an essential part of listening to the event stream, I would advocate using a newer library. If not, maybe the dependency can be optional?

dimaqq avatar Nov 25 '24 00:11 dimaqq

@hamistao WDYT about potentially switching to https://github.com/python-websockets/websockets? From a cursory look, it seems like a potential replacement and it is backed by Tidelift which is a sign of "good health" IMHO and it seems to be considerably more popular than ws4py.

According to https://websockets.readthedocs.io/en/stable/project/changelog.html, we'd have to use 13.1 for backward compat with Python 3.8 which we need for support of Ubuntu 20.04.

simondeziel avatar Nov 25 '24 18:11 simondeziel

@simondeziel I really like your proposal! Although I don't have a ton of experience with neither library, websockets has a lot going for it. It is getting a lot more attention on GitHub, both from the development standpoint and the community. Its documentation looks a not nicer. I checked and it seems to have all the features we need. Also it just may help us get rid of https://github.com/canonical/pylxd/issues/585.

May I assign this to myself?

hamistao avatar Nov 25 '24 20:11 hamistao

@simondeziel I really like your proposal! Although I don't have a ton of experience with neither library, websockets is getting a lot more attention on GitHub, both from the development standpoint and the community. I checked and it seems to have all the features we need. Also it just may help us get rid of #585.

Indeed, 2 birds with one stone :)

May I assign this to myself?

Please :)

simondeziel avatar Nov 25 '24 20:11 simondeziel

@dimaqq We will switch to websockets in a couple months. In the meantime, ws4py got a new 0.6.0 release a month ago (after 6 releaseless years), could it be that this new update included a fix that pleases Jenkins?

hamistao avatar Jan 19 '25 13:01 hamistao

I've put the few tests that use pylxd behiond pytest.importorskip.

And I'm happy with that for a couple of months.

dimaqq avatar Jan 24 '25 00:01 dimaqq

ws4py now got a new release

auvipy avatar Jan 29 '25 05:01 auvipy

ws4py now got a new release

Upstream say "Still, you should be asking yourself if that's the right dependency for you considering there are more up to date alternatives these days." (https://github.com/Lawouach/WebSocket-for-Python/issues/297) so moving is still going to be the best option.

goetzk avatar Feb 17 '25 00:02 goetzk

@goetzk that's indeed the longer term plan to switch (see #626). We're waiting for Ubuntu 20.04 to go EOL (In April 2025) before dropping support for Python 3.8.

simondeziel avatar Feb 17 '25 14:02 simondeziel

Hi there,

I'm the maintainer of ws4py. I just noticed this thread.

I think you are fully right to move away from it. I do appreciate you have used and relied on it. Unfortunately, it's not been a project I've had time for for way too long, it doesn't make sense to keep relying on it indeed.

If you need anything until then, let me know but I think your plan is the right one!

  • Sylvain

Lawouach avatar Mar 24 '25 19:03 Lawouach

ws4py now got a new release

This will have to do as #626 did not pan out.

simondeziel avatar Jun 27 '25 21:06 simondeziel