Search documentation

Type to search the documentation.

Generated API reference

classyak.Secret

yak.Secret

Represents a Secret whose values can be injected into Task Invocations.

Represents a Secret whose values can be injected into Task Invocations.

Secrets can be created from:

  • Named secrets stored in the Yak backend (from_name)
  • Dictionary of key-value pairs (from_dict)
  • .env files (from_dotenv)
  • Local environment variables (from_local_environ)
Python SDK reference · Yak 0.1.19release v0.1.19
provenancec2e8cf7c309abe376f390072b94a9ecd3e633080
Signature
python
Secret(name: Optional[str] = None, data: Optional[Dict[str, str]] = None)

Parameters#

NameTypeDefaultDescription
namepositional-or-keyword Optional[str] None

Name of the secret in the backend (for remote secrets)

datapositional-or-keyword Optional[Dict[str, str]] None

Inline key-value pairs (for inline secrets)

method

Secret.from_name#

Reference a secret by name from the Yak backend.

Reference a secret by name from the Yak backend.

Returns:
Secret instance that will be resolved server-side

Signature
python
from_name(name: str) -> Secret

Parameters#

NameTypeDefaultDescription
namepositional-or-keyword str —

The name of the secret in the organization

Returns#

Secret
No description supplied.
method

Secret.from_dict#

Create a secret from a dictionary of key-value pairs.

Create a secret from a dictionary of key-value pairs.

Signature
python
from_dict(env_dict: Optional[Dict[str, Optional[str]]] = None) -> Secret

Parameters#

NameTypeDefaultDescription
env_dictpositional-or-keyword Optional[Dict[str, Optional[str]]] None

Dictionary of environment variables (None values ignored)

Returns#

Secret

Secret instance with inline data

method

Secret.from_dotenv#

Create a secret from a .env file.

Create a secret from a .env file.

Signature
python
from_dotenv(path: Optional[str] = None, *, filename: str = '.env') -> Secret

Parameters#

NameTypeDefaultDescription
pathpositional-or-keyword Optional[str] None

Starting path to search for .env file (defaults to cwd)

filenamekeyword-only str '.env'

Name of the env file (defaults to ".env")

Returns#

Secret

Secret instance with data loaded from .env file

Raises#

  • FileNotFoundError

    If .env file not found

  • ImportError

    If python-dotenv not installed

method

Secret.from_local_environ#

Create a secret from local environment variables.

Create a secret from local environment variables.

Signature
python
from_local_environ(env_keys: Optional[List[str]] = None) -> Secret

Parameters#

NameTypeDefaultDescription
env_keyspositional-or-keyword Optional[List[str]] None

List of environment variable names to include

Returns#

Secret

Secret instance with data from local environment

method

Secret.get_environment#

Get the environment variables for this secret (inline only).

Get the environment variables for this secret (inline only).

Signature
python
get_environment() -> Dict[str, str]

Returns#

Dict[str, str]

Dictionary of environment variables for inline secrets

method

Secret.get_secret_names#

Get the secret names to resolve server-side (remote only).

Get the secret names to resolve server-side (remote only).

Signature
python
get_secret_names() -> List[str]

Returns#

List[str]

List of secret names for remote secrets, empty for inline

Related guides

Secrets
BoundaryPreview limitations
  • This page is generated from the pinned release schema; update the site pin when a new release should be documented.
  • Lifecycle, persistence and operational context belong in the linked handwritten guides.