Plain Client¶
A Python client for Plain GraphQL API
Documentation: https://frankie567.github.io/plain-client/
Source Code: https://github.com/frankie567/plain-client
[!IMPORTANT] This client is generated automatically using: * ariadne-codegen * Plain GraphQL Schema * Fragments, mutations and queries provided by Plain in their official TypeScript SDK
Quickstart¶
Requires Python 3.11 or newer. The client uses HTTPX2; pass an
httpx2.AsyncClient when supplying a custom HTTP client.
from plain_client import Plain
client = Plain(
"https://core-api.uk.plain.com/graphql/v1", {"Authorization": "Bearer YOUR_API_KEY"}
)
async def get_thread():
return await client.thread("THREAD_ID")
Development¶
Setup environment¶
Install uv and just. Use Python 3.11 or newer.
Install the development dependencies and pre-commit hooks with just install.
Generate the client¶
Run just generate to download the schema, fragments, mutations, and queries
from Plain's TypeScript SDK and regenerate the client.
Use just generate-local to regenerate from the existing downloads.
Generation requires curl.
Run unit tests¶
Format the code¶
Run Ruff to format and lint the code, then check types with ty.
Use just lint-check to run the same checks without editing files.
Publishing a release¶
- Commit the release notes under
Unreleasedin CHANGELOG.md. From a clean release branch with Git signing configured, runjust version patch,just version minor, orjust version major. The recipe updates the version, changelog, and lockfile, then opens your Git editor for the signed commit. - Preview the release notes with
just release-notes <version>, then push the branch and merge the release PR intomain. - With the GitHub CLI authenticated, run
just release <PR number>. This signs and pushes a tag pointing to the merged PR commit. After the checks pass, CI publishes the distributions to PyPI with attestations and publishes the GitHub release with build provenance.
The PyPI Trusted Publisher must match the build.yml workflow and the GitHub
release environment.
Serve the documentation¶
The documentation uses Zensical. Start the local preview with the following command.
Open http://localhost:8000. The preview reloads when documentation changes.
Edit pages in docs/ and configure the site in zensical.toml.
Build the static site into site/ with the following command.
License¶
This project is licensed under the terms of the MIT license.