juju / python-libjuju

Python library for the Juju API
Apache License 2.0
57 stars 93 forks source link

Libjuju 3.3.1.0 is unusable #1025

Closed gboutry closed 4 months ago

gboutry commented 4 months ago

Description

From inside a snap

When trying to import with from juju.controller import Controller from inside a snap, we get the following failure:

Traceback (most recent call last):
  File "/snap/openstack/x2/bin/sunbeam", line 6, in <module>
    from sunbeam.main import main
  File "/snap/openstack/x2/lib/python3.10/site-packages/sunbeam/main.py", line 23, in <module>
    from sunbeam.commands import configure as configure_cmds
  File "/snap/openstack/x2/lib/python3.10/site-packages/sunbeam/commands/configure.py", line 26, in <module>
    from sunbeam import utils
  File "/snap/openstack/x2/lib/python3.10/site-packages/sunbeam/utils.py", line 33, in <module>
    from sunbeam.plugins.interface.v1.base import PluginError
  File "/snap/openstack/x2/lib/python3.10/site-packages/sunbeam/plugins/interface/v1/base.py", line 30, in <module>
    from sunbeam.jobs.deployment import Deployment
  File "/snap/openstack/x2/lib/python3.10/site-packages/sunbeam/jobs/deployment.py", line 20, in <module>
    from juju.controller import Controller
  File "/snap/openstack/x2/lib/python3.10/site-packages/juju/controller.py", line 12, in <module>
    from .client import client, connector
  File "/snap/openstack/x2/lib/python3.10/site-packages/juju/client/connector.py", line 12, in <module>
    from juju.client.connection import Connection
  File "/snap/openstack/x2/lib/python3.10/site-packages/juju/client/connection.py", line 19, in <module>
    from juju.version import CLIENT_VERSION
  File "/snap/openstack/x2/lib/python3.10/site-packages/juju/version.py", line 19, in <module>
    CLIENT_VERSION = re.search(r'\d+\.\d+\.\d+', open(VERSION_FILE_PATH).read().strip()).group()
FileNotFoundError: [Errno 2] No such file or directory: '/snap/openstack/x2/lib/python3.10/site-packages/VERSION'

From inside a venv

When trying to import from juju.controller import Controller from inside a virtualenv, we get the following failure:

python3 -c "from juju.controller import Controller"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/ubuntu/testos/lib/python3.10/site-packages/juju/controller.py", line 12, in <module>
    from .client import client, connector
  File "/home/ubuntu/testos/lib/python3.10/site-packages/juju/client/connector.py", line 7, in <module>
    from packaging import version
ModuleNotFoundError: No module named 'packaging'

Side notes: The snap has other dependencies that do include packaging, so no failure on packaging import Everything works fine with Juju 3.3.0.0

Urgency

Annoying bug in our test suite

Python-libjuju version

3.3.1.0

Juju version

Unrelated

Reproduce / Test

How to reproduce both failure in a venv:

sudo apt update
sudo apt install python3.10-venv
python3 -m venv venv
source venv/bin/activate
pip install 'juju==3.3.1.0'
python3 -c "from juju.controller import Controller" <-- packaging import missing
pip install packaging
python3 -c "from juju.controller import Controller" <-- VERSION file not found error
PietroPasotti commented 4 months ago

workaround: pin to

juju<=3.3.0,>=3.0

gboutry commented 4 months ago

I did juju>3.3,!=3.3.1.0 but I need changes inside 3.3.1.0, so the workaround does not really apply :)

cderici commented 4 months ago

Surprised to see this (because it is -successfully- tested against 3.3.1), thanks @gboutry for reporting. This is why we don't do releases on a Friday :) no worries, we'll fix this right away.

I'll fix both of these today and might do a patch release afterwards 👍

freyes commented 4 months ago

Could we yank 3.3.1.0 from Pypi? - https://pypi.org/project/juju/#history

cderici commented 4 months ago

Could we yank 3.3.1.0 from Pypi? - https://pypi.org/project/juju/#history

I've never done that before so I'd need to take a look at how it's done, but a 3.3.1.1 is coming very soon as soon as #1026 lands as the latest anyways, so pip shouldn't ever touch 3.3.1.0 after that (unless someone pins it of course).

tonyandrewmeyer commented 4 months ago

Could we yank 3.3.1.0 from Pypi? - https://pypi.org/project/juju/#history

I've never done that before so I'd need to take a look at how it's done, but a 3.3.1.1 is coming very soon as soon as #1026 lands as the latest anyways, so pip shouldn't ever touch 3.3.1.0 after that (unless someone pins it of course).

FYI, yanking (as opposed to deleting) will still allow installing if pinned to that exact version anyway (that's the point of yanking).

Yanking is straightforward, you just go into the "manage" section for the project, and choose "yank" from the options drop-down in the right.

cderici commented 4 months ago

will still allow installing if pinned to that exact version anyway

Thanks for the info @tonyandrewmeyer, does it pick the next available latest if that happens do you know?

tonyandrewmeyer commented 4 months ago

will still allow installing if pinned to that exact version anyway

Thanks for the info @tonyandrewmeyer, does it pick the next available latest if that happens do you know?

Yes, if yanked then when pip (or other tools) are resolving they'll ignore the yanked version and behave as if it didn't exist (unless the pin asks for it specifically).

jameinel commented 4 months ago

It has been yanked