summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/litestar/default.nix
blob: 06bc2b7720ff3d055eb34dd9cb2e0a85ac644e53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  hatchling,

  # dependencies
  annotated-types,
  anyio,
  asyncpg,
  attrs,
  brotli,
  click,
  cryptography,
  fsspec,
  httpx,
  jinja2,
  jsbeautifier,
  litestar-htmx,
  mako,
  minijinja,
  fast-query-parsers,
  msgspec,
  multidict,
  multipart,
  picologging,
  polyfactory,
  piccolo,
  prometheus-client,
  psutil,
  opentelemetry-instrumentation-asgi,
  psycopg,
  pydantic-extra-types,
  pydantic,
  email-validator,
  pyjwt,
  pyyaml,
  redis,
  rich-click,
  rich,
  structlog,
  time-machine,
  typing-extensions,
  uvicorn,
  # valkey,

  # tests
  httpx-sse,
  pytest-asyncio,
  pytest-lazy-fixtures,
  pytest-mock,
  pytest-rerunfailures,
  pytest-timeout,
  pytest-xdist,
  pytestCheckHook,
  trio,
  versionCheckHook,
}:

buildPythonPackage rec {
  pname = "litestar";
  version = "2.18.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "litestar-org";
    repo = "litestar";
    tag = "v${version}";
    hash = "sha256-bqj7tvCNeMEEJKDF3g2beKfd0urbNszrbLdF96JygYk=";
  };

  build-system = [ hatchling ];

  dependencies = [
    anyio
    asyncpg
    click
    fast-query-parsers
    fsspec
    httpx
    litestar-htmx
    msgspec
    multidict
    multipart
    polyfactory
    psutil
    pyyaml
    rich
    rich-click
    typing-extensions
  ];

  optional-dependencies = {
    annotated-types = [ annotated-types ];
    attrs = [ attrs ];
    brotli = [ brotli ];
    cli = [
      jsbeautifier
      uvicorn
    ];
    cryptography = [ cryptography ];
    htmx = [ litestar-htmx ];
    jinja = [ jinja2 ];
    jwt = [
      cryptography
      pyjwt
    ];
    mako = [ mako ];
    minijinja = [ minijinja ];
    opentelemetry = [ opentelemetry-instrumentation-asgi ];
    piccolo = [ piccolo ];
    picologging = [ picologging ];
    polyfactory = [ polyfactory ];
    prometheus = [ prometheus-client ];
    pydantic = [
      pydantic
      email-validator
      pydantic-extra-types
    ];
    redis = [ redis ] ++ redis.optional-dependencies.hiredis;
    # sqlalchemy = [ advanced-alchemy ];
    structlog = [ structlog ];
    # valkey = [ valkey ] ++ valkey.optional-dependencies.libvalkey;
    yaml = [ pyyaml ];
  };

  nativeCheckInputs = [
    httpx-sse
    pytest-asyncio
    pytest-lazy-fixtures
    pytest-mock
    pytest-rerunfailures
    pytest-timeout
    pytest-xdist
    pytestCheckHook
    time-machine
    trio
    versionCheckHook
  ];

  versionCheckProgramArg = "version";

  __darwinAllowLocalNetworking = true;

  preCheck = ''
    export PATH=$out/bin:$PATH
  '';

  enabledTestPaths = [
    # Follow GitHub CI
    "docs/examples/"
  ];

  disabledTests = [
    # StartupError
    "test_subprocess_async_client"
  ];

  meta = {
    description = "Production-ready, Light, Flexible and Extensible ASGI API framework";
    homepage = "https://litestar.dev/";
    changelog = "https://github.com/litestar-org/litestar/releases/tag/${src.tag}";
    license = lib.licenses.mit;
    mainProgram = "litestar";
    maintainers = with lib.maintainers; [ bot-wxt1221 ];
    platforms = lib.platforms.unix;
  };
}