Skip to main content

Substitute environment variables in a string:

>>> import os
>>> from envsubst import envsubst

>>> del os.environ['PS1']
>>> print(envsubst('$USER@$HOST ${PS1:-$}:'))
ashafer01@github.com $:

>>> os.environ['PS1'] = ''
>>> print(envsubst('$USER@$HOST ${PS1:-$}:'))
ashafer01@github.com $:

>>> print(envsubst('$USER@$HOST ${PS1-foo}:'))
ashafer01@github.com :

>>> os.environ['DEFAULT_PROMPT'] = '$'
>>> print(envsubst('$USER@$HOST ${PS1:-$DEFAULT_PROMPT}:'))

Also supports $0, $1, etc. from argv.

Metadata

Release files for envsubst 0.1.5

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

Source distribution (sdist)

Source distribution for envsubst 0.1.5
File Size Uploaded
envsubst-0.1.5.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for envsubst 0.1.5
File Interpreter ABI Platform
envsubst-0.1.5-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 6.7 kB

Release files / envsubst-0.1.5.tar.gz

Download URL envsubst-0.1.5.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d8e402984a84dda4ea7a8a1f7afe1c41e54a1257cfb74c80cb8f991053d97b9b
BLAKE2b-256 checksum
How to use checksums
6d0f8e483ec1f0b3b05ea06c4e5ce6d9cadcfbf8e216e6ddde02496a1fbcfde7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

Release files / envsubst-0.1.5-py2.py3-none-any.whl

Download URL envsubst-0.1.5-py2.py3-none-any.whl
Size 4.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7188f9f2a046e45b63098ce5a7fd84126cbe9e5b73b8ff78eaf6e32122c0caaf
BLAKE2b-256 checksum
How to use checksums
bd295ab85c5e436f9c921a7fab2b2a5c7fa5069c777312586483fa4ca90a7cad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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