Environments

envless.environments.list_all()

Collect every environment in a project

def list_all(
    project: str,
    *,
    limit: int | None = None,
    offset: int | None = None,
    search: str | None = None,
    order: str | None = None,
    product: str | None = None,
    timeout: float | None = None,
) -> list[EnvironmentSummaryResource]

Walks every page of the environments in a project and returns one flat list. limit sets the page size, capped at 100, not the number of rows you get back, so raising or lowering it changes the request count and nothing else.

All rows are buffered in memory before the call returns, and each row has the same fields list returns, exposed and updatedAt included. Environment counts are small by design, since the allowance is per project rather than per workspace, so this is usually the read you want.

Example

from envless import envless

environments = envless.environments.list_all('api')

print(len(environments))

Parameters

ParameterTypeRequiredDescription
projectstrYesProject slug or uniqueId that owns the environments.
productstrNoProduct slug that disambiguates an ambiguous project slug.
limitintNoPage size used for each underlying request, capped at 100.
offsetintNoRows to skip before collection starts.
searchstrNoCase insensitive substring match on the environment name or slug.
orderstrNoasc or desc sorts by creation time, oldest or newest first. Anything else, or nothing, sorts by name.
timeoutfloatNoSeconds each attempt of this call may take, the response body included, before it raises EnvlessNetworkError with is_timeout set. Overrides the client's timeout for this call, and 0 turns the limit off.

Returns

list[EnvironmentSummaryResource] with one entry per environment in the project.

Reads the environments collection. list returns one page as a dict with items and pagination, list_all collects every page into a list, and iterate yields one item at a time, fetching the next page only when the loop reaches it. On AsyncEnvless, iterate is an async iterator for async for.

Worth knowing

  • An ambiguous project slug fails on the first request, so nothing is collected and no partial list is returned.
  • A timeout on any page fails the whole call; there is no partial result to recover.

Required scopes

environments:read

Underlying endpoint

GET /projects/{slug}/environments

Request and response schema, every error code, and a live playground.

In TypeScript

envless.environments.listAll()

The same method in @goenvless/sdk, with the same request, retries and errors.