f_lib package

Finley library.

class f_lib.Environment[source]

Bases: object

Object to simplify getting information about the runtime environment.

__init__(*, environ: dict[str, str] | None = None, root_dir: Path | None = None) None[source]

Instantiate class.

Parameters:
  • environ – Environment variables.

  • root_dir – Root directory of the environment (e.g. pathlib.Path.cwd()).

root_dir: Path

Root directory of the environment.

sys: SystemInfo

Information about the system.

property ci: bool

Return CI status.

Returns:

bool

property debug: bool

Get debug setting from the environment.

property verbose: bool

Get verbose setting from the environment.

copy() Self[source]

Copy the contents of this object into a new instance.

Returns:

New instance with the same contents.

final class f_lib.OsInfo[source]

Bases: object

Information about the operating system running on the current system.

static __new__(cls, *args: object, **kwargs: object) OsInfo[source]

Create a new instance of class.

This class is a singleton so it will always return the same instance.

property is_darwin: bool

Operating system is Darwin.

property is_linux: bool

Operating system is Linux.

property is_macos: bool

Operating system is macOS.

Does not differentiate between macOS and Darwin.

property is_posix: bool

Operating system is posix.

property is_windows: bool

Operating system is Windows.

property name: str

Operating system name set to lowercase for consistency.

property user_config_dir: Path

Path to the config directory for the user.

  • ~/.config

  • %USERPROFILE%/AppData/Local

  • %USERPROFILE%/AppData/Roaming

property user_data_dir: Path

Path to data directory tied to the user.

  • ~/.local/share

  • %USERPROFILE%/AppData/Local

  • %USERPROFILE%/AppData/Roaming

classmethod clear_singleton() None[source]

Clear singleton instances.

Intended to only be used for running tests.

final class f_lib.SystemInfo[source]

Bases: object

Information about the system running the application.

static __new__(cls, *args: object, **kwargs: object) SystemInfo[source]

Create a new instance of class.

This class is a singleton so it will always return the same instance.

property architecture: Literal['amd32', 'amd64', 'arm32', 'arm64']

System’s CPU architecture.

property is_32bit: bool

Whether the system is 32-bit.

property is_64bit: bool

Whether the system is 64-bit.

property is_arm: bool

Whether the system is arm based.

property is_frozen: bool

Whether or not app is running from a frozen package.

property is_x86: bool

Whether the system is x86.

property os: OsInfo

Operating system information.

classmethod clear_singleton() None[source]

Clear singleton instances.

Intended to only be used for running tests.

exception f_lib.UnknownPlatformArchitectureError[source]

Bases: Exception

Raised when the platform architecture can’t be determined.

__init__(value: str) None[source]

Instantiate class.

Parameters:

value – The value causing the architecture to be unknown.

f_lib.__version__: str = '0.3.1.dev11'

Version of the Python package presented as a string.

Dynamically set upon release by [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning).

f_lib.__version_tuple__: tuple[int, int, int] | tuple[int, int, int, str] = (0, 3, 1, 'dev11')

Version of the Python package presented as a tuple.

Dynamically set upon release by [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning).

Submodules

Subpackages