Skip to main content

Library to help with defining and running health checks for Maykin Django projects.

Project description

1 Welcome to Maykin Configuration Checks’ documentation!

Version:

0.1.0

Source:

https://github.com/maykinmedia/config-checks

Keywords:

Django, Maykin, health checks

PythonVersion:

3.12, 3.13

Build status Code quality checks Ruff Coverage status Documentation Status

python-versions django-versions pypi-version

This library aims to standardise how health checks for Maykin Django applications are run. The checks are meant to validate that the configuration that is normally performed in the Admin or via django-setup-configuration is correct.

2 Installation

2.1 Requirements

  • Python 3.12 or above

  • Django 4.2 or newer

2.2 Install

pip install maykin-config-checks

Add maykin_config_checks to the Django INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "maykin_config_checks",
    ...
]

3 Usage

3.1 View

To have an API view that returns the results of the performed health checks, add the following to the urlpatterns:

from django.urls import path

from maykin_config_checks.api.views import HealthChecksView

urlpatterns = [
    ...
    path(
        "health-checks",
        HealthChecksView.as_view(
            checks_collector=my_checks_collector_fn
        ),
        name="health-checks",
    ),
]

Where my_checks_collector_fn is a Callable[[], Iterable[HealthCheck]]. It is used to retrieve which health checks should be performed by the view. You can also add the view multiple times to the urlpatters with different checks_collector arguments if you want to have multiple health check views that run different checks.

3.2 Management command

There is also a management command that can be used to run health checks from the CLI.

django-admin config_checks --checks-collector dotted.path.to.my_checks_collector_fn

4 Local development

To develop the library locally, use:

uv pip install -r pyproject.toml --all-extras

To run the test app, in the root of the repository run:

export DJANGO_SETTINGS_MODULE=testapp.settings
export PYTHONPATH=$PYTHONPATH:`pwd`

Then, you can run:

django-admin runserver

5 Running tests

To run the tests without tox, you can do the following (from the root of the repository):

export DJANGO_SETTINGS_MODULE=testapp.settings
export PYTHONPATH=$PYTHONPATH:`pwd`
pytest tests

Project details


Download files

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

Source Distribution

maykin_config_checks-0.1.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

maykin_config_checks-0.1.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file maykin_config_checks-0.1.0.tar.gz.

File metadata

  • Download URL: maykin_config_checks-0.1.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for maykin_config_checks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cd15e8e18a43c42b232bdef49f10a7ca3669b292e03dcf031cc689fd3bd6058b
MD5 60680af16ebc8d1b5e049183c6b099a2
BLAKE2b-256 8c842687952cb9e2bea9fe193236e41ac10d997ce85d25e99844436968852632

See more details on using hashes here.

Provenance

The following attestation bundles were made for maykin_config_checks-0.1.0.tar.gz:

Publisher: ci.yml on maykinmedia/config-checks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file maykin_config_checks-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for maykin_config_checks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d64d86a6bd0d3d1d3a5965376f712402694dfccaf0a95b15ddb011b4d83d7a6b
MD5 14737fed2532c8c5fa864a1dd6691bce
BLAKE2b-256 51c5956b2f6d302aeeb595cf45d27f2f0711535690a695862636429a7172894a

See more details on using hashes here.

Provenance

The following attestation bundles were made for maykin_config_checks-0.1.0-py3-none-any.whl:

Publisher: ci.yml on maykinmedia/config-checks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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