Skip to main content

Sugar

CI Python Versions Package Version License Discord

Simplify the usage of containers.

You may be thinking, why do I need a new library that wrap-up docker-compose or podman-compose if they are already really simple to use?

Yes, they are simple to use, but if you have some other parameters to the compose command line, it could be very tedious to write them every time such as --env-file, --project-name, --file, etc.

So, in this case we could use something like a script or make, right?

Yes, and just for one project it would be good enough. But, if you maintain or collaborate a bunch of projects, it would be like a boiler plate.

Additionally, if you are maintaining some extra scripts in order to improve your containers stack, these scripts would be like a boilerplate as well.

So, the idea of this project is to organize your stack of containers, gathering some useful scripts and keeping this information centralized in a configuration file. So the command line would be very simple.

How to Install

$ pip install containers-sugar

Features

The commands from docker-compose available are:

  • build
  • config
  • create
  • down
  • events
  • exec
  • images
  • kill
  • logs
  • pause
  • port
  • ps
  • pull
  • push
  • restart
  • rm
  • run
  • start
  • stop
  • top
  • unpause
  • up
  • version

These commands are available in the main profile/plugin, so you don't need to specify any extra parameter to access them.

For extra commands, we are gathering them into a profile/plugin called ext, so you can access them using something like: sugar compose-ext restart.

The current available ext commands are:

  • start -> alias for up
  • restart -> runs stop and up

How to use it

First you need to place the config file .sugar.yaml in the root of your project. This is an example of a configuration file:

backend: compose
defaults:
  profile: ${{ env.ENV }}
profiles:
  profile1:
    project-name: project1
    config-path:
      - containers/tests/profile1/compose.yaml
    env-file: .env
    services:
      default:
        - service1
        - service3
      available:
        - name: service1
        - name: service2
        - name: service3
  profile2:
    project-name: null
    config-path: containers/tests/profile2/compose.yaml
    env-file: .env
    services:
      available:
        - name: service1
        - name: service3

Some examples of how to use it:

  • build the defaults services (service1,service3) for profile1: sugar build --profile profile1

  • build the all services (there is no default service defined) for profile2: sugar build --profile profile2

  • build all services (ignore default) for profile1: sugar build --profile profile1 --all

  • start the default services for profile1: sugar compose-ext start --profile profile1

  • restart all services (ignore defaults) for profile1: sugar compose-ext restart --profile profile1 --all

  • restart service1 and service2 for profile1: sugar compose-ext restart --profile profile1 --services service1,service2

NOTE: If you use: default: profile: ${{ env.ENV }}, you don't need to give --profile <PROFILE_NAME>, except if you want a different profile than the default one.

Podman Extension (Experimental)

Sugar now includes experimental support for Podman through the podman-ext extension. This extension allows you to use Podman as a container engine backend instead of Docker, with both standard container operations and experimental commands.

Key Features

See the Podman Extension documentation for detailed usage instructions and configuration options.

Metadata

Release files for containers-sugar 1.19.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for containers-sugar 1.19.3
File Size Uploaded
containers_sugar-1.19.3.tar.gz 42.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for containers-sugar 1.19.3
File Interpreter ABI Platform
containers_sugar-1.19.3-py3-none-any.whl Python 3 none any Details

Total release size: 96.7 kB

Release files / containers_sugar-1.19.3.tar.gz

Download URL containers_sugar-1.19.3.tar.gz
Size 42.6 kB
Tags Source
SHA-256 checksum
How to use checksums
14d27220fe6fc414d126f7f4eb7d5264c97934d4854a7a72c60cd4c04a577741
BLAKE2b-256 checksum
How to use checksums
7f2f6b572b61cd9d41d90b919d06096c92cf877e08eb4b07ce519adb6c03b917
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.2 CPython/3.10.21 Linux/6.17.0-1022-azure

Release files / containers_sugar-1.19.3-py3-none-any.whl

Download URL containers_sugar-1.19.3-py3-none-any.whl
Size 54.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d855543680be3a2cbef431c15c9e1d3c4520941942c02b19f9a79574b057499
BLAKE2b-256 checksum
How to use checksums
924a20460ab6ef3faf72c8299fb768d8c19ba8431e8b4e2d06a1a0a4e764fa3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.2 CPython/3.10.21 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

This release

1.19.3 This release

2 release files

1.19.2

2 release files

1.19.1

2 release files

1.19.0

2 release files

1.18.0

2 release files

1.16.1

2 release files

1.16.0

2 release files

1.15.0

2 release files

1.14.2

2 release files

1.14.1

2 release files

1.14.0

2 release files

1.13.0

2 release files

1.12.0

2 release files

1.11.2

2 release files

1.10.0

2 release files

1.9.3

2 release files

1.9.2

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page