1{
2 lib,
3 pkgs,
4 pulumiPackages,
5 buildPythonPackage,
6 pythonOlder,
7 hatchling,
8 protobuf,
9 grpcio,
10 dill,
11 six,
12 semver,
13 pyyaml,
14 debugpy,
15 pip,
16 pytest,
17 pytest-asyncio,
18 pytest-timeout,
19 python,
20}:
21let
22 inherit (pkgs.pulumi) pname version src;
23 inherit (pulumiPackages) pulumi-python;
24 sourceRoot = "${src.name}/sdk/python";
25in
26buildPythonPackage {
27 inherit
28 pname
29 version
30 src
31 sourceRoot
32 ;
33
34 outputs = [
35 "out"
36 "dev"
37 ];
38
39 pyproject = true;
40
41 disabled = pythonOlder "3.9";
42
43 build-system = [ hatchling ];
44
45 dependencies = [
46 protobuf
47 grpcio
48 dill
49 six
50 semver
51 pyyaml
52 debugpy
53 pip
54 ];
55
56 pythonRelaxDeps = [
57 "grpcio"
58 "pip"
59 "semver"
60 ];
61
62 nativeCheckInputs = [
63 pytest
64 pytest-asyncio
65 pytest-timeout
66 pulumi-python
67 ];
68
69 # https://github.com/pulumi/pulumi/blob/0acaf8060640fdd892abccf1ce7435cd6aae69fe/sdk/python/scripts/test_fast.sh#L10-L11
70 # https://github.com/pulumi/pulumi/blob/0acaf8060640fdd892abccf1ce7435cd6aae69fe/sdk/python/scripts/test_fast.sh#L16
71 installCheckPhase = ''
72 runHook preInstallCheck
73 ${python.executable} -m pytest --junit-xml= --ignore=lib/test/automation lib/test
74 pushd lib/test_with_mocks
75 ${python.executable} -m pytest --junit-xml=
76 popd
77 runHook postInstallCheck
78 '';
79
80 # Allow local networking in tests on Darwin
81 __darwinAllowLocalNetworking = true;
82
83 pythonImportsCheck = [ "pulumi" ];
84
85 meta = {
86 description = "Modern Infrastructure as Code. Any cloud, any language";
87 homepage = "https://www.pulumi.com";
88 license = lib.licenses.asl20;
89 # https://github.com/pulumi/pulumi/issues/16828
90 broken = lib.versionAtLeast protobuf.version "5";
91 maintainers = with lib.maintainers; [
92 teto
93 tie
94 ];
95 };
96}