Skip to main content

Docker Toolkit for Python

Project description

laituri — Docker Toolkit for Python

CI codecov

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.

# install this package and all development dependencies
pip install -e . -r requirements-dev.txt pip-tools pre-commit && pre-commit install

# manually run lint and type checks
pre-commit run --all-files

# manually run tests
pytest --cov

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

Making a Release

A new release build is released by the CI when a new tag is pushed to the repository:

# bump version number in "laituri/__init__.py"
vim laituri/__init__.py

# pushing a new tag will trigger a new release build
git add .
git commit -m "Become to X.Y.Z"
git tag -a vX.Y.Z -m "Version X.Y.Z"
git push --follow-tags

If a manual release is needed, you can follow up the above steps with:

pip install build twine
git clean -fdx -e .idea/
python -m build .
twine upload dist/*

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

Uploaded Source

Built Distribution

laituri-0.4.2-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for laituri-0.4.2.tar.gz
Algorithm Hash digest
SHA256 367e7589febf3756d34aea8e35227de7b943cdeb1933bdd331c7f9c318689698
MD5 35c4cca79c65a1d83c58549d3789eefb
BLAKE2b-256 59d6b71691c1da024d4f4bd86c31dc039ccedba29b93e59be3a1d191b5b3fadc

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for laituri-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9b2f746b32be8833c3b1e5a2ca66f7ee88541b2645305cc5b6945ba8783fcad4
MD5 3629cc4619e3420a4a69425829e9646f
BLAKE2b-256 7e1c849b89c5a8fa2d47a6a6ed5ab4fda701bbda796780946e296c32014b817e

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