- This is the official synchronous Python SDK for the Linode API. Supported
Python versions come from pyproject.toml (
>=3.10); do not infer support from the older environment names still present in tox.ini. - Make changes only in canonical source trees such as
linode_api4/,test/,docs/,examples/, and.github/. Do not edit generated copies or output inbuild/,dist/,docs/build/,docs/_build/, orlinode_api4.egg-info/. linode_api4/version.pyis generated bymake create-versionandmake build. Do not hand-edit it for ordinary feature work.- Use README.rst for setup and test details and CONTRIBUTING.md for contribution policy. Keep this file limited to guidance that is easy to miss while navigating the repository.
linode_api4/linode_client.pyowns HTTP behavior and wires API groups ontoLinodeClient;linode_api4/groups/exposes operations;linode_api4/objects/defines resource models;linode_api4/paginated_list.pyhandles collection pagination.- Follow the nearest existing group method, model, and unit test before adding a
new pattern. Collection methods normally use
client._get_and_filter(...); create/update/delete methods use the client's request helpers and return model objects where appropriate. - Models are lazy-loaded, and reading an unknown or stale property may issue an API request. Read docs/guides/core_concepts.rst before changing model properties, relationships, filtering, or pagination.
- New public models must be exported from
linode_api4/objects/__init__.py. New groups must be exported fromlinode_api4/groups/__init__.pyand wired intoLinodeClient. Preserve public API compatibility unless the task explicitly requires a breaking change. - Public behavior belongs in Sphinx-compatible docstrings and, when needed, the
source files under
docs/. Never edit rendered documentation.
- Start with the narrowest relevant unit test, for example
python -m pytest test/unit/objects/linode_test.py -k test_name. Runmake test-unitfor the full mocked unit suite. - Unit tests normally extend
test.unit.base.ClientBaseCase. GET requests are resolved from JSON undertest/fixtures/; usemock_post,mock_put, andmock_deletefor other verbs and assert the captured URL, body, or headers. - Fixture names encode endpoint paths: a single underscore becomes
/, while a doubled underscore becomes a literal_. Paginated fixtures containingresultsalso provide per-ID responses automatically when items include anidfield. Seetest/unit/fixtures.pybefore inventing custom request mocking. make test-intandmake test-smokecall the live Linode API, requireLINODE_TOKEN, and may create or delete real resources. Run them only when the change requires live validation and the environment is intentionally configured.
- Install development dependencies with
make dev-install. - Formatting is Black + isort + autoflake with settings in pyproject.toml.
make formatrewrites all oflinode_api4/andtest/, so review the worktree before and after using it for a focused change. make lintis the broad CI-equivalent check: it builds distributions, checks formatting/imports, runs pylint, and validates package metadata. Prefer focused tests first because this target regenerates build artifacts and version metadata.
- Target the
devbranch unless the task specifies otherwise. - PR titles must use
TPT-1234: Description; CI exempts only the labels documented in .github/workflows/ci.yml. - Keep changes focused, add tests for behavior changes, and use .github/pull_request_template.md when drafting the PR description.