Skip to content
ocx
install

Bootstrap

bootstrap.ensure() provisions a verified ocx binary and returns its path — the Python equivalent of curl -sSL https://setup.ocx.sh | sh, minus any machine mutation. It never touches a shell profile, never runs self setup, and never writes anywhere outside its own cache directory.

# illustrative: needs network access to fetch the dist manifest.
from ocx_sdk import Ocx, bootstrap
exe = bootstrap.ensure() # latest stable
ocx = Ocx(exe=exe)

It is idempotent and offline-friendly: a cache hit that still hashes correctly needs no network at all, and every knob resolves explicit argument first, then the matching OCX_INSTALL_* variable, then a default.

Those variables are the same ones setup.ocx.sh reads, so a machine already set up for the shell installer needs no code change:

Variable Argument Effect
OCX_INSTALL_VERSION version= Pin an exact release
OCX_INSTALL_DIST_URL dist= Where the manifest comes from (default source only)
OCX_INSTALL_MIRROR_URL mirror_url= Where the artifact bytes come from
OCX_INSTALL_CA_BUNDLE ca_bundle= PEM file trusted for the downloads
OCX_INSTALL_FORCE — Reinstall even on a cache hit

OCX_INSTALL_REPO and OCX_INSTALL_QUIET are accepted and do nothing — artifact URLs come from the manifest rather than a repository guess, and this module prints nothing to quiet. Every variable is in Environment.

Ocx() with no exe= looks for a binary in this order and pins the first hit to the handle:

  1. the explicit exe= argument
  2. the OCX_SDK_EXE variable
  3. PATH
  4. ocx’s own install symlink under $OCX_HOME

If none exists, Ocx() raises OcxNotFoundError. Call bootstrap.ensure() and pass the result as exe= to provision one.

Pass version= for an exact release, or channel= to follow a channel’s latest (Channel.STABLE is the default; Channel.NEXT tracks pre-releases):

# illustrative: needs network access.
from ocx_sdk import Channel, bootstrap
exe = bootstrap.ensure(version="0.6.2")
next_exe = bootstrap.ensure(channel=Channel.NEXT)

min_version= is the operator floor: a resolved version below it raises BootstrapError instead of silently installing something older than the caller allows.

Continues on Bootstrap: Corporate mirror + auth.