- integrations
- Python
- ocx_sdk
Project (2 of 6)
Projectclassdataclass#
Re-exported from
ocx_sdk._clientView sourceexecmethod#
def exec(argv: Sequence[str], *, names: Iterable[str] = (), groups: Iterable[str] = (), clean: bool = False, env: Mapping[str, EnvValue] | None = None, lazy_mode: LazyMode | None = None, pinned: bool | None = None, records_dir: str | Path | None = None, records_name: str | None = None, capture: bool = True, check: bool = True, timeout: MaybeTimeout = UNSET) -> CommandResultRun a command inside the project’s composed environment.
The child’s exit code comes back byte for byte, so check=False is
how you inspect a failing build instead of catching an exception.
Child processes are never retried.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
argv | Sequence[str] | required | The command and its arguments. Must not be empty. |
names | Iterable[str] | () | Bindings to compose. Omitted composes the default set. |
groups | Iterable[str] | () | Groups to compose. |
clean | bool | False | Strip the ambient parent environment before composing. |
env | Mapping[str, EnvValue] | None | None | Extra [env] entries for this call. |
lazy_mode | LazyMode | None | None | When content downloads — now, or on first use. |
pinned | bool | None | None | Resolve through the rendered toolchain’s pinned digests
rather than following its links — ocx’s --pinned /
--no-pinned. None leaves the choice to ocx.toml, then
OCX_TOOLCHAIN_PINNED, then ocx’s default. |
records_dir | str | Path | None | None | Write an execution record — the resolved closure
and executable, captured just before the child starts —
under this directory, which must already exist (ocx warns
and skips the record otherwise). None leaves it to
[records] dir and OCX_RECORDS_DIR; with none of the
three, no record. |
records_name | str | None | None | The record’s filename template, over {time},
{host}, {pid} and {rand}. None leaves it to
[records] name and OCX_RECORDS_NAME. |
capture | bool | True | Pipe and capture both streams. False inherits stdio
and forwards SIGINT to the child. |
check | bool | True | Raise on a non-zero child exit instead of returning it. |
timeout | MaybeTimeout | UNSET | Seconds for the whole run. Omitted takes the config’s. |
Returns
CommandResult- The child’s exit code and, under
capture, its output.
Raises
ValueErrorargvis empty — ocx requires a command after--.OcxProcessError- The child exited non-zero under
check. OcxTimeoutError- The timeout expired.
with_configmethod#
def with_config(**overrides: Unpack[ConfigOverrides]) -> ProjectDerive a project handle with some configuration fields replaced.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
**overrides | Unpack[ConfigOverrides] | {} | OcxConfig field names and their new values, as
ConfigOverrides spells them. |
Returns
Project- The same project, seen through a derived
Ocx.
Raises
TypeError- An override names no
OcxConfigfield.