Skip to main content

Hatch plugin for Docker containers

Project description

hatch-containers

CI/CD CI - Test CD - Build
Package PyPI - Version PyPI - Python Version
Meta code style - black types - Mypy imports - isort License - MIT GitHub Sponsors

This provides a plugin for Hatch that allows the use of containerized environments.

Table of Contents

Installation

pip install hatch-containers

Configuration

The environment plugin name is container.

  • pyproject.toml

    [tool.hatch.envs.<ENV_NAME>]
    type = "container"
    
  • hatch.toml

    [envs.<ENV_NAME>]
    type = "container"
    

Python

If the Python version is set to a multi-character integer like 310 then it will be interpreted as its <MAJOR>.<MINOR> form e.g. 3.10.

If not set, then the <MAJOR>.<MINOR> version of the first python found along your PATH will be used, defaulting to the Python executable Hatch is running on.

Image

The image option specifies the container image to use e.g. python:alpine. It recognizes the placeholder value {version} which will be replaced by the value of the Python option.

Default:

[envs.<ENV_NAME>]
image = "python:{version}"

Command

The command option specifies the command that the container will execute when started.

Default:

[envs.<ENV_NAME>]
command = ["/bin/sleep", "infinity"]

Startup

By default, containers will be started automatically when entered or when running commands and will be stopped immediately after. If you want containers to start automatically upon creation and not be stopped until removal, you can set start-on-creation to true.

Default:

[envs.<ENV_NAME>]
start-on-creation = false

Shell

The shell option specifies the executable that will be used when entering containers. By default, this is set to /bin/bash unless alpine is in the image name, in which case /bin/ash will be used instead.

Notes

Future

  • Support for Windows containers
  • Support for building images

License

hatch-containers is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hatch_containers-0.5.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

hatch_containers-0.5.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file hatch_containers-0.5.0.tar.gz.

File metadata

  • Download URL: hatch_containers-0.5.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for hatch_containers-0.5.0.tar.gz
Algorithm Hash digest
SHA256 56eb43e80cf88c911cf1c3bdcd8741ec88f4a4b1f8dc4003323bc5006d2a706e
MD5 3ad84bf62f82d9efd6c5e148f8ebf0c4
BLAKE2b-256 28c347b3b9fcb2224538a5c1349c9e159d00e22e8973749e9e964d2230b5dbd1

See more details on using hashes here.

File details

Details for the file hatch_containers-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: hatch_containers-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for hatch_containers-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5dca898f7d22b1947a29661f17feae9ebe45f19f8280573c03d653a5fa56cdb1
MD5 df0051d819d801809857d795b46d4dc8
BLAKE2b-256 cf236aaea6f897236ea5e8b577b04aadd7f99ec829864de146fcf60face917e2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page