hyfi.main
This module serves as the entry point for the HyFI application.
It imports the necessary classes and objects from the 'config' and 'main' modules, and defines the 'all' list to specify the public interface of this module.
Classes: - GlobalConfig: Represents the global configuration for the HyFI application. - GlobalConfigResolver: Resolves the global configuration for the HyFI application. - HyFIConfig: Represents the configuration for the HyFI application. - HyFI: Represents the main class of the HyFI application.
Objects: - global_config: An instance of the GlobalConfig class representing the global configuration.
GlobalConfig
Bases: UTILs
HyFI global config class. This class is used to store the global configuration
Source code in hyfi/main/config.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
|
about: About
property
Returns the About object associated with the configuration.
If the About object is not yet created, it will be created using the configuration's package name.
Returns:
Type | Description |
---|---|
About
|
The About object associated with the configuration. |
app_name
property
Get the name of the application.
app_version
property
Get the version of the application.
package_name
property
Get the name of the package.
project: Optional[Project]
property
Returns the project associated with the configuration.
Returns:
Type | Description |
---|---|
Optional[Project]
|
Optional[Project]: The project associated with the configuration, or None if no project is set. |
project_dir: Path
property
Get the project root directory.
project_workspace_dir: Path
property
Get the project workspace directory.
__repr__()
__str__()
get_path(path_name, base_dir=None, ensure_exists=False)
Get the path to a directory or file.
Source code in hyfi/main/config.py
inititialize(project_name=None, project_description=None, project_root=None, project_workspace_name=None, global_hyfi_root=None, global_workspace_name=None, num_workers=None, logging_level=None, plugins=None, user_config_path=None, dotenv_file=None, secrets_dir=None, reinit=True, autotime=True, retina=True, verbose=False, **project_kwargs)
Initialize and start hyfi.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_name
|
Optional[str]
|
Name of the project to use. |
None
|
project_description
|
Optional[str]
|
Description of the project that will be used. |
None
|
project_root
|
Optional[str]
|
Root directory of the project. |
None
|
project_workspace_name
|
Optional[str]
|
Name of the project's workspace directory. |
None
|
global_hyfi_root
|
Optional[str]
|
Root directory of the global hyfi. |
None
|
global_workspace_name
|
Optional[str]
|
Name of the global hierachical workspace directory. |
None
|
num_workers
|
Optional[int]
|
Number of workers to run. |
None
|
log_level
|
Log level for the log. |
required | |
plugins
|
Optional[List[str]]
|
A list of plugins to load. e.g. |
None
|
user_config_path
|
Optional[str]
|
Path to the user configuration directory. e.g. |
None
|
config_dirname
|
Name of the configuration directory. e.g. |
required | |
dotenv_file
|
Optional[str]
|
Name of the dotenv file. e.g. |
None
|
secrets_dir
|
Optional[str]
|
Name of the secrets directory. e.g. |
None
|
reinit
|
bool
|
Whether to reinitialize the global config. |
True
|
autotime
|
bool
|
Whether to automatically set time and / or keep track of run times. |
True
|
retina
|
bool
|
Whether to use retina or not. |
True
|
verbose
|
Union[bool, int]
|
Enables or disables logging |
False
|
Source code in hyfi/main/config.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
terminate()
Terminate hyfi config by stopping joblib
Returns:
Type | Description |
---|---|
None
|
True if successful False |
Source code in hyfi/main/config.py
GlobalConfigResolver
A class that resolves global configuration paths for HyFI.
Source code in hyfi/main/config.py
__get_path__(path_name, base_dir=None)
staticmethod
Get the path to a directory or file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path_name
|
str
|
The name of the path. |
required |
base_dir
|
Optional[str]
|
The base directory to resolve the path from. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The resolved path. |
Source code in hyfi/main/config.py
__project_root_path__()
staticmethod
__project_workspace_path__()
staticmethod
HyFI
Bases: BATCHER
, Composer
, GRAPHICs
, PIPELINEs
Primary class for the hyfi config package
Source code in hyfi/main/main.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
|
app_name
property
Get the name of the application.
app_version
property
Get the version of the application.
config: HyFIConfig
property
Get the global config.
dryrun: bool
property
Get the dryrun flag.
project: Optional[Project]
property
writable
Get the project.
resolve: bool
property
Get the resolve flag.
variables: Variables
property
Get the global variables.
verbose: bool
property
Get the verbose flag.
Env(**kwargs)
staticmethod
Return the Env.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**kwargs
|
Additional keyword arguments to pass to the Env constructor. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Env |
Env
|
An instance of the Env class. |
JobLib(**kwargs)
staticmethod
Return the joblib pipe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**kwargs
|
Additional keyword arguments to pass to the JobLibConfig constructor. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
JobLibConfig |
JobLib
|
An instance of the JobLibConfig class. |
Source code in hyfi/main/main.py
Task(**kwargs)
staticmethod
Return the TaskConfig.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**kwargs
|
Additional keyword arguments to pass to the TaskConfig constructor. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
TaskConfig |
Task
|
An instance of the TaskConfig class. |
Source code in hyfi/main/main.py
Variables(**kwargs)
staticmethod
Return the Variables.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**kwargs
|
Additional keyword arguments to pass to the Variables constructor. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Variables |
Variables
|
An instance of the Variables class. |
Source code in hyfi/main/main.py
Workflow(**kwargs)
staticmethod
Return the WorkflowConfig.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**kwargs
|
Additional keyword arguments to pass to the WorkflowConfig constructor. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
WorkflowConfig |
Workflow
|
An instance of the WorkflowConfig class. |
Source code in hyfi/main/main.py
initialize(project_name=None, project_description=None, project_root=None, project_workspace_name=None, global_hyfi_root=None, global_workspace_name=None, num_workers=None, logging_level=None, plugins=None, user_config_path=None, dotenv_file=None, secrets_dir=None, reinit=True, autotime=True, retina=True, verbose=False, **project_kwargs)
staticmethod
Initialize and start hyfi.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_name
|
Optional[str]
|
Name of the project to use. |
None
|
project_description
|
Optional[str]
|
Description of the project that will be used. |
None
|
project_root
|
Optional[str]
|
Root directory of the project. |
None
|
project_workspace_name
|
Optional[str]
|
Name of the project's workspace directory. |
None
|
global_hyfi_root
|
Optional[str]
|
Root directory of the global hyfi. |
None
|
global_workspace_name
|
Optional[str]
|
Name of the global hierachical workspace directory. |
None
|
num_workers
|
Optional[int]
|
Number of workers to run. |
None
|
logging_level
|
Optional[str]
|
Log level for the log. |
None
|
plugins
|
Optional[List[str]]
|
A list of plugins to load. e.g. |
None
|
user_config_path
|
Optional[str]
|
Path to the user configuration directory. e.g. |
None
|
config_dirname
|
Name of the configuration directory. e.g. |
required | |
dotenv_file
|
Optional[str]
|
Name of the dotenv file. e.g. |
None
|
secrets_dir
|
Optional[str]
|
Name of the secrets directory. e.g. |
None
|
reinit
|
bool
|
Whether to reinitialize the global config. |
True
|
autotime
|
bool
|
Whether to automatically set time and / or keep track of run times. |
True
|
retina
|
bool
|
Whether to use retina or not. |
True
|
verbose
|
Union[bool, int]
|
Enables or disables logging |
False
|
Source code in hyfi/main/main.py
initialize_global_hyfi(package_path, version, plugins=None, user_config_path=None, config_dirname=None, dotenv_file=None, secrets_dir=None, **kwargs)
staticmethod
Initializes the global HyFI instance. This function should be called before any other HyFI function. A plugin is a python module which contains a configuration module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package_path
|
str
|
Path to the package root folder. e.g. |
required |
version
|
str
|
Version of the package. e.g. |
required |
plugins
|
Optional[List[str]]
|
A list of plugins to load. e.g. |
None
|
user_config_path
|
Optional[str]
|
Path to the user configuration directory. e.g. |
None
|
config_dirname
|
Optional[str]
|
Name of the configuration directory. e.g. |
None
|
dotenv_file
|
Optional[str]
|
Name of the dotenv file. e.g. |
None
|
secrets_dir
|
Optional[str]
|
Name of the secrets directory. e.g. |
None
|
**kwargs
|
Additional arguments to be set as attributes. |
{}
|
Source code in hyfi/main/main.py
print_about(**args)
staticmethod
run(config_group=None, overrides=None, config_data=None, global_package=False, dryrun=False, **kwargs)
staticmethod
Run the config by composing it and running it
Source code in hyfi/main/main.py
run_command(**config)
staticmethod
run_config(config, dryrun=False)
staticmethod
Run the provided config
Source code in hyfi/main/main.py
run_intantiatable(config, dryrun=False)
staticmethod
Run the config by composing it and running it
Source code in hyfi/main/main.py
set_project(project)
staticmethod
terminate()
staticmethod
Terminate the global config.
Returns:
Name | Type | Description |
---|---|---|
bool |
None
|
True if termination was successful, False otherwise. |
HyFIConfig
Bases: BaseModel
HyFI root config class. This class is used to store the configuration