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.2.tar.gz
.
File metadata
- Download URL: typed-envs-0.0.2.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7113e60f489936344f03c2e65fdbbbb1115cc8e215b823627d446396efcf4327 |
|
MD5 | 6db935803dd306d7e86f3af95c169e93 |
|
BLAKE2b-256 | 6b931f62547d170ac925631c42289a1fd7d682e0c134bee9fb04882fe61cbda1 |
File details
Details for the file typed_envs-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: typed_envs-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bd4c31e52011cfc7616c09d5b2db239c30190cdff938653c8cd5a05581ca6b8 |
|
MD5 | 71222d53df27949ec6c884136198801d |
|
BLAKE2b-256 | f92110112b09c6a52e0de7e4d45cf22c4df88dc81a6423424843a9ac9377d837 |