Skip to main content

Service-Kit Documentation

License

📌 Service-Kit is a collection of functions and objects designed to help the Monkey team bootstrap, build, and maintain various services efficiently.

Features

  • Service Bootstrapping: Provides templates and utilities to stand up new services quickly.
  • Common Utilities: Provides common utilities for logging, configuration, and error handling.
  • Service Configuration: Provides a base class for service configuration that can be easily extended.
  • Testing Support: Provides utilities for testing services.

Submodules

  • api: Provides components for setting up an API with FastAPI
  • base_model: Provides a Pydantic BaseModel with extra features
  • configuration: Provides models, types, and utilities for configuring a service
  • errors: Enables exceptions using structured errors
  • logging: Provides a logger that enables structured logging

Getting started

Installation

You can install Service-Kit using poetry:

$ poetry add monkey-service-kit

or by using pip:

$ pip install monkey-service-kit

Extras

Service-Kit contains some functionality that is only available if extras are installed.

  • service_kit.logging.log_postgres_error() is only available if Service-Kit is installed with the [psycopg] extra.
  • service_kit.api is only available if Serivce-Kit is installed with the [api] extra.

When installing with Poetry, this looks like:

$ poetry add monkey-service-kit[api,psycopg]

or with pip:

$ pip install monkey-service-kit[api,psycopg]

Usage

After installation, you can start using Service-Kit like any other Python package. For a more detailed example and usage patterns, refer to the template_service.py file included in the repository.

Development

Setting up your development environment

Run the following commands to install the necessary prerequisites:

$ pip install poetry pre-commit
$ poetry install --all-extras
$ pre-commit install -t pre-commit -t prepare-commit-msg

Running unit tests

Run automated tests with:

$ poetry run pytest

Test coverage

To run automated tests with test coverage, run:

$ poetry run pytest --cov-report=html --cov=service-kit
$ firefox ./htmlcov/index.html

Sphinx Documentation

The docs directory contains the needed file to automatically generate code documentation using Sphinx.

Configuration

To change the Sphinx configuration, change the attributes in source/conf.py. The documentation uses source/_static to keep the custom media, stylesheets, js scripts etc. source/index.rst is the main rst file in which the look of the index HTML page is defined.

Build

The make script generates the documentation using sphinx-build. The generated documentation is stored in build/html/.

Linux
  1. From service-kit, install python dependencies:
$ poetry install
  1. Activate the python venv
$ poetry env activate
  1. Generate the documentation:
$ cd docs
$ make html
Windows
  1. From service-kit, install python dependencies:
$ poetry install
  1. Activate the python venv
$ poetry env activate
  1. Generate the documentation:
$ cd docs
$ make html

Deployment

To deploy the documentation locally, build/html/index.html

Release files for monkey-service-kit 2.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for monkey-service-kit 2.5.0
File Size Uploaded
monkey_service_kit-2.5.0.tar.gz 31.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for monkey-service-kit 2.5.0
File Interpreter ABI Platform
monkey_service_kit-2.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 68.9 kB

Release files / monkey_service_kit-2.5.0.tar.gz

Download URL monkey_service_kit-2.5.0.tar.gz
Size 31.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1d51a47190ea8c5beb875f7bb4f54791a66a7e9cb612f800d1729714282885ec
BLAKE2b-256 checksum
How to use checksums
01aebd03e9c360bfcdd4fbdf5cfe7109e5821a75ca7fbd873ee354a41b38c406
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.10.12 Linux/6.8.0-138-generic

Release files / monkey_service_kit-2.5.0-py3-none-any.whl

Download URL monkey_service_kit-2.5.0-py3-none-any.whl
Size 37.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
896d6dacdf9d6e0beff67cff8b53e36f91f74846b2ecea2f88217a6861628f91
BLAKE2b-256 checksum
How to use checksums
45a068ab782cbde477e77e60f081a5faf19bb3f6a9b18dc79e8bb28025e9442f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.10.12 Linux/6.8.0-138-generic

Release history Release notifications | RSS feed

This release

2.5.0 This release

2 release files

2.4.1

2 release files

2.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page