1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8 setuptools-scm,
9
10 # dependencies
11 appdirs,
12 asgiref,
13 click,
14 htmltools,
15 libsass,
16 linkify-it-py,
17 markdown-it-py,
18 mdit-py-plugins,
19 narwhals,
20 orjson,
21 packaging,
22 prompt-toolkit,
23 python-multipart,
24 questionary,
25 starlette,
26 typing-extensions,
27 uvicorn,
28 watchfiles,
29 websockets,
30
31 # tests
32 anthropic,
33 cacert,
34 google-generativeai,
35 langchain-core,
36 ollama,
37 openai,
38 pandas,
39 polars,
40 pytest-asyncio,
41 pytest-playwright,
42 pytest-rerunfailures,
43 pytest-timeout,
44 pytest-xdist,
45 pytestCheckHook,
46}:
47
48buildPythonPackage rec {
49 pname = "shiny";
50 version = "1.4.0";
51 pyproject = true;
52
53 src = fetchFromGitHub {
54 owner = "posit-dev";
55 repo = "py-shiny";
56 tag = "v${version}";
57 hash = "sha256-SsMZ+aiGFtP6roTiuBZWnHqPso3ZiWLgBToaTLiC2ko=";
58 };
59
60 build-system = [
61 setuptools
62 setuptools-scm
63 ];
64
65 dependencies = [
66 appdirs
67 asgiref
68 click
69 htmltools
70 linkify-it-py
71 markdown-it-py
72 mdit-py-plugins
73 narwhals
74 orjson
75 packaging
76 prompt-toolkit
77 python-multipart
78 questionary
79 setuptools
80 starlette
81 typing-extensions
82 uvicorn
83 watchfiles
84 websockets
85 ];
86
87 optional-dependencies = {
88 theme = [
89 libsass
90 # FIXME package brand-yml
91 ];
92 };
93
94 pythonImportsCheck = [ "shiny" ];
95
96 nativeCheckInputs = [
97 anthropic
98 google-generativeai
99 langchain-core
100 ollama
101 openai
102 pandas
103 polars
104 pytest-asyncio
105 pytest-playwright
106 pytest-rerunfailures
107 pytest-timeout
108 pytest-xdist
109 pytestCheckHook
110 ]
111 ++ lib.flatten (lib.attrValues optional-dependencies);
112
113 env.SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
114
115 disabledTests = [
116 # Requires unpackaged brand-yml
117 "test_theme_from_brand_base_case_compiles"
118 # ValueError: A tokenizer is required to impose `token_limits` on messages
119 "test_chat_message_trimming"
120 ];
121
122 __darwinAllowLocalNetworking = true;
123
124 meta = {
125 description = "Build fast, beautiful web applications in Python";
126 homepage = "https://shiny.posit.co/py";
127 changelog = "https://github.com/posit-dev/py-shiny/blob/${src.tag}/CHANGELOG.md";
128 license = lib.licenses.mit;
129 maintainers = with lib.maintainers; [ sigmanificient ];
130 };
131}