Skip to main content

Env2Cli

Desription

Instead of maintain ugly and long entrypoint scripts to call your module with environment variables as arguments from your dockerfile, just add this elegant converting framework from environment variables to cli command line arguments.

Installation

pip install env2cli

Usage

Assume your old dockerfile looked like this

...
ENV POSITIONAL_ARG val
ENV SOME_PARAM value
ENV OTHER_PARAM valy

...

ENTRYPOINT python main.py ${POSITIONAL_ARG} -p ${SOME_PARAM} --other ${OTHER_PARAM} ...

Add new file, for example, entrypoint.py like this:

from main import main
from env2cli import *

argv = bulk_apply([
    Argument('POSITIONAL_ARG'),
    Argument('SOME_PARAM', '-p'),
    Argument('OTHER_PARAM', '--other')
])

main(argv)

And the new dockerfile should be looking like this:

ENV POSITIONAL_ARG val
ENV SOME_PARAM value
ENV OTHER_PARAM valy

...

ENTRYPOINT python entrypoint.py

Or even if your program isn’t python!

ENV POSITIONAL_ARG val
ENV SOME_PARAM value
ENV OTHER_PARAM valy

...

ENTRYPOINT ./myprog $(env2cli.py)
# instead ENTRYPOINT ./myprogram ${POSITIONAL_ARG} -p ${SOME_PARAM} --other ${OTHER_PARAM}

Metadata

Release files for env2cli 0.1.0

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

Source distribution (sdist)

Source distribution for env2cli 0.1.0
File Size Uploaded Provenance
env2cli-0.1.0.tar.gz 2.8 kB Without provenance Details

Release files / env2cli-0.1.0.tar.gz

Download URL env2cli-0.1.0.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
96867cfc8884e7b570b6c520198105e4f97cd06b48c132c1981fa4a82154248c
BLAKE2b-256 checksum
How to use checksums
b5289974355f830b30abef6a7d0828a998e32a6ef6b2d560cd2a650c12efe6c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Security for env2cli 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

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