unsprawl.utils

Utility functions for Unsprawl.

This module contains shared utilities including logging configuration and version information.

Attributes

Functions

find_open_port([start_port, max_tries])

Find an open local port for binding.

get_project_description()

Return the project description from package metadata (DRY).

configure_logging(verbosity)

Configure root logger formatting and level.

Module Contents

__version__: str = '0.0.1'
_toml = None
find_open_port(start_port=8000, max_tries=100)[source]

Find an open local port for binding.

Parameters:
  • start_port (int) – Port number to start searching from.

  • max_tries (int) – Maximum number of ports to try.

Returns:

An available port number.

Return type:

int

Raises:

OSError – If no open port is found in the specified range.

get_project_description()[source]

Return the project description from package metadata (DRY).

Falls back to reading pyproject.toml if importlib.metadata is unavailable in editable installs.

configure_logging(verbosity)[source]

Configure root logger formatting and level.

Parameters:

verbosity (int) – Verbosity level from CLI: - 0: WARNING - 1: INFO - 2+: DEBUG