1{ 2 lib, 3 buildPythonPackage, 4 fastapi, 5 fetchFromGitHub, 6 flask, 7 httpx, 8 pytestCheckHook, 9 pythonOlder, 10 pythonAtLeast, 11 quart, 12 requests, 13 sanic, 14 setuptools, 15 uvicorn, 16}: 17 18buildPythonPackage rec { 19 pname = "json-logging"; 20 version = "1.5.1"; 21 pyproject = true; 22 23 disabled = pythonOlder "3.7"; 24 25 src = fetchFromGitHub { 26 owner = "bobbui"; 27 repo = "json-logging-python"; 28 tag = version; 29 hash = "sha256-r2ttPFvlN+hqMxBLPkr5hOz0UKNX4NRoXmLMXhTZ/VY="; 30 }; 31 32 # The logging module introduced the `taskName` field in Python 3.12, which the tests don't expect 33 postPatch = lib.optionalString (pythonAtLeast "3.12") '' 34 substituteInPlace tests/helpers/constants.py \ 35 --replace-fail '"written_at",' '"taskName", "written_at",' 36 ''; 37 38 build-system = [ setuptools ]; 39 40 dependencies = [ 41 fastapi 42 flask 43 httpx 44 quart 45 requests 46 sanic 47 uvicorn 48 ]; 49 50 nativeCheckInputs = [ pytestCheckHook ]; 51 52 pythonImportsCheck = [ "json_logging" ]; 53 54 disabledTests = [ "quart" ]; 55 56 disabledTestPaths = [ 57 # Smoke tests don't always work 58 "tests/smoketests/test_run_smoketest.py" 59 ]; 60 61 __darwinAllowLocalNetworking = true; 62 63 meta = with lib; { 64 description = "Python library to emit logs in JSON format"; 65 longDescription = '' 66 Python logging library to emit JSON log that can be easily indexed and searchable by logging 67 infrastructure such as ELK, EFK, AWS Cloudwatch, GCP Stackdriver. 68 ''; 69 homepage = "https://github.com/bobbui/json-logging-python"; 70 changelog = "https://github.com/bobbui/json-logging-python/releases/tag/${src.tag}"; 71 license = licenses.asl20; 72 maintainers = [ ]; 73 }; 74}