Options
PyPSA package options.
This class provides a hierarchical structure for managing package options and
the functionality can be accessed via pypsa.options.
pypsa.__getattr__
¶
__getattr__(name: str) -> Any
Get the value of an option at the specified path.
Examples:
>>> pypsa.options.general.allow_network_requests
True
>>> pypsa.options.params.statistics.round
5
pypsa.__setattr__
¶
__setattr__(name: str, value: Any) -> None
Set the value of an option at the specified path.
Examples:
Set the option to False:
>>> pypsa.options.general.allow_network_requests = False
>>> pypsa.options.general.allow_network_requests
False
Reset back to default:
>>> pypsa.options.reset_all()
pypsa.describe
¶
describe() -> None
Print documentation for options node via attribute access.
Examples:
Print all options:
>>> pypsa.options.describe()
PyPSA Options
=============
general.allow_network_requests:
Default: True
Description: Allow PyPSA to make network requests...
...
pypsa.get_option
¶
get_option(path: str) -> Any
Get the value of an option at the specified path.
Parameters:
-
path(str) –Path to the option. Must be in the format "category.option_name" or "category.subcategory.option_name"
Returns:
-
Any–The value of the option.
Examples:
>>> pypsa.options.get_option("general.allow_network_requests")
True
>>> pypsa.options.get_option("params.statistics.round")
5
pypsa.set_option
¶
set_option(path: str, value: Any) -> None
Set the value of an option at the specified path.
Parameters:
-
path(str) –Path to the option. Must be in the format "category.option_name" or "category.subcategory.option_name"
-
value(Any) –Value to set for the option.
Examples:
Set the option to False:
>>> pypsa.options.set_option("general.allow_network_requests", False)
>>> pypsa.options.general.allow_network_requests
False
Reset back to default:
>>> pypsa.options.reset_all()
>>> pypsa.options.general.allow_network_requests
True
pypsa.reset_option
¶
reset_option(path: str) -> None
Reset a single option to its default value.
Parameters:
-
path(str) –Path to the option. Must be in the format "category.option_name" or "category.subcategory.option_name"
Examples:
Set an option to a non-default value:
>>> pypsa.set_option("general.allow_network_requests", False)
>>> pypsa.options.general.allow_network_requests
False
Reset just that option:
>>> pypsa.reset_option("general.allow_network_requests")
>>> pypsa.options.general.allow_network_requests
True
pypsa._options.option_context
¶
option_context(*args: Any) -> Generator[None, None, None]
Context manager to temporarily set options.
Parameters:
-
*args((str, Any), default:()) –Must be passed in pairs of option_name and value. Option_name must be in the format "category.option_name" or "category.subcategory.option_name"
- User Guide Usage Options Setting options
- Home Overview Release Notes v0.33.0 7th February 2025 Features