Install Node 26 and Bazelisk, then
enable the repository's pinned pnpm:
npm install --global corepack@latest
corepack enable pnpm
pnpm install --frozen-lockfile
pnpm lefthook installBazel provisions Python and Python dependencies. No virtual environment is required.
Handwritten client, transport, and helper code lives under src/perplexity/.
Do not edit src/perplexity/generated/ or src/perplexity/resources/; the SDK
code is produced by a private SDK codegen pipeline.
Tests live under tests/. Live API tests live under e2e/live/ and must remain
small and deterministic.
For a dependency change:
-
Update dependencies in
pyproject.toml. Changeuv.tomlonly for UV resolver or index configuration. -
Keep the
py_wheel.requiresmetadata inBUILD.bazelaligned. -
Update the lock and BUILD files:
bazel run //:uv_lock.update bazel run //:gazelle
Commit resulting uv.lock and BUILD.bazel changes.
Use Conventional Commits, such as
fix: handle empty responses or feat: add a resource. Release Please uses
these commits to choose the next version and build the changelog.
Run the same main test suite as CI:
bazel test //...Run one target while iterating:
bazel test //tests:test_client_testValidate formatting, lint, types, and generated BUILD files:
pnpm lefthook run pre-commit --all-files --force --fail-on-changesApply Ruff fixes:
bazel run //:ruff -- check --fix .
bazel run //:ruff -- format .Live tests call the production API and require a token. Run only the relevant shard:
PPLX_API_TOKEN=... bazel test //e2e/live:search --test_env=PPLX_API_TOKENBuild the publishable wheel:
bazel build //:wheelThe output is under bazel-bin/.
Do not bump versions or publish from a development branch.
- Merge normal PRs into
main. - Release Please creates or updates a
release: <version>PR from Conventional Commits. - Review and merge that PR. It updates the changelog and version files, then
creates the
v<version>tag and GitHub release. - The published GitHub release triggers
Publish PyPI, which builds//:wheeland uploads it through PyPI Trusted Publishing.
Release automation requires RELEASE_TOKEN. PyPI trusts publish-pypi.yml
through GitHub Actions OIDC; no PyPI token is stored in GitHub. For a failed
upload, rerun Publish PyPI against the existing release tag; do not create a
new version.