Skip to main content

Docker Toolkit for Python

Project description

laituri — Docker Toolkit for Python

CIcodecov

laituri is a set of Docker-related Python snippets used at Valohai. You can use it with Python >= 3.6.

Usage

Configuration

You can configure your used docker command if it is not the default docker, using laituri settings. Example:

laituri.settings.DOCKER_COMMAND = 'docker'

Docker Credential Manager

Laituri contains a docker credentials manager which can be used for example when pulling images. It logs in and out using the docker cli. Example:

from laituri.docker.credential_manager import get_credential_manager

my_credentials = {
    'username': 'SmolShark1',
    'password': 'sharksWithLazers',
}

with get_credential_manager(
    image='python:latest',
    registry_credentials=my_credentials,
    log_status=print  # Any callable
):
    # Do your docker things!

Development

Installing editable library version in the current virtual environment.

pip install -e '.[dev]'   # optionally replace . with the path to laituri source root
isort -y                  # automatically enforce import style rules
flake8                    # run code style checker
pydocstyle                # run documentation style checker
pytest --cov              # run unit tests and print test coverage

python
>>> import laituri; print(laituri.__version__)

Making a Release

Bump the version number accordingly in laituri/__init__.py and then...

# `pip install twine` if you don't have it (PyPI project uploader)
# `pip install build` if you don't have it (PEP517 package builder)
# NOTE: the following will delete everything except `.idea/` in source directory but not tracked by git!
git clean -fdx -e .idea/
python -m build .
twine upload dist/*

# and update git remote
git add .
git commit -m "Bump to v***"
git push

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

laituri-0.4.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

laituri-0.4.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file laituri-0.4.0.tar.gz.

File metadata

  • Download URL: laituri-0.4.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for laituri-0.4.0.tar.gz
Algorithm Hash digest
SHA256 aa04cc48531e798752d6db6aacf53a99a938f6adc53cb12ba229577309c43077
MD5 efa0beafa978a04865f61bd74e95489c
BLAKE2b-256 6e74ad9e5f235d743d7b3287fee590bba7916dd356f27c1d07fc1da8ddeb117d

See more details on using hashes here.

File details

Details for the file laituri-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: laituri-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for laituri-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bec54e3db8ac51a658a3c6742a34628b3d3ac1dd970f0062ff5b2eb21d85ba30
MD5 a902258360334ec5766cdf1bf10a2d31
BLAKE2b-256 dd217d41362bc38a4c21b759bb06d3c257f0b8f33fd82d2ae7371dff1f93e35b

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