Skip to main content

Env Parser

A friendly enviroment variable parser to describe envs and parse them. This will make documenting environment variables easier.

Basic Usage

Import the config function and provide a configuration .yaml or .yml file to it as bellow:

envs:
    env_id:
        name: string
        description: string
        options: [value_type]
        required: true | false
        value_type: str | int | bool | float

example:

envs:
  redis_url:
    name: 'REDIS_URL'
    description: "The redis database URL"
    options: ['redis://localhost:6379']
    required: true
    value_type: str

The config function returns a dict with the parsed envs converted to it's type.

Env Properties

  • name: it should be the same string as in your .env file
  • description: a short description of what is it
  • options: a list of the possible values the env can receive
    • If any different value is provided, it will issue an error
  • required: if the env variable is required or not
  • value_type: a string representing the convertion type of the env value
    • Currently supports: str, int, bool and float

Multiple Environs

To use multiple environs, must set the multi key to true and you have to add them as top level after the envs: directive. We have three possible environs: development, staging, production.

envs:
    multi: true
    active: 'development' | 'staging' | 'production' 
    development:
        # Normal env declaration
    staging:
        # Normal env declaration
    production:
        # Normal env declaration

In your .env (or wherever you put your envs), for each type of environ, the env must have the correct prefix:

  • DEV_ for development
  • STAG_ for staging
  • PROD_ for production

The loader will return a tuple: (active, envs) with the active environ and all of the parsed environs, respectively.

If no active is provided, it will return (None, envs).

If you enable environs, you can't have misplaced envs outside of them to avoid possible security issues.

Possible Errors

  • If an environment is empty, it will issue a waring
  • If a name different than the reserved ones for a eviron is giver, it will issue an error
    • Custom environs are in progress!
  • If your not using environments and make use of the active: true|false directive, it will treat it as a env variable and issue a invalid env error

Metadata

Release files for envify 1.0.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 envify 1.0.0
File Size Uploaded Provenance Actions
envify-1.0.0.tar.gz 3.6 kB Without provenance Details for envify-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for envify 1.0.0
File Interpreter ABI Platform Actions
envify-1.0.0-py3-none-any.whl Python 3 none any Details for envify-1.0.0-py3-none-any.whl

Total release size: 8.6 kB

Release files / envify-1.0.0.tar.gz

Download URL envify-1.0.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fe6b6b551824a381a599c8ea969e750a1279d9225ba33568c2221c64af81c7b8
BLAKE2b-256 checksum
How to use checksums
97ff049e84fdbfa502c06794cf62e177c057194d1d7b1a2300dff88f4d2f9ede
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Linux/6.5.0-1018-azure

Release files / envify-1.0.0-py3-none-any.whl

Download URL envify-1.0.0-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07dec5cf50a6a8ed065fef239544ef651443fcb238ad02714e18131194470991
BLAKE2b-256 checksum
How to use checksums
947f9331df6a3b3961e00ea8c9e7bf46121437271badb9322c6999d6d162d6fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Linux/6.5.0-1018-azure

Security for envify 1.0.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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files 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