Skip to main content

**Podsmith** is a Python toolkit for managing Kubernetes-based test dependencies, enabling dynamic or pre-provisioned environments for integration testing.

Project description

Podsmith

Podsmith is a Python toolkit for managing Kubernetes-based test dependencies, enabling dynamic or pre-provisioned environments for integration testing.

Inspired by (and supports using) Testcontainers, Podsmith lets you define service dependencies as code and run your tests locally or remotely, with full control over whether resources are deployed on-the-fly or expected to be pre-provisioned.


✨ Features

  • 🛠 Deploy Kubernetes resources from Python definitions
  • 🔍 Optionally reuse existing resources
  • ⏳ Built-in support for readiness checks (e.g., pod status, HTTP, service endpoints)
  • 🧪 Integrates with pytest
  • 🚀 Works with local clusters (e.g., k3s, kind) or remote (using kubectl)

✨ Planned Features

  • 📦 Snapshot current test environment for reusable kubernetes manifests
  • 🐳 Pre-build test images locally for publishing to pre-populate a docker registry.

🔧 Installation

pip install podsmith

🚀 Quickstart

Simple example to deploy a redis testcontainer as a Kubernetes Pod.

from podsmith import Pod
from testcontainers.redis import RedisContainer

redis_container = RedisContainer()

with Pod("redis").with_testcontainer(redis_container, service_port_map={redis_container.port: "redis"}) as redis:
    # Port-forward from k8s cluster to localhost, only needed if test needs to connect to the service directly.
    with redis.port_forward("redis") as port:
        url = f"redis://127.0.0.1:{port}"
        # Use redis service in your test

This example deploys a redis pod using a testcontainer as template, and register a Service manifest for the redis service port. When the context manager exits, the pod is deleted.


📸 (Planned) Snapshot Test Manifests

WIP -- AI generated example, not accurate.

Generate a manifest snapshot of your test environment:

podsmith snapshot --namespace test-env --output ./snapshots/

Apply in CI:

kubectl apply -f ./snapshots/

📚 (Wishful thinking) Documentation


📝 License

MIT License


🤝 Contributing

Contributions, ideas, and bug reports are welcome! Please open an issue or PR on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

podsmith-0.5.2-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file podsmith-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: podsmith-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for podsmith-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5b899439753593e497ae35ca81830aee8a8b9bd6752751dee282a844ff21413b
MD5 749f9e74979ba3c5b4076eb6f52abc6c
BLAKE2b-256 11972cdb1f4680c40895bd204a070cdc0feb598a5f43525873fd87ee212e511b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page