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.7.

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.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: laituri-0.4.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.12

File hashes

Hashes for laituri-0.4.1.tar.gz
Algorithm Hash digest
SHA256 94800cfb04f145ac0a65ac990c5c10cf13b8181ffbac2cb6a3f9fb4081f479a5
MD5 a6efea5ebfaeb92644e7d43e0e4d3f7e
BLAKE2b-256 9319d5539a045f624fb4206a6fc5875473b6a95dcf938dbea108e1fd5e5e1656

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for laituri-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 97ba5c46ed5d72c6b2d1d5afb81f04769d01904768a1ded5582c6981764ece76
MD5 8cbbd1bec374670d2aaa63df22faccb4
BLAKE2b-256 c735c64b2c763a68b1c0ed75f27c1563a873f41a6114d63cb2933e237bcacb4e

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