THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
Undocumented
| Method | __init__ |
Initialize the DotEnv service and prepare the .env file. |
| Method | __parse |
Parse a value from the .env file into its corresponding Python type. |
| Method | __serialize |
Serialize a Python value for storage in a .env file. |
| Method | all |
Return all environment variables from the resolved .env file. |
| Method | get |
Retrieve the value of an environment variable. |
| Method | reload |
Reload environment variables from the .env file. |
| Method | set |
Set an environment variable in the .env file and process environment. |
| Method | unset |
Remove an environment variable from the .env file and process environment. |
| Class Variable | __slots__ |
Undocumented |
| Class Variable | _lock |
Undocumented |
| Instance Variable | __cache |
Undocumented |
| Instance Variable | __resolved |
Undocumented |
Initialize the DotEnv service and prepare the .env file.
| Parameters | |
path:str or None, optional | Path to the .env file. Defaults to .env in the current working
directory. |
| Returns | |
None | This method does not return a value. |
| Raises | |
OSError | If the .env file cannot be created or accessed. |
RuntimeError | If an unexpected error occurs during initialization. |
Parse a value from the .env file into its corresponding Python type.
Notes
Recognizes 'none', 'null', 'nan', 'nil' (case-insensitive) as null
values. Attempts to use EnvironmentCaster for advanced type parsing.
Falls back to ast.literal_eval for literal evaluation. Returns the
original string if all parsing attempts fail.
| Parameters | |
value:object | The value to parse, typically a string from the .env file or a Python object. |
| Returns | |
object | The parsed Python value. Returns None for recognized null representations, a boolean for "true"/"false" strings, a Python literal (list, dict, int, etc.) if possible, or the original string if no conversion is possible. |
object, type_hint: str | EnvironmentValueType | None = None) -> str:
(source)
¶
Serialize a Python value for storage in a .env file.
| Parameters | |
value:object | The value to serialize. Supported types include None, str, int, float, bool, list, dict, tuple, and set. |
typestr | EnvironmentValueType | None, optional | An explicit type hint to guide serialization. |
| Returns | |
str | The serialized string representation of the input value, suitable for storage in a .env file. Returns "null" for None values. |
Return all environment variables from the resolved .env file.
| Returns | |
dict | Dictionary mapping environment variable names (str) to their parsed
Python values. Only variables present in the .env file are included. |
Retrieve the value of an environment variable.
| Parameters | |
key:str | Name of the environment variable to retrieve. |
default:object | None, optional | Value to return if the key is not found. Defaults to None. |
| Returns | |
object | Parsed value of the environment variable if found, otherwise default. |
| Raises | |
TypeError | If key is not a string, or if the stored value is incompatible
with its declared type. |
ValueError | If key is not a valid environment variable name, or if the stored
value cannot be decoded for its declared type. |
Reload environment variables from the .env file.
Reload all environment variables from the .env file into the current
process environment, overriding any existing values.
| Returns | |
bool | True if environment variables were successfully reloaded. |
| Raises | |
RuntimeError | If an error occurs during the reload operation. |
str, value: str | float | bool | list | dict | tuple | set, type_hint: str | EnvironmentValueType | None = None, *, only_os: bool = False) -> bool:
(source)
¶
Set an environment variable in the .env file and process environment.
Notes
Ensures thread safety, validates the key, serializes the value, writes to
the .env file, and updates the process environment.
| Parameters | |
key:str | Name of the environment variable to set. |
value:str | float | bool | list | dict | tuple | set | Value to assign to the environment variable. |
typestr | EnvironmentValueType | None, optional | Type hint to guide serialization of the value. |
onlybool, optional | If True, set only in the process environment, not in the .env file. |
| Returns | |
bool | True if the environment variable was set successfully. |
| Raises | |
TypeError | If key is not a string, if value is not one of the supported
types, or if type_hint is neither a string nor an
EnvironmentValueType. |
ValueError | If key is not a valid environment variable name, or if value
cannot be serialized for the requested type. |
RuntimeError | If type_hint is a string that does not name a member of
EnvironmentValueType. |
Remove an environment variable from the .env file and process environment.
Notes
This method is thread-safe. If the variable does not exist, returns True.
| Parameters | |
key:str | Name of the environment variable to remove. |
onlybool, optional | If True, remove only from the process environment, not from the .env file. |
| Returns | |
bool | True if the environment variable was removed or did not exist. |
| Raises | |
TypeError | If key is not a string. |
ValueError | If key is not a valid environment variable name. |