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