Configuration¶
Settings, environment variables, and the warning every deprecation emits.
PmlabSettings
¶
Bases: BaseSettings
pmlab runtime configuration.
All fields can be overridden via environment variables
PMLAB_ARTIFACTS_DIR, PMLAB_WORKSPACE, PMLAB_CACHE_DIR, PMLAB_CACHE_TTL, PMLAB_LOG_LEVEL, POLY_API_KEY, POLY_API_SECRET, POLY_API_PASSPHRASE, GAMMA_API_BASE, CLOB_API_BASE
model_config
class-attribute
instance-attribute
¶
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
env_prefix="PMLAB_",
extra="ignore",
populate_by_name=True,
)
artifacts_dir
class-attribute
instance-attribute
¶
artifacts_dir: Path = Field(
default=Path("artifacts"),
description="Root artifacts directory",
)
workspace
class-attribute
instance-attribute
¶
workspace: str = Field(
default="ops_daily",
description="Active workspace name",
validation_alias=AliasChoices(
"PMLAB_WORKSPACE", "PMLAB_WORKSPACE_NAME"
),
)
cache_dir
class-attribute
instance-attribute
¶
cache_dir: Path = Field(
default=Path(".pmlab_cache"),
description="Disk cache directory",
)
cache_ttl
class-attribute
instance-attribute
¶
cache_ttl: int = Field(
default=3600, description="Cache TTL in seconds"
)
log_level
class-attribute
instance-attribute
¶
log_level: str = Field(
default="INFO",
description="Log level: DEBUG, INFO, WARNING, ERROR",
)
poly_api_key
class-attribute
instance-attribute
¶
poly_api_key: str = Field(default='', alias='POLY_API_KEY')
poly_api_secret
class-attribute
instance-attribute
¶
poly_api_secret: str = Field(
default="", alias="POLY_API_SECRET"
)
poly_api_passphrase
class-attribute
instance-attribute
¶
poly_api_passphrase: str = Field(
default="", alias="POLY_API_PASSPHRASE"
)
gamma_api_base
class-attribute
instance-attribute
¶
gamma_api_base: str = Field(
default="https://gamma-api.polymarket.com",
alias="GAMMA_API_BASE",
)
clob_api_base
class-attribute
instance-attribute
¶
clob_api_base: str = Field(
default="https://clob.polymarket.com",
alias="CLOB_API_BASE",
)
trades_path
property
¶
trades_path: Path
Path to the forward paper trades file in the active workspace.
has_api_credentials
property
¶
has_api_credentials: bool
Return True if all three POLY_API_* credentials are set.
get_settings
¶
get_settings() -> PmlabSettings
Return a PmlabSettings instance loaded from environment / .env file.
PmlabDeprecationWarning
¶
Bases: DeprecationWarning
A pmlab name, argument or format is deprecated and will be removed in a later major release.
It is a DeprecationWarning, so the usual filters apply, and it has its own name so a
project can single out pmlab's: -W error::pmlab.PmlabDeprecationWarning turns only these
into errors (for instance in CI, to find every call to update before the next major release).