github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/tiltfile/api/os/__init__.py (about)

     1  from typing import Dict
     2  
     3  name: str = ""
     4  """The name of the operating system. 'posix' (for Linux and MacOS) or 'nt' (for Windows).
     5  
     6  Designed for consistency with
     7  `os.name in Python <https://docs.python.org/3/library/os.html#os.name>`_.
     8  """
     9  
    10  environ = Dict[str, str]
    11  """A dictionary of your environment variables.
    12  
    13  For example, ``os.environ['HOME']`` is usually your home directory.
    14  
    15  Captured each time the Tiltfile begins execution.
    16  
    17  Tiltfile dictionaries support many of the same methods
    18  as Python dictionaries, including:
    19  
    20  - dict.get(key, default)
    21  - dict.items()
    22  
    23  See the `Starlark spec <https://github.com/bazelbuild/starlark/blob/master/spec.md#built-in-methods>`_ for more.
    24  """
    25  
    26  def getcwd() -> str:
    27    """Returns a string representation of the current working directory.
    28  
    29    The current working directory is the directory containing the currently executing Tiltfile.
    30    If your Tiltfile runs any commands, they run from this directory.
    31  
    32    While calling :meth:load or :meth:include to execute another Tiltfile,
    33    returns the directory of the loaded/included Tiltfile.
    34    """
    35    pass
    36  
    37  def getenv(key: str, default=None) -> str:
    38    """Return the value of the environment variable key if it exists, or default if it doesn’t.
    39  
    40    Args:
    41      key: An environment variable name.
    42      default: The value to return if the variable doesn't exist.
    43    """
    44    pass
    45  
    46  def putenv(key: str, value: str):
    47    """Set the environment variable named key to the string value. Takes effect
    48    immediately in the Tilt process. Any new subprocesses will have this
    49    environment value.
    50  
    51    Args:
    52      key: An environment variable name.
    53      value: The new value.
    54    """
    55    pass
    56  
    57  def unsetenv(key: str, value: str):
    58    """Delete the environment variable named key. Takes effect immediately in the
    59    Tilt process. Any new subprocesses will not have this variable.
    60  
    61    Args:
    62      key: An environment variable name.
    63    """
    64    pass