local_settings
Package to deal with saving and retrieving user specific settings.
ASettingRegistry
Bases: ABC
Abstract class to defining structure of registry class.
Source code in client/ayon_core/lib/local_settings.py
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 | |
delete_item(name)
Delete item from settings registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name of the item. | required |
Source code in client/ayon_core/lib/local_settings.py
312 313 314 315 316 317 318 319 | |
get_item(name)
Get item from settings registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name of the item. | required |
Returns:
| Name | Type | Description |
|---|---|---|
value | str | Value of the item. |
Raises:
| Type | Description |
|---|---|
RegistryItemNotFound | If the item doesn't exist. |
Source code in client/ayon_core/lib/local_settings.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |
set_item(name, value)
Set item to settings registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name of the item. | required |
value | str | Value of the item. | required |
Source code in client/ayon_core/lib/local_settings.py
302 303 304 305 306 307 308 309 310 | |
AYONSecureRegistry
Store information using keyring.
Registry should be used for private data that should be available only for user.
All passed registry names will have added prefix AYON/ to easier identify which data were created by AYON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name of registry used as the identifier for data. | required |
Source code in client/ayon_core/lib/local_settings.py
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 | |
delete_item(name)
Delete value stored in the system's keyring.
See also Keyring module_
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name of the item to be deleted. | required |
.. _Keyring module: https://github.com/jaraco/keyring
Source code in client/ayon_core/lib/local_settings.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |
get_item(name, default=_PLACEHOLDER) cached
Get value of sensitive item from the system's keyring.
See also Keyring module_
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name of the item. | required |
default | Any | Default value if the item is not available. | _PLACEHOLDER |
Returns:
| Name | Type | Description |
|---|---|---|
value | str | Value of the item. |
Raises:
| Type | Description |
|---|---|
RegistryItemNotFound | If the item doesn't exist and default is not defined. |
.. _Keyring module: https://github.com/jaraco/keyring
Source code in client/ayon_core/lib/local_settings.py
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 | |
set_item(name, value)
Set sensitive item into the system's keyring.
This uses Keyring module_ to save sensitive stuff into the system's keyring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name of the item. | required |
value | str | Value of the item. | required |
.. _Keyring module: https://github.com/jaraco/keyring
Source code in client/ayon_core/lib/local_settings.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
AYONSettingsRegistry
Bases: JSONSettingRegistry
Class handling AYON general settings registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | Optional[str] | Name of the registry. Using 'None' or not passing name is deprecated. | None |
Source code in client/ayon_core/lib/local_settings.py
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | |
IniSettingRegistry
Bases: ASettingRegistry
Class using :mod:configparser.
This class is using :mod:configparser (ini) files to store items.
Source code in client/ayon_core/lib/local_settings.py
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 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
delete_item_from_section(section, name)
Delete item from section in ini file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
section | str | Section name. | required |
name | str | Name of the item. | required |
Raises:
| Type | Description |
|---|---|
RegistryItemNotFound | If the item doesn't exist. |
Source code in client/ayon_core/lib/local_settings.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
get_item(name)
Gets item from settings ini file.
This gets settings from DEFAULT section of ini file as each item there must reside in some section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name of the item. | required |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Value of item. |
Raises:
| Type | Description |
|---|---|
RegistryItemNotFound | If value doesn't exist. |
Source code in client/ayon_core/lib/local_settings.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | |
get_item_from_section(section, name) cached
Get item from section of ini file.
This will read ini file and try to get item value from specified section. If that section or item doesn't exist, :exc:RegistryItemNotFound is risen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
section | str | Name of ini section. | required |
name | str | Name of the item. | required |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Item value. |
Raises:
| Type | Description |
|---|---|
RegistryItemNotFound | If value doesn't exist. |
Source code in client/ayon_core/lib/local_settings.py
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 | |
set_item(name, value)
Set item to settings ini file.
This saves item to DEFAULT section of ini as each item there must reside in some section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name of the item. | required |
value | str | Value of the item. | required |
Source code in client/ayon_core/lib/local_settings.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
set_item_section(section, name, value)
Set item to specific section of ini registry.
If section doesn't exists, it is created.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
section | str | Name of section. | required |
name | str | Name of the item. | required |
value | str | Value of the item. | required |
Source code in client/ayon_core/lib/local_settings.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
JSONSettingRegistry
Bases: ASettingRegistry
Class using a json file as storage.
Source code in client/ayon_core/lib/local_settings.py
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | |
RegistryItemNotFound
Bases: ValueError
Raised when the item is not found in the keyring.
Source code in client/ayon_core/lib/local_settings.py
23 24 | |
get_addons_resources_dir(addon_name, *args)
Get a directory for storing resources for addons.
Some addons might need to store ad-hoc resources that are not part of addon client package (e.g. because of size). Studio might define dedicated directory to store them with 'AYON_ADDONS_RESOURCES_DIR' environment variable. By default, is used 'addons_resources' in launcher storage (might be shared across platforms).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
addon_name | str | Addon name. | required |
*args | str | Subfolders in the resources directory. | () |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Path to resources directory. |
Source code in client/ayon_core/lib/local_settings.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
get_ayon_appdirs(*args)
Local app data directory of AYON client.
Deprecated
Use 'get_launcher_local_dir' or 'get_launcher_storage_dir' based on a use-case. Deprecation added 24/08/09 (0.4.4-dev.1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args | Iterable[str] | Subdirectories/files in the local app data dir. | () |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Path to directory/file in local app data dir. |
Source code in client/ayon_core/lib/local_settings.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
get_ayon_user_entity(username=None)
AYON user entity used for templates and publishing.
Note
Usually only service and admin users can receive the full user entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username | Optional[str] | Username of the user. If not passed, then the current user in 'ayon_api' is used. | None |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | dict[str, Any]: User entity. |
Source code in client/ayon_core/lib/local_settings.py
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | |
get_ayon_username()
AYON username used for templates and publishing.
Uses current ayon api username.
Returns:
| Name | Type | Description |
|---|---|---|
str | Username. |
Source code in client/ayon_core/lib/local_settings.py
638 639 640 641 642 643 644 645 646 647 648 | |
get_launcher_local_dir(*subdirs)
Get a local directory for launcher.
Local directory is used for storing machine or user-specific data.
The location is user-specific.
Note
This function should be called at least once on the bootstrap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*subdirs | str | Subdirectories relative to local dir. | () |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Path to local directory. |
Source code in client/ayon_core/lib/local_settings.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
get_launcher_storage_dir(*subdirs)
Get a storage directory for launcher.
Storage directory is used for storing shims, addons, dependencies, etc.
It is not recommended, but the location can be shared across multiple machines.
Note
This function should be called at least once on bootstrap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*subdirs | str | Subdirectories relative to storage dir. | () |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Path to storage directory. |
Source code in client/ayon_core/lib/local_settings.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
get_local_site_id()
Get local site identifier.
Identifier is created if does not exist yet.
Source code in client/ayon_core/lib/local_settings.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | |