=====================
Managing environments
=====================

.. currentmodule:: coiled

You can also update, list, or delete Python environments.

Updating environments
---------------------

You can update an existing software environment by calling ``create_software_environment`` with the name of the software environment you want to update and the new specification for the software environment.

If the inputs to ``create_software_environment`` have changed since the last time it was called for a given software environment, the corresponding software environment will be rebuilt using the new inputs and any future uses of the software environment will use the updated version. Repeated calls to :func:`coiled.create_software_environment` with the same inputs are a no-op; to override this you can set ``force_rebuild=True``.

You can't update the software environment being used on an already running cluster. The cluster must first be closed and then restarted to use any updates
made to a software environment.

Listing environments
--------------------

The :meth:`coiled.list_software_environments` function will list all available
software environments:

.. code-block:: python

    coiled.list_software_environments()

There is also a ``account=`` keyword argument which lets you specify the account
which you want to list software environments for.


Deleting environments
---------------------

The :meth:`coiled.delete_software_environment` function can be used to delete
individual software environments. For example:

.. code-block:: python

    coiled.delete_software_environment(name="alice/my-conda-env")

will delete the software environment named "my-conda-env" in the Coiled account
named "alice".
