Hatch plugin for Docker containers
Project description
hatch-containers
CI/CD | |
Package | |
Meta |
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
- There must be a
docker
executable along yourPATH
. - The
env-exclude
environment variable filter has no effect.
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
Built Distribution
File details
Details for the file hatch_containers-0.3.0.tar.gz
.
File metadata
- Download URL: hatch_containers-0.3.0.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04823c76f6d617073206231305d83573d019fc8b61bfa9cba6be1b773d533ae1 |
|
MD5 | f31e7db630cfd9a743281b9da40493d5 |
|
BLAKE2b-256 | c0c28e89bdc017c693bdfc8f9bec5fed2c84ae42db02d54ddac26e4c58652967 |
File details
Details for the file hatch_containers-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: hatch_containers-0.3.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.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07e09f2416d91cf712492418ef8cf0003ce7a1cafb6c9fc2fe73ea7e47cd15fb |
|
MD5 | 7247074240ce72b3b77eefadebee8ae1 |
|
BLAKE2b-256 | 2803e650300cf6e49135923acb4dd2fab4fa5f67e95972313bad883715e77922 |