Skip to main content

Parse static files such as YAML and insert in them data from environment variables

Project description

python-pie

Build Status PyPI version PyPI - Python Version

Python-pie(python insert env) reads key-value pairs from a .env file and can set them as environment variables. It helps in the development of applications following the

Getting Started

pip install python-pie

You can use python-pie to insert env variables to static configurations, like that:

from pie import process_file

filepath = '/docker/configuration.yaml'
process_file(filepath)

The syntax of files supported by python-pie is similar to that of python fstrings:

f"54 {from_env or 'default_value'} some text"

Depends if your environment has a from_env variable or not, python-pie will load it, or in case of absence take the default value

Syntax example

hosts:
  - f"{host}"

loglevel: 4
f"{'log_file_path'}": f"/file/path/{filename or 'tmp.log'}"
log_rotate_count: 1

after process_file(filepath)

hosts:
  - localohst

loglevel: 4
log_file_path: /file/path/tmp.log
log_rotate_count: 1

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

python-pie-0.2.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_pie-0.2.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file python-pie-0.2.1.tar.gz.

File metadata

  • Download URL: python-pie-0.2.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1

File hashes

Hashes for python-pie-0.2.1.tar.gz
Algorithm Hash digest
SHA256 28eb8f33651bab51e4ffa734c65be3452c83e380c370b7c5a806fd55275282a2
MD5 a0cd357c6d453d2b76332b056fe95eb2
BLAKE2b-256 b51cc097150d7600b5a8c7be94305bde57c643987ef4571f4bedbe89141e9cc8

See more details on using hashes here.

File details

Details for the file python_pie-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: python_pie-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1

File hashes

Hashes for python_pie-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f221afd6adc6af2daa9668073d6a4316a7d931d3e4e65454bc0826adc4bce67
MD5 c975def3de9bedeecfc45f846117ed7b
BLAKE2b-256 7a9d6462e06911401f6f5c4d30f453328e7ef8ce454d0b3c2ee86c2d4d3d857d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page