dev.tools.environment#

Contributor environment setup.

Module Contents#

Classes#

Constants

Constants for environment.

Config

Get tool config from pyproject.toml.

Functions#

sync_environment_variables

Sync .env with pyproject.toml, optionally setting environment variables.

run

Run command.

run_dev

Run command from dev CLI.

escape

Escape a path, suitable for passing to e.g. run().

Data#

API#

class dev.tools.environment.Constants(
/,
**data: typing.Any,
)#

Bases: pydantic.BaseModel

Constants for environment.

Initialization

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

dev_tool_config: tuple[str, ...]#

(‘tool’,)

Path to dev tool configuration in pyproject.toml.

pylance_version_source: str#

‘.pylance-version’

Path to Pylance version file.

shell: list[str]#

[‘pwsh’, ‘-Command’]

Shell invocation for running arbitrary commands.

uv_run_wrapper: str#

‘./Invoke-Uv.ps1’

Wrapper of uv run with extra setup.

env: str#

‘.env’

Name of environment file.

dev.tools.environment.const#

‘Constants(…)’

dev.tools.environment.sync_environment_variables(
path: pathlib.Path | None = None,
pylance_version: str = '',
setenv: bool = True,
) str#

Sync .env with pyproject.toml, optionally setting environment variables.

dev.tools.environment.run(
*args: str,
check: bool = True,
**kwds,
)#

Run command.

dev.tools.environment.run_dev(
*args: str,
)#

Run command from dev CLI.

dev.tools.environment.escape(
path: str | pathlib.Path,
) str#

Escape a path, suitable for passing to e.g. run().

class dev.tools.environment.Config(
_case_sensitive: bool | None = None,
_nested_model_default_partial_update: bool | None = None,
_env_prefix: str | None = None,
_env_file: pydantic_settings.sources.DotenvType | None = ENV_FILE_SENTINEL,
_env_file_encoding: str | None = None,
_env_ignore_empty: bool | None = None,
_env_nested_delimiter: str | None = None,
_env_parse_none_str: str | None = None,
_env_parse_enums: bool | None = None,
_cli_prog_name: str | None = None,
_cli_parse_args: bool | list[str] | tuple[str, ...] | None = None,
_cli_settings_source: pydantic_settings.sources.CliSettingsSource[Any] | None = None,
_cli_parse_none_str: str | None = None,
_cli_hide_none_type: bool | None = None,
_cli_avoid_json: bool | None = None,
_cli_enforce_required: bool | None = None,
_cli_use_class_docs_for_groups: bool | None = None,
_cli_exit_on_error: bool | None = None,
_cli_prefix: str | None = None,
_cli_implicit_flags: bool | None = None,
_secrets_dir: pydantic_settings.sources.PathType | None = None,
**values: Any,
)#

Bases: pydantic_settings.BaseSettings

Get tool config from pyproject.toml.

Initialization

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config#

‘SettingsConfigDict(…)’

env: dict[str, str]#

‘Field(…)’

classmethod settings_customise_sources(
settings_cls,
**_,
)#

Only load from pyproject.toml.