Skip to main content

# Varlet

Varlet lets you prompt for variables at runtime, and saves them to a variables module.

## Install

pip install varlet

## Usage

In your settings.py file add:

`python from varlet import variable `

whenever you declare a variable that could change depending on the environment, use:

`python # It is OK to make this True if you are in dev DEBUG = variable("DEBUG", default=False) `

If this “DEBUG” variable is not defined in the variables module (somewhere in your python path), the user is prompted to enter a Python expression to set it.

When the prompt is displayed, the comments directly above the call to variable() are displayed, and the prompt has a default value as specified by the default argument.

## Implementation Details

varlet assumes there is a variables module located somewhere in your Python path. If it is not found, it will attempt to create one based on the location of __main__.

When a variable is set to a value, varlet will eval the value (to make sure it is valid python), and then perform ast.literal_eval(repr(value)) to ensure that the value has a valid representation that can be written to a file. The repr(value) is then appended to the end of the variables module (along with any comments associated with the value).

If STDIN is not a tty-like interface, then a KeyError is raise if the variable is not set in the variables module.

Metadata

Release files for varlet 0.0.8

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

Source distribution (sdist)

Source distribution for varlet 0.0.8
File Size Uploaded Provenance
varlet-0.0.8.tar.gz 5.3 kB Without provenance Details

Release files / varlet-0.0.8.tar.gz

Download URL varlet-0.0.8.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d89df186cc47abd224c6d637624a3cc96aad062b676e7b00201ccb0b0ad8bcf4
BLAKE2b-256 checksum
How to use checksums
477eca0bfd05c2acbeb0f86d3eba5b4e25644407d664378583d91c42ac0fc013
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for varlet 0.0.8

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.

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