blob: 8dc28df1325b62c3154c3f1b05fd71fa707b6943 (
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
|
{
lib,
stdenv,
darwin,
python3Packages,
fetchFromGitHub,
installShellFiles,
testers,
openapi-python-client,
}:
python3Packages.buildPythonApplication (finalAttrs: {
pname = "openapi-python-client";
version = "0.29.1";
pyproject = true;
src = fetchFromGitHub {
inherit (finalAttrs) version;
owner = "openapi-generators";
repo = "openapi-python-client";
tag = "v${finalAttrs.version}";
hash = "sha256-XUn5TQrga+qdl/w801KEPQB7zLcx1C/ziZYra+9aYf4=";
};
nativeBuildInputs = [
installShellFiles
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.ps
];
build-system = with python3Packages; [
hatchling
];
dependencies = (
with python3Packages;
[
attrs
httpx
jinja2
pydantic
python-dateutil
ruamel-yaml
ruff
shellingham
typer
typing-extensions
]
);
# openapi-python-client defines upper bounds to the dependencies, ruff python library is
# just a simple wrapper to locate the binary. We'll remove the upper bound
pythonRelaxDeps = [ "ruff" ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
# see: https://github.com/fastapi/typer/blob/5889cf82f4ed925f92e6b0750bf1b1ed9ee672f3/typer/completion.py#L54
# otherwise shellingham throws exception on darwin
export _TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION=1
installShellCompletion --cmd openapi-python-client \
--bash <($out/bin/openapi-python-client --show-completion bash) \
--fish <($out/bin/openapi-python-client --show-completion fish) \
--zsh <($out/bin/openapi-python-client --show-completion zsh)
'';
passthru = {
tests.version = testers.testVersion {
package = openapi-python-client;
};
};
meta = {
description = "Generate modern Python clients from OpenAPI";
homepage = "https://github.com/openapi-generators/openapi-python-client";
changelog = "https://github.com/openapi-generators/openapi-python-client/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.mit;
mainProgram = "openapi-python-client";
maintainers = with lib.maintainers; [ konradmalik ];
};
})
|