Skip to content

Feat: add python sdk for Agones game server#4496

Open
hiromesh wants to merge 3 commits intoagones-dev:mainfrom
hiromesh:feature/python-sdk
Open

Feat: add python sdk for Agones game server#4496
hiromesh wants to merge 3 commits intoagones-dev:mainfrom
hiromesh:feature/python-sdk

Conversation

@hiromesh
Copy link
Copy Markdown

@hiromesh hiromesh commented Apr 1, 2026

What type of PR is this?

/kind feature

What this PR does / Why we need it:

Adds a Python SDK for the Agones game server platform, providing a gRPC client for communicating with the Agones sidecar.

The SDK follows the same architecture and API patterns as the existing Go, Rust, and Node.js SDKs:

  • Core SDK: GameServer lifecycle management (Ready, Allocate, Shutdown, Reserve, Health, GetGameServer, WatchGameServer, SetLabel, SetAnnotation)
  • Alpha SDK: Player tracking (PlayerConnect, PlayerDisconnect, capacity/count management)
  • Beta SDK: Counters and Lists (get/set/increment/decrement counters, get/set/append/delete lists)

Commits:

  1. feat: add initial Python SDK for Agones game server
    • agones/sdk.py, agones/alpha.py, agones/beta.py — SDK implementation
    • agones/_generated/ — generated gRPC/protobuf code
    • generate.sh — proto code generation script (strips HTTP/swagger annotations)
    • pyproject.toml — package configuration
    • tests/test_sdk.py, tests/test_alpha.py, tests/test_beta.py — 37 unit tests
  2. docs: add Python Client SDK documentation and update README
    • site/content/en/docs/Guides/Client SDKs/python.md — full SDK documentation page
    • site/content/en/docs/Guides/Client SDKs/_index.md — added Python to SDK index
    • sdks/README.md — added Python entry
    • sdks/python/README.md — simplified to point to site docs
  3. feat: add Python SDK Dockerfile and scripts
    • build/build-sdk-images/python/Dockerfile — Docker build image
    • build/build-sdk-images/python/gen.sh — code generation entrypoint
    • build/build-sdk-images/python/test.sh — test runner entrypoint
    • build/includes/sdk.mk — added Python targets and conformance test
    • build/scripts/sdk-update-version/main.go — added pyproject.toml to version update list

Testing:

$ pytest tests/ -v
37 passed in 0.19s

All tests use unittest.mock.MagicMock to mock gRPC stubs (same approach as Go's sdkMock and Node.js's spyOn).

Which issue(s) this PR fixes:

None — new feature.

Special notes for your reviewer:

  • The generated gRPC code (agones/_generated/) is checked in, same approach as the Node.js SDK
  • generate.sh strips HTTP/swagger annotations from proto files before compilation to avoid unnecessary runtime dependencies
  • Conformance test port allocation: GRPC 9006 / HTTP 9106 (no conflict with existing SDKs)

hiromesh added 3 commits April 1, 2026 14:57
- Introduced core SDK functionality for managing GameServer lifecycle, including methods for connecting, marking readiness, and handling player connections.
- Implemented Alpha and Beta features for player tracking and counters/lists management.
- Added gRPC code generation script and necessary configuration files.
- Included README documentation for installation and usage instructions.
- Created .gitignore to exclude unnecessary files from version control.

Signed-off-by: hiromesh <417969567@qq.com>
- Added Python Client SDK documentation with installation and usage instructions.
- Updated README to include a link to the new Python Client SDK.
- Enhanced the main SDK documentation index to reference the Python SDK.

Signed-off-by: hiromesh <417969567@qq.com>
- Introduced Dockerfile for building Python SDK images, including installation of Python and necessary packages.
- Added code generation script (gen.sh) for setting up a Python virtual environment and installing grpcio-tools.
- Included test script (test.sh) for running pytest with required dependencies.
- Updated Makefile to support Python SDK commands for generation and conformance testing.

Signed-off-by: hiromesh <417969567@qq.com>
@github-actions github-actions bot added kind/feature New features for Agones size/XL labels Apr 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature New features for Agones size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant