Files
nixpkgs/pkgs/development/python-modules/json-logging/default.nix
T
Ihar Hrachyshka 567e8dfd8e treewide: clean up 'meta = with' pattern
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.

Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
2025-12-10 18:09:49 +01:00

75 lines
1.6 KiB
Nix

{
lib,
buildPythonPackage,
fastapi,
fetchFromGitHub,
flask,
httpx,
pytestCheckHook,
pythonOlder,
pythonAtLeast,
quart,
requests,
sanic,
setuptools,
uvicorn,
}:
buildPythonPackage rec {
pname = "json-logging";
version = "1.5.1";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "bobbui";
repo = "json-logging-python";
tag = version;
hash = "sha256-r2ttPFvlN+hqMxBLPkr5hOz0UKNX4NRoXmLMXhTZ/VY=";
};
# The logging module introduced the `taskName` field in Python 3.12, which the tests don't expect
postPatch = lib.optionalString (pythonAtLeast "3.12") ''
substituteInPlace tests/helpers/constants.py \
--replace-fail '"written_at",' '"taskName", "written_at",'
'';
build-system = [ setuptools ];
dependencies = [
fastapi
flask
httpx
quart
requests
sanic
uvicorn
];
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "json_logging" ];
disabledTests = [ "quart" ];
disabledTestPaths = [
# Smoke tests don't always work
"tests/smoketests/test_run_smoketest.py"
];
__darwinAllowLocalNetworking = true;
meta = {
description = "Python library to emit logs in JSON format";
longDescription = ''
Python logging library to emit JSON log that can be easily indexed and searchable by logging
infrastructure such as ELK, EFK, AWS Cloudwatch, GCP Stackdriver.
'';
homepage = "https://github.com/bobbui/json-logging-python";
changelog = "https://github.com/bobbui/json-logging-python/releases/tag/${src.tag}";
license = lib.licenses.asl20;
maintainers = [ ];
};
}