| Name | kubemind-common JSON |
| Version |
0.1.0
JSON |
| download |
| home_page | None |
| Summary | Shared utilities, contracts, and middleware for KubeMind services |
| upload_time | 2025-10-12 22:33:12 |
| maintainer | None |
| docs_url | None |
| author | KubeMind Team |
| requires_python | >=3.12 |
| license | MIT License Copyright (c) 2024 KubeMind Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| keywords |
kubemind
kubernetes
microservices
pydantic
utils
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# KubeMind Common Library
Shared Python library for all KubeMind services.
## Overview
`kubemind-common` provides shared functionality across all KubeMind services:
- Configuration management
- Logging setup with correlation IDs
- Middleware (request ID, rate limiting, error handling)
- Contracts (Pydantic models for events, playbooks, triggers)
- HTTP client with retries
- Redis client and utilities
- Database utilities
- Security utilities (JWT, HMAC)
- Metrics instrumentation
- Kubernetes utilities
## Contributor Guide
See [Repository Guidelines](AGENTS.md) for structure, workflows, and review expectations.
## Installation
- From PyPI:
```bash
pip install kubemind-common
```
- With extras (examples):
```bash
pip install "kubemind-common[fastapi]"
pip install "kubemind-common[db]"
pip install "kubemind-common[auth]"
```
- In a monorepo (editable install):
```bash
pip install -e ../kubemind-common
```
## Development
```bash
pip install -e .[dev]
```
Running the test suite and building artefacts are managed through the bundled Makefile:
```bash
make test # run pytest after a clean build directory
make build # produce wheel and sdist under dist/
make check # twine check on the build outputs
```
## Publishing
1. Export a `PYPI_TOKEN` with upload permissions (username is always `__token__`).
2. Run `make publish` which will rebuild, validate and upload using Twine.
3. Tag the release (`git tag vX.Y.Z && git push --tags`) so downstream services can pin versions.
## Usage
### Configuration
```python
from kubemind_common.config.base import BaseServiceSettings
settings = BaseServiceSettings()
```
### Logging
```python
from kubemind_common.logging.setup import setup_logging
setup_logging(level="INFO", format="json")
```
### HTTP Client
```python
from kubemind_common.http.client import create_http_client, http_request
async with create_http_client() as client:
response = await http_request(client, "GET", "https://api.example.com")
```
### Kubernetes
```python
from kubemind_common.k8s.client import create_k8s_client
k8s = create_k8s_client(in_cluster=False)
pods = k8s.core_v1_api.list_pod_for_all_namespaces()
```
### Contracts
```python
from kubemind_common.contracts.events import Event
from kubemind_common.contracts.playbooks import PlaybookSpec
event = Event(
id="evt-123",
source="kubernetes",
type="pod_crash",
timestamp="2025-10-12T17:00:00Z"
)
```
## Project Structure
- `src/kubemind_common/` — library code
- `config/`, `logging/`, `middleware/`, `contracts/`, `http/`, `redis/`, `db/`, `security/`, `metrics/`, `k8s/`, `utils/`, etc.
- `tests/` — unit and integration tests
- `docs/` — documentation (see `docs/index.md`)
- `examples/` — runnable usage examples
- `.github/workflows/` — CI/CD and publishing
## Development
```bash
# Create a virtual environment and install in editable mode
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
# Run tests
pytest
# Type checking (if configured)
mypy src/kubemind_common/
# Linting (if configured)
ruff check .
```
## Build & Publish
This project uses modern PEP 621 metadata with Hatchling.
- Local build:
```bash
python -m pip install --upgrade build
python -m build
```
- Trusted Publishing via GitHub Actions:
- Configure the PyPI project to trust this repository (PyPI → Management → Publishing → Trusted Publishers).
- Tag a release `vX.Y.Z` to publish to PyPI.
- Tag a pre-release like `vX.Y.Z-rc1` to publish to TestPyPI.
- Or run the `Publish` workflow manually and choose `pypi` or `testpypi`.
## Versioning
This library follows semantic versioning. Services should pin compatible versions:
```toml
kubemind-common = "^0.2.0"
```
## Documentation
See `docs/index.md` for module documentation and examples.
Raw data
{
"_id": null,
"home_page": null,
"name": "kubemind-common",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "kubemind, kubernetes, microservices, pydantic, utils",
"author": "KubeMind Team",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/59/b0/a672805ac10d77d73106430fe99ff9b88173acc3f65e6e190a2505b0528c/kubemind_common-0.1.0.tar.gz",
"platform": null,
"description": "# KubeMind Common Library\n\nShared Python library for all KubeMind services.\n\n## Overview\n\n`kubemind-common` provides shared functionality across all KubeMind services:\n- Configuration management\n- Logging setup with correlation IDs\n- Middleware (request ID, rate limiting, error handling)\n- Contracts (Pydantic models for events, playbooks, triggers)\n- HTTP client with retries\n- Redis client and utilities\n- Database utilities\n- Security utilities (JWT, HMAC)\n- Metrics instrumentation\n- Kubernetes utilities\n\n## Contributor Guide\n\nSee [Repository Guidelines](AGENTS.md) for structure, workflows, and review expectations.\n\n## Installation\n\n- From PyPI:\n\n```bash\npip install kubemind-common\n```\n\n- With extras (examples):\n\n```bash\npip install \"kubemind-common[fastapi]\"\npip install \"kubemind-common[db]\"\npip install \"kubemind-common[auth]\"\n```\n\n- In a monorepo (editable install):\n\n```bash\npip install -e ../kubemind-common\n```\n\n## Development\n\n```bash\npip install -e .[dev]\n```\n\nRunning the test suite and building artefacts are managed through the bundled Makefile:\n\n```bash\nmake test # run pytest after a clean build directory\nmake build # produce wheel and sdist under dist/\nmake check # twine check on the build outputs\n```\n\n## Publishing\n\n1. Export a `PYPI_TOKEN` with upload permissions (username is always `__token__`).\n2. Run `make publish` which will rebuild, validate and upload using Twine.\n3. Tag the release (`git tag vX.Y.Z && git push --tags`) so downstream services can pin versions.\n\n## Usage\n\n### Configuration\n\n```python\nfrom kubemind_common.config.base import BaseServiceSettings\n\nsettings = BaseServiceSettings()\n```\n\n### Logging\n\n```python\nfrom kubemind_common.logging.setup import setup_logging\n\nsetup_logging(level=\"INFO\", format=\"json\")\n```\n\n### HTTP Client\n\n```python\nfrom kubemind_common.http.client import create_http_client, http_request\n\nasync with create_http_client() as client:\n response = await http_request(client, \"GET\", \"https://api.example.com\")\n```\n\n### Kubernetes\n\n```python\nfrom kubemind_common.k8s.client import create_k8s_client\n\nk8s = create_k8s_client(in_cluster=False)\npods = k8s.core_v1_api.list_pod_for_all_namespaces()\n```\n\n### Contracts\n\n```python\nfrom kubemind_common.contracts.events import Event\nfrom kubemind_common.contracts.playbooks import PlaybookSpec\n\nevent = Event(\n id=\"evt-123\",\n source=\"kubernetes\",\n type=\"pod_crash\",\n timestamp=\"2025-10-12T17:00:00Z\"\n)\n```\n\n## Project Structure\n\n- `src/kubemind_common/` \u2014 library code\n - `config/`, `logging/`, `middleware/`, `contracts/`, `http/`, `redis/`, `db/`, `security/`, `metrics/`, `k8s/`, `utils/`, etc.\n- `tests/` \u2014 unit and integration tests\n- `docs/` \u2014 documentation (see `docs/index.md`)\n- `examples/` \u2014 runnable usage examples\n- `.github/workflows/` \u2014 CI/CD and publishing\n\n## Development\n\n```bash\n# Create a virtual environment and install in editable mode\npython -m venv .venv && . .venv/bin/activate\npip install -e \".[dev]\"\n\n# Run tests\npytest\n\n# Type checking (if configured)\nmypy src/kubemind_common/\n\n# Linting (if configured)\nruff check .\n```\n\n## Build & Publish\n\nThis project uses modern PEP 621 metadata with Hatchling.\n\n- Local build:\n\n```bash\npython -m pip install --upgrade build\npython -m build\n```\n\n- Trusted Publishing via GitHub Actions:\n - Configure the PyPI project to trust this repository (PyPI \u2192 Management \u2192 Publishing \u2192 Trusted Publishers).\n - Tag a release `vX.Y.Z` to publish to PyPI.\n - Tag a pre-release like `vX.Y.Z-rc1` to publish to TestPyPI.\n - Or run the `Publish` workflow manually and choose `pypi` or `testpypi`.\n\n## Versioning\n\nThis library follows semantic versioning. Services should pin compatible versions:\n\n```toml\nkubemind-common = \"^0.2.0\"\n```\n\n## Documentation\n\nSee `docs/index.md` for module documentation and examples.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 KubeMind Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Shared utilities, contracts, and middleware for KubeMind services",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/kubemind-ai/kubemind-common",
"Repository": "https://github.com/kubemind-ai/kubemind-common.git"
},
"split_keywords": [
"kubemind",
" kubernetes",
" microservices",
" pydantic",
" utils"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e5baecbe25fa2a17c7433a3ab8d1470419a8e4af13b0776e4d3df471dc5f6d97",
"md5": "694416efdbca518f76a70ebb1eee1381",
"sha256": "49d4b8d8decb465eb2c56d23e9f51a9a82e8e5a08de4eb3088485d0eceac306b"
},
"downloads": -1,
"filename": "kubemind_common-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "694416efdbca518f76a70ebb1eee1381",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 56297,
"upload_time": "2025-10-12T22:33:10",
"upload_time_iso_8601": "2025-10-12T22:33:10.178120Z",
"url": "https://files.pythonhosted.org/packages/e5/ba/ecbe25fa2a17c7433a3ab8d1470419a8e4af13b0776e4d3df471dc5f6d97/kubemind_common-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "59b0a672805ac10d77d73106430fe99ff9b88173acc3f65e6e190a2505b0528c",
"md5": "dd80798b19fa1a3130bd0cb29fc34712",
"sha256": "ac77f7984ff76053f1fa62d24fe637f219983dfb36412f062beaee80dc78d219"
},
"downloads": -1,
"filename": "kubemind_common-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "dd80798b19fa1a3130bd0cb29fc34712",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 42180,
"upload_time": "2025-10-12T22:33:12",
"upload_time_iso_8601": "2025-10-12T22:33:12.340885Z",
"url": "https://files.pythonhosted.org/packages/59/b0/a672805ac10d77d73106430fe99ff9b88173acc3f65e6e190a2505b0528c/kubemind_common-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-12 22:33:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kubemind-ai",
"github_project": "kubemind-common",
"github_not_found": true,
"lcname": "kubemind-common"
}