Change to layer:basic: use_venv & include_system_packages on by default

Cory Johns cory.johns at canonical.com
Thu Mar 8 20:51:11 UTC 2018


Greetings,

A change to layer:basic just landed[1] that changes the default value for
the use_venv and include_system_packages layer options[2] to be enabled by
default.

This change will prevent a confusing bug that people run into when dealing
with subordinates or co-located charms on a single machine: if co-located
charms have different versions of some of their dependencies, especially
charms.reactive or charmhelpers, they would conflict and sometimes cause
one of the charms to break.  This fixes the issue by isolating the charm's
Python dependencies in a virtual environment.  The change to
include_system_packages is to ensure that charms that rely on Python
libraries installed via apt will still function.

In general, this should be transparent to almost every charm.  The only
real concern is if the charm relies on command-line tools provided by any
of the Python packages; with the packages now in the venv, the venv will
need to be activated before the CLI tools can be used.  The PR does provide
shims for the charms.reactive CLI and charmhelpers CLI (chlp), as well as
the layer_option CLI provided by the basic layer itself.  These can be
accessed globally and will use Juju context information to activate the
correct virtual environment.

On the off chance that you do run into an issue with this change, it's easy
to disable it for your charm.  Just add the following to your layer.yaml:

options:
  basic:
    use_venv: false


[1]: https://github.com/juju-solutions/layer-basic/pull/105
[2]:
https://charmsreactive.readthedocs.io/en/latest/layer-basic.html#layer-configuration
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20180308/f18f7662/attachment.html>


More information about the Juju mailing list