typed_envs is used to create specialized EnvironmentVariable objects that behave exactly the same as any other instance of the `typ` used to create them.
Project description
typed_envs is used to create specialized EnvironmentVariable objects that behave exactly the same as any other instance of the typ used to create them.
- typed_envs is used for:
defining your envs in a readable, user friendly way
enhancing type hints for the returned instances
enhancing __repr__ of the returned instance with extra contextual information
In the example below, some_var can be used just like as any other int object.
` import typed_envs some_var = typed_envs.create_env("SET_WITH_THIS_ENV", int, 10) >>> isinstance(some_var, int) True >>> isinstance(some_var, EnviromentVariable) True `
- There are only 2 differences between some_var and int(10):
some_var will properly type check as an instance of both int and EnvironmentVariable
some_var.__repr__() will include contextual information about the EnvironmentVariable.
` >>> some_var <EnvironmentVariable[name=`SET_WITH_THIS_ENV`, type=int, default_value=10, current_value=10, using_default=True]> >>> str(some_var) "10" >>> some_var + 5 15 >>> 20 / some_var 2 `
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file typed_envs-0.0.5.tar.gz
.
File metadata
- Download URL: typed_envs-0.0.5.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5432b9800bfef965b37204ca946d864a29fa072b9560faf1cc7de728c3a00105 |
|
MD5 | b0b278d6c20e5b31194358394e75cf97 |
|
BLAKE2b-256 | d7660c34da23de5d4651ad557dfa73c7ff869b02690d64c81763d2bc3582aa82 |
File details
Details for the file typed_envs-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: typed_envs-0.0.5-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 856ad258fd3584f3418c84b2cd3dc14c0c13e504fce1b7b48ff07fb05dc509d4 |
|
MD5 | b89fa5cae664f927a8760a98cd0d6e22 |
|
BLAKE2b-256 | 76288f0c6b90ae503718ac284db622af35ebba15f11f9a9f91931c513b9fa0c0 |