Skip to main content
Krywok Logo

Krywok Kit Environment is a developer-centric environment variable manager. It leverages the Krywok Pipeline engine to treat environment variables not just as strings, but as strictly validated and transformed data structures.

Installation

pip install krywok-kit-env

Why use this?

Standard os.environ.get returns strings and provides no validation. Krywok Kit Environment allows you to:

  1. Validate length, patterns, and types immediately.
  2. Transform values (lowercase, strip, cast) during retrieval.
  3. Parse JSON structures stored in environment strings automatically.
  4. Enforce existence for missing variables.

Usage Example

from krywok_kit_env import EnvironmentVariable
from pipeline import Condition, Match, Transform

# Set the path for your .env file
EnvironmentVariable.dotenv_path = ".env"

# Define a validated environment variable
# This will raise an exception if the key is missing or validation fails
SECRET_KEY = EnvironmentVariable[str](
    name="SECRET_KEY",
    type=str,
    conditions={
        Condition.ExactLength: 32
    },
    matches={
        Match.Text.Letters: None
    },
    transform={
        Transform.Lowercase: None
    }
)

# Access the processed value
print(SECRET_KEY.get)

# You can call to get the raw value (Clean variable)
API_PORT: int = EnvironmentVariable[int](name="API_PORT", type=int)()

Pythonic Access Patterns

You don't have to manually call .get every time. The EnvironmentVariable instance implements magic methods to make your code cleaner:

  • Direct Comparison: Use == to compare the variable directly with a value.

    if SECRET_KEY == "expected_hash_value":
        ...
    
  • Boolean Logic: Use it directly in if statements to check if the value is truthy.

    DEBUG_MODE = EnvironmentVariable[bool](name="DEBUG", optional=True)
    
    if DEBUG_MODE:
        print("Debug is enabled")
    
  • String Conversion: Use it directly in f-strings or print().

    print(f"API_URL: {API_URL}")
    
  • Callable shorthand: Call the object like a function to get the value.

    current_key = SECRET_KEY()
    

Core Features

  • Strict Typing: Use Python generics EnvironmentVariable[T] for better IDE support and type safety.
  • JSON Ready: Built-in json.loads support for complex environment configurations.
  • Pipeline Integration: Full access to the Pipeline execution flow (Type Check -> Setup -> Conditions -> Matches -> Transformations).
  • Singleton .env Loading: The .env file is loaded once and shared across all instances.

Documentation

This package uses the Krywok Pipeline logic for its core processing. To learn more about available conditions, matches, and transformations, visit Official Documentation

Metadata

Release files for krywok-kit-env 0.1.1

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

Source distribution (sdist)

Source distribution for krywok-kit-env 0.1.1
File Size Uploaded Provenance Actions
krywok_kit_env-0.1.1.tar.gz 8.8 kB With provenance Details for krywok_kit_env-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for krywok-kit-env 0.1.1
File Interpreter ABI Platform Actions
krywok_kit_env-0.1.1-py3-none-any.whl Python 3 none any Details for krywok_kit_env-0.1.1-py3-none-any.whl

Total release size: 18.5 kB

Release files / krywok_kit_env-0.1.1.tar.gz

Download URL krywok_kit_env-0.1.1.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4f42d2e06cb3b369e1a3f3c54395260e9a6bfc5c868455371f381f2a46da274c
BLAKE2b-256 checksum
How to use checksums
3c63ace5e3c69116c832516508bd2c659893969531dcf8a72ebf6b8f590e5c41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release files / krywok_kit_env-0.1.1-py3-none-any.whl

Download URL krywok_kit_env-0.1.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7705d9f86b472eb0cb93d9ad4363f970167fc1a97b9469462695158a741a9ac
BLAKE2b-256 checksum
How to use checksums
10a5e2814721e1e6a18c02b50b7dbdbf0bce7895d581308e355a73320e65243f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Security for krywok-kit-env 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for krywok_kit_env-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

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

0.1.1 This release

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