Skip to main content

Master

https://travis-ci.org/Patouche/pydocktors.svg?branch=master https://codecov.io/gh/Patouche/pydocktors/branch/master/graph/badge.svg https://img.shields.io/pypi/v/pydocktors.svg

Developpment

https://travis-ci.org/Patouche/pydocktors.svg?branch=developpment https://codecov.io/gh/Patouche/pydocktors/branch/developpment/graph/badge.svg

What is it ?

On top of docker, pydocktors is a simple way to declare a decorator to start and shutdown a docker container.

Why to use it ?

You can use it anywhere you want in your python code ! This include test and code…

For example, if you have a application that require a database (for example, MySQL or Neo4J) but you don’t want to install the database globally on your system, you can use the docker decorator !

Or you may need to load a application such as Nginx or Eureka when running your code locally without installing it, this docker decorator is made for you !

Examples

All of them are also available in the examples. Each example are designed to be independent.

Starting a Nginx with a your content and your configuration:

@docktors.docker(
    inject_arg=True,
    image='nginx',
    ports=[(80, 8080)],
    volumes=[
        (TARGET_DIR, '/usr/share/nginx/html', 'ro'),
        (NGINX_CONF, '/etc/nginx/nginx.conf', 'ro')
    ],
    wait_for_port=8080,
)
def main(container):
    logger.info(
        'Nginx container with id %s is %s. Visit http://localhost:8080/',
        container.id, container.status
    )

FAQ

Why this name ?

Because it’s the contraction of 3 famous words : python, docker and decorators

How did it came from ?

It will be a shame if a told you that I didn’t take inspiration from other Open Source project… In fact, as a Java developper, I was aware of this 2 projects :

But after some research, I wonder why there was no python decorator already made to run docker in python scripts. So, for my needs, I decided to do one and to share it !

I hope that it will be helpful for you to.

Authors : Patrick Allain License : MIT

Metadata

Release files for pydocktors 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydocktors 0.0.7
File Size Uploaded
pydocktors-0.0.7.tar.gz 6.9 kB Details

Release files / pydocktors-0.0.7.tar.gz

Download URL pydocktors-0.0.7.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ba081b0f4ced635ae0a7f096865698fcad7a69ee897f3b38322551b0dc8eb124
BLAKE2b-256 checksum
How to use checksums
0053bed7a62e19891f22e42d33dcd6773e783c18232977645403ac94b9f0e7c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.7 This release

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page