writer 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. writer-0.6.0/LICENSE.txt +190 -0
  2. writer-0.6.0/PKG-INFO +111 -0
  3. writer-0.6.0/README.md +77 -0
  4. writer-0.6.0/pyproject.toml +102 -0
  5. writer-0.6.0/src/writer/__init__.py +130 -0
  6. writer-0.6.0/src/writer/ai.py +480 -0
  7. writer-0.6.0/src/writer/app_runner.py +834 -0
  8. writer-0.6.0/src/writer/app_templates/ai-starter/README.md +3 -0
  9. writer-0.6.0/src/writer/app_templates/ai-starter/main.py +14 -0
  10. writer-0.6.0/src/writer/app_templates/ai-starter/pyproject.toml +15 -0
  11. writer-0.6.0/src/writer/app_templates/ai-starter/static/README.md +8 -0
  12. writer-0.6.0/src/writer/app_templates/ai-starter/static/favicon.png +0 -0
  13. writer-0.6.0/src/writer/app_templates/ai-starter/ui.json +54 -0
  14. writer-0.6.0/src/writer/app_templates/default/README.md +3 -0
  15. writer-0.6.0/src/writer/app_templates/default/main.py +40 -0
  16. writer-0.6.0/src/writer/app_templates/default/pyproject.toml +15 -0
  17. writer-0.6.0/src/writer/app_templates/default/static/README.md +8 -0
  18. writer-0.6.0/src/writer/app_templates/default/static/favicon.png +0 -0
  19. writer-0.6.0/src/writer/app_templates/default/ui.json +158 -0
  20. writer-0.6.0/src/writer/app_templates/hello/README.md +3 -0
  21. writer-0.6.0/src/writer/app_templates/hello/assets/main_df.csv +21 -0
  22. writer-0.6.0/src/writer/app_templates/hello/assets/story.txt +17 -0
  23. writer-0.6.0/src/writer/app_templates/hello/main.py +151 -0
  24. writer-0.6.0/src/writer/app_templates/hello/pyproject.toml +15 -0
  25. writer-0.6.0/src/writer/app_templates/hello/static/README.md +13 -0
  26. writer-0.6.0/src/writer/app_templates/hello/static/favicon.png +0 -0
  27. writer-0.6.0/src/writer/app_templates/hello/static/pigeon1.jpg +0 -0
  28. writer-0.6.0/src/writer/app_templates/hello/test_app.py +44 -0
  29. writer-0.6.0/src/writer/app_templates/hello/ui.json +1068 -0
  30. writer-0.6.0/src/writer/app_templates/pdg-tutorial/README.md +3 -0
  31. writer-0.6.0/src/writer/app_templates/pdg-tutorial/main.py +17 -0
  32. writer-0.6.0/src/writer/app_templates/pdg-tutorial/prompts.py +66 -0
  33. writer-0.6.0/src/writer/app_templates/pdg-tutorial/pyproject.toml +15 -0
  34. writer-0.6.0/src/writer/app_templates/pdg-tutorial/static/README.md +8 -0
  35. writer-0.6.0/src/writer/app_templates/pdg-tutorial/static/favicon.png +0 -0
  36. writer-0.6.0/src/writer/app_templates/pdg-tutorial/ui.json +169 -0
  37. writer-0.6.0/src/writer/app_templates/quickstart/README.md +3 -0
  38. writer-0.6.0/src/writer/app_templates/quickstart/main.py +113 -0
  39. writer-0.6.0/src/writer/app_templates/quickstart/pyproject.toml +15 -0
  40. writer-0.6.0/src/writer/app_templates/quickstart/requirements.txt +1 -0
  41. writer-0.6.0/src/writer/app_templates/quickstart/static/README.md +13 -0
  42. writer-0.6.0/src/writer/app_templates/quickstart/static/favicon.png +0 -0
  43. writer-0.6.0/src/writer/app_templates/quickstart/ui.json +192 -0
  44. writer-0.6.0/src/writer/app_templates/text-demo/README.md +3 -0
  45. writer-0.6.0/src/writer/app_templates/text-demo/main.py +29 -0
  46. writer-0.6.0/src/writer/app_templates/text-demo/pyproject.toml +15 -0
  47. writer-0.6.0/src/writer/app_templates/text-demo/static/README.md +8 -0
  48. writer-0.6.0/src/writer/app_templates/text-demo/static/favicon.png +0 -0
  49. writer-0.6.0/src/writer/app_templates/text-demo/ui.json +149 -0
  50. writer-0.6.0/src/writer/auth.py +245 -0
  51. writer-0.6.0/src/writer/command_line.py +164 -0
  52. writer-0.6.0/src/writer/core.py +1503 -0
  53. writer-0.6.0/src/writer/core_ui.py +433 -0
  54. writer-0.6.0/src/writer/deploy.py +186 -0
  55. writer-0.6.0/src/writer/mypy.ini +2 -0
  56. writer-0.6.0/src/writer/py.typed +0 -0
  57. writer-0.6.0/src/writer/serve.py +596 -0
  58. writer-0.6.0/src/writer/ss_types.py +163 -0
  59. writer-0.6.0/src/writer/static/assets/Arrow.dom-C52_vrWm.js +1 -0
  60. writer-0.6.0/src/writer/static/assets/BuilderApp-DakBH-QB.js +743 -0
  61. writer-0.6.0/src/writer/static/assets/BuilderApp-DjkgRMd3.css +1 -0
  62. writer-0.6.0/src/writer/static/assets/ComponentRenderer-BnXm57ig.css +1 -0
  63. writer-0.6.0/src/writer/static/assets/ComponentRenderer-PYR7CN9R.js +1 -0
  64. writer-0.6.0/src/writer/static/assets/abap-D8nrxEjS.js +6 -0
  65. writer-0.6.0/src/writer/static/assets/apex-BrXDlLUW.js +6 -0
  66. writer-0.6.0/src/writer/static/assets/azcli-CElzELwZ.js +6 -0
  67. writer-0.6.0/src/writer/static/assets/bat-CUsyEhik.js +6 -0
  68. writer-0.6.0/src/writer/static/assets/bicep-BtxyJn6H.js +7 -0
  69. writer-0.6.0/src/writer/static/assets/cameligo-ClBCoF8h.js +6 -0
  70. writer-0.6.0/src/writer/static/assets/clojure-B9TqLHAk.js +6 -0
  71. writer-0.6.0/src/writer/static/assets/codicon-BA2IlpFX.ttf +0 -0
  72. writer-0.6.0/src/writer/static/assets/coffee-DYsfeylR.js +6 -0
  73. writer-0.6.0/src/writer/static/assets/cpp-VVGvvgir.js +6 -0
  74. writer-0.6.0/src/writer/static/assets/csharp-Z6z2stHy.js +6 -0
  75. writer-0.6.0/src/writer/static/assets/csp-DgZoLDI1.js +6 -0
  76. writer-0.6.0/src/writer/static/assets/css-KqQ96-gC.js +8 -0
  77. writer-0.6.0/src/writer/static/assets/css.worker-DvNUQFd1.js +84 -0
  78. writer-0.6.0/src/writer/static/assets/cssMode-BjK5GHby.js +9 -0
  79. writer-0.6.0/src/writer/static/assets/cypher-CYoSlgTu.js +6 -0
  80. writer-0.6.0/src/writer/static/assets/dart-BGDl7St1.js +6 -0
  81. writer-0.6.0/src/writer/static/assets/dockerfile-CuCtxA7T.js +6 -0
  82. writer-0.6.0/src/writer/static/assets/ecl-BCTFAUpS.js +6 -0
  83. writer-0.6.0/src/writer/static/assets/editor.worker-BVwmgLrR.js +11 -0
  84. writer-0.6.0/src/writer/static/assets/elixir-C7hRTYZ9.js +6 -0
  85. writer-0.6.0/src/writer/static/assets/flow9-Bi_qi707.js +6 -0
  86. writer-0.6.0/src/writer/static/assets/freemarker2-i8lRH5rw.js +8 -0
  87. writer-0.6.0/src/writer/static/assets/fsharp-CxaaEKKi.js +6 -0
  88. writer-0.6.0/src/writer/static/assets/go-DUImKuGY.js +6 -0
  89. writer-0.6.0/src/writer/static/assets/graphql-D5sGVkLV.js +6 -0
  90. writer-0.6.0/src/writer/static/assets/handlebars-C-M0xH-3.js +6 -0
  91. writer-0.6.0/src/writer/static/assets/hcl-zD_CCkZ1.js +6 -0
  92. writer-0.6.0/src/writer/static/assets/html-D4h1E1bc.js +6 -0
  93. writer-0.6.0/src/writer/static/assets/html.worker-BJMlcbMU.js +458 -0
  94. writer-0.6.0/src/writer/static/assets/htmlMode-B2YRTiG6.js +9 -0
  95. writer-0.6.0/src/writer/static/assets/index-BaC5au8C.js +8 -0
  96. writer-0.6.0/src/writer/static/assets/index-DMFOqlrb.js +1 -0
  97. writer-0.6.0/src/writer/static/assets/index-DaNZqg5r.js +16 -0
  98. writer-0.6.0/src/writer/static/assets/index-XEiBUN1q.css +1 -0
  99. writer-0.6.0/src/writer/static/assets/index-cJO61pFl.js +367 -0
  100. writer-0.6.0/src/writer/static/assets/ini-8kKHd4ZL.js +6 -0
  101. writer-0.6.0/src/writer/static/assets/java-De1axCfe.js +6 -0
  102. writer-0.6.0/src/writer/static/assets/javascript-BYM0Yx4u.js +6 -0
  103. writer-0.6.0/src/writer/static/assets/json.worker-BwvX8PuZ.js +42 -0
  104. writer-0.6.0/src/writer/static/assets/jsonMode-B8RZLFyl.js +11 -0
  105. writer-0.6.0/src/writer/static/assets/julia-D3ApGBxz.js +6 -0
  106. writer-0.6.0/src/writer/static/assets/kotlin-GbSrCElU.js +6 -0
  107. writer-0.6.0/src/writer/static/assets/less-DNUaDNdz.js +7 -0
  108. writer-0.6.0/src/writer/static/assets/lexon-Bg9QKxBu.js +6 -0
  109. writer-0.6.0/src/writer/static/assets/liquid-ktIne1h-.js +6 -0
  110. writer-0.6.0/src/writer/static/assets/lua-Crkvc3mc.js +6 -0
  111. writer-0.6.0/src/writer/static/assets/m3-DsrzVyM1.js +6 -0
  112. writer-0.6.0/src/writer/static/assets/mapbox-gl-FST67qaq.js +2026 -0
  113. writer-0.6.0/src/writer/static/assets/markdown-CY5IOZuu.js +6 -0
  114. writer-0.6.0/src/writer/static/assets/marked.esm-273vDTCT.js +45 -0
  115. writer-0.6.0/src/writer/static/assets/mdx-Bi1uxJs7.js +6 -0
  116. writer-0.6.0/src/writer/static/assets/mips-BE8RsGBA.js +6 -0
  117. writer-0.6.0/src/writer/static/assets/msdax-N5ajIiFQ.js +6 -0
  118. writer-0.6.0/src/writer/static/assets/mysql-DRxbB97D.js +6 -0
  119. writer-0.6.0/src/writer/static/assets/objective-c-BHUZy23s.js +6 -0
  120. writer-0.6.0/src/writer/static/assets/pascal-BemVzBTY.js +6 -0
  121. writer-0.6.0/src/writer/static/assets/pascaligo-BACCcnx_.js +6 -0
  122. writer-0.6.0/src/writer/static/assets/perl-CuU66Ptk.js +6 -0
  123. writer-0.6.0/src/writer/static/assets/pgsql-CQ6TMH2r.js +6 -0
  124. writer-0.6.0/src/writer/static/assets/php-BvyzZa65.js +6 -0
  125. writer-0.6.0/src/writer/static/assets/pla-DrIuu9u1.js +6 -0
  126. writer-0.6.0/src/writer/static/assets/plotly.min-Bn62pPWj.js +3573 -0
  127. writer-0.6.0/src/writer/static/assets/postiats-BR_hrfni.js +6 -0
  128. writer-0.6.0/src/writer/static/assets/powerquery-CKDUeRmd.js +6 -0
  129. writer-0.6.0/src/writer/static/assets/powershell-Dsa4rhA_.js +6 -0
  130. writer-0.6.0/src/writer/static/assets/protobuf-CGsvhooB.js +7 -0
  131. writer-0.6.0/src/writer/static/assets/pug-D2p3uOX2.js +6 -0
  132. writer-0.6.0/src/writer/static/assets/python-DGmW9UMq.js +6 -0
  133. writer-0.6.0/src/writer/static/assets/qsharp-B7F3HtPF.js +6 -0
  134. writer-0.6.0/src/writer/static/assets/r-3aLoi2fs.js +6 -0
  135. writer-0.6.0/src/writer/static/assets/razor-NRqESbyQ.js +6 -0
  136. writer-0.6.0/src/writer/static/assets/redis-jqFeRM5s.js +6 -0
  137. writer-0.6.0/src/writer/static/assets/redshift-BriwQgXR.js +6 -0
  138. writer-0.6.0/src/writer/static/assets/remixicon-BVOYbT3K.woff2 +0 -0
  139. writer-0.6.0/src/writer/static/assets/remixicon-D9ZyeRwQ.ttf +0 -0
  140. writer-0.6.0/src/writer/static/assets/remixicon-DUK49BtM.eot +0 -0
  141. writer-0.6.0/src/writer/static/assets/remixicon-DfzPQSMi.woff +0 -0
  142. writer-0.6.0/src/writer/static/assets/remixicon-ncU_JTfY.svg +8572 -0
  143. writer-0.6.0/src/writer/static/assets/restructuredtext-hbBFZ0w9.js +6 -0
  144. writer-0.6.0/src/writer/static/assets/ruby-ByThyB2Q.js +6 -0
  145. writer-0.6.0/src/writer/static/assets/rust-DIEZMp5R.js +6 -0
  146. writer-0.6.0/src/writer/static/assets/sb-C6Gjjw_x.js +6 -0
  147. writer-0.6.0/src/writer/static/assets/scala-DZNw3jJB.js +6 -0
  148. writer-0.6.0/src/writer/static/assets/scheme-55eqh71t.js +6 -0
  149. writer-0.6.0/src/writer/static/assets/scss-D-OVkc4F.js +8 -0
  150. writer-0.6.0/src/writer/static/assets/serialization-DDqLB4lR.js +20 -0
  151. writer-0.6.0/src/writer/static/assets/shell-DSpi8_qN.js +6 -0
  152. writer-0.6.0/src/writer/static/assets/solidity-BHddiNFS.js +6 -0
  153. writer-0.6.0/src/writer/static/assets/sophia-D6taVZFb.js +6 -0
  154. writer-0.6.0/src/writer/static/assets/sparql-LA0C7mUc.js +6 -0
  155. writer-0.6.0/src/writer/static/assets/sql-C3-3IcFM.js +6 -0
  156. writer-0.6.0/src/writer/static/assets/st-C4g7059C.js +6 -0
  157. writer-0.6.0/src/writer/static/assets/swift-DNI1vH3h.js +8 -0
  158. writer-0.6.0/src/writer/static/assets/systemverilog-DL_FVbcQ.js +6 -0
  159. writer-0.6.0/src/writer/static/assets/tcl-DVJXmIwd.js +6 -0
  160. writer-0.6.0/src/writer/static/assets/ts.worker-CwG1rUES.js +37021 -0
  161. writer-0.6.0/src/writer/static/assets/tsMode-CjGd3dCD.js +16 -0
  162. writer-0.6.0/src/writer/static/assets/twig-BVWDLtw5.js +6 -0
  163. writer-0.6.0/src/writer/static/assets/typescript-8g2Igz_p.js +6 -0
  164. writer-0.6.0/src/writer/static/assets/vb-Btz91-7U.js +6 -0
  165. writer-0.6.0/src/writer/static/assets/vega-embed.module-CxKUxoHf.js +201 -0
  166. writer-0.6.0/src/writer/static/assets/wgsl-D8V_buCG.js +303 -0
  167. writer-0.6.0/src/writer/static/assets/xml-Cey2x9G0.js +6 -0
  168. writer-0.6.0/src/writer/static/assets/yaml-DiYkW6--.js +6 -0
  169. writer-0.6.0/src/writer/static/favicon.png +0 -0
  170. writer-0.6.0/src/writer/static/index.html +93 -0
  171. writer-0.6.0/src/writer/templates/auth_unauthorized.html +35 -0
  172. writer-0.6.0/src/writer/ui.py +1953 -0
  173. writer-0.6.0/src/writer/ui_manager.py +235 -0
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2024 Writer, Inc.
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
writer-0.6.0/PKG-INFO ADDED
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.1
2
+ Name: writer
3
+ Version: 0.6.0
4
+ Summary: An open-source, Python framework for building feature-rich apps that are fully integrated with the Writer platform.
5
+ Home-page: https://www.writer.com
6
+ Keywords: data apps,gui,ui,framework,writer framework
7
+ Author: Writer, Inc.
8
+ Requires-Python: >=3.9.2,<4.0
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Requires-Dist: authlib (>=1.3.0,<2.0.0)
16
+ Requires-Dist: fastapi (>=0.89.1,<1)
17
+ Requires-Dist: gitignore-parser (>=0.1.11,<0.2.0)
18
+ Requires-Dist: jinja2 (>=3.1.4,<4.0.0)
19
+ Requires-Dist: pandas (>=2.2.0,<3)
20
+ Requires-Dist: plotly (>=5.18.0,<6)
21
+ Requires-Dist: pyarrow (>=15.0.0,<16.0.0)
22
+ Requires-Dist: pydantic (>=2.6.0,<3)
23
+ Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
24
+ Requires-Dist: pytz (>=2024.1,<2025.0)
25
+ Requires-Dist: requests (>=2.31.0,<3.0.0)
26
+ Requires-Dist: uvicorn (>=0.20.0,<1)
27
+ Requires-Dist: watchdog (>=3.0.0,<4)
28
+ Requires-Dist: websockets (>=12,<13)
29
+ Requires-Dist: writer-sdk (>=0.1.2,<1)
30
+ Project-URL: Documentation, https://dev.writer.com/framework
31
+ Project-URL: Repository, https://www.github.com/streamsync-cloud/streamsync
32
+ Description-Content-Type: text/markdown
33
+
34
+ ## What is Writer Framework?
35
+
36
+ Writer Framework is an open-source framework for creating AI applications. Build user interfaces using a visual editor; write the backend code in Python.
37
+
38
+ Writer Framework is fast and flexible with a clean, easily-testable syntax. It provides separation of concerns between UI and business logic, enabling more complex applications.
39
+
40
+ ## Highlights
41
+
42
+ ### Reactive and state-driven
43
+
44
+ Writer Framework is **fully state-driven** and provides **separation of concerns** between user interface and business logic.
45
+
46
+ ```py
47
+ import writer as wf
48
+
49
+ def handle_increment(state):
50
+ state["counter"] += 1
51
+
52
+ wf.init_state({
53
+ "counter": 0
54
+ })
55
+ ```
56
+
57
+ The user interface is a template, which is defined visually. The template contains reactive references to state, e.g. `@{counter}`, and references to event handlers, e.g. when _Button_ is clicked, trigger `handle_increment`.
58
+
59
+ ### Flexible
60
+
61
+ - Elements are highly customizable with no CSS required, allowing for shadows, button icons, background colors, etc.
62
+ - HTML elements with custom CSS can be included using the _HTML Element_ component. They can serve as containers for built-in components.
63
+
64
+ ### Fast
65
+
66
+ - Event handling adds minimal overhead to your Python code (~1-2ms\*).
67
+ - Streaming (WebSockets) is used to synchronize frontend and backend states.
68
+ - The script only runs once.
69
+ - Non-blocking by default. Events are handled asynchronously in a thread pool running in a dedicated process.
70
+
71
+ \*End-to-end figure, including DOM mutation. Tested locally on a Macbook Air M2. [Measurement methodology](https://medium.com/@ramiromedina/measuring-time-elapsed-between-an-event-and-its-associated-dom-mutation-80431ad576e1).
72
+
73
+ ### Developer-friendly
74
+
75
+ - It's all contained in a standard Python package, just one `pip install` away.
76
+ - User interfaces are saved as JSON, so they can be version controlled together with the rest of the application.
77
+ - Use your local code editor and get instant refreshes when you save your code. Alternatively, use the provided web-based editor.
78
+ - You edit the UI while your app is running. No hitting "Preview" and seeing something completely different to what you expected.
79
+
80
+ ## Installation and Quickstart
81
+
82
+ Getting started with Writer Framework is easy. It works on Linux, Mac and Windows.
83
+
84
+ ```sh
85
+ pip install writer
86
+ writer hello
87
+ ```
88
+
89
+ - The first command will install Writer Framework using `pip`.
90
+ - The second command will create a demo application in the subfolder "hello" and start Writer Framework Builder, the framework's visual editor, which will be accessible via a local URL.
91
+
92
+ The following commands can be used to create, launch Writer Framework Builder and run an application.
93
+
94
+ ```sh
95
+ writer create my_app
96
+ writer edit my_app
97
+ writer run my_app
98
+ ```
99
+
100
+ ## Documentation
101
+
102
+ Full documentation, including how to use Writer's AI module and deployment options, is available at [Writer](https://dev.writer.com/framework?utm_source=github&utm_medium=readme&utm_campaign=framework).
103
+
104
+ ## About Writer
105
+
106
+ Writer is the full-stack generative AI platform for enterprises. Quickly and easily build and deploy generative AI apps with a suite of developer tools fully integrated with our platform of LLMs, graph-based RAG tools, AI guardrails, and more. Learn more at [writer.com](https://www.writer.com?utm_source=github&utm_medium=readme&utm_campaign=framework).
107
+
108
+ ## License
109
+
110
+ This project is licensed under the Apache 2.0 License.
111
+
writer-0.6.0/README.md ADDED
@@ -0,0 +1,77 @@
1
+ ## What is Writer Framework?
2
+
3
+ Writer Framework is an open-source framework for creating AI applications. Build user interfaces using a visual editor; write the backend code in Python.
4
+
5
+ Writer Framework is fast and flexible with a clean, easily-testable syntax. It provides separation of concerns between UI and business logic, enabling more complex applications.
6
+
7
+ ## Highlights
8
+
9
+ ### Reactive and state-driven
10
+
11
+ Writer Framework is **fully state-driven** and provides **separation of concerns** between user interface and business logic.
12
+
13
+ ```py
14
+ import writer as wf
15
+
16
+ def handle_increment(state):
17
+ state["counter"] += 1
18
+
19
+ wf.init_state({
20
+ "counter": 0
21
+ })
22
+ ```
23
+
24
+ The user interface is a template, which is defined visually. The template contains reactive references to state, e.g. `@{counter}`, and references to event handlers, e.g. when _Button_ is clicked, trigger `handle_increment`.
25
+
26
+ ### Flexible
27
+
28
+ - Elements are highly customizable with no CSS required, allowing for shadows, button icons, background colors, etc.
29
+ - HTML elements with custom CSS can be included using the _HTML Element_ component. They can serve as containers for built-in components.
30
+
31
+ ### Fast
32
+
33
+ - Event handling adds minimal overhead to your Python code (~1-2ms\*).
34
+ - Streaming (WebSockets) is used to synchronize frontend and backend states.
35
+ - The script only runs once.
36
+ - Non-blocking by default. Events are handled asynchronously in a thread pool running in a dedicated process.
37
+
38
+ \*End-to-end figure, including DOM mutation. Tested locally on a Macbook Air M2. [Measurement methodology](https://medium.com/@ramiromedina/measuring-time-elapsed-between-an-event-and-its-associated-dom-mutation-80431ad576e1).
39
+
40
+ ### Developer-friendly
41
+
42
+ - It's all contained in a standard Python package, just one `pip install` away.
43
+ - User interfaces are saved as JSON, so they can be version controlled together with the rest of the application.
44
+ - Use your local code editor and get instant refreshes when you save your code. Alternatively, use the provided web-based editor.
45
+ - You edit the UI while your app is running. No hitting "Preview" and seeing something completely different to what you expected.
46
+
47
+ ## Installation and Quickstart
48
+
49
+ Getting started with Writer Framework is easy. It works on Linux, Mac and Windows.
50
+
51
+ ```sh
52
+ pip install writer
53
+ writer hello
54
+ ```
55
+
56
+ - The first command will install Writer Framework using `pip`.
57
+ - The second command will create a demo application in the subfolder "hello" and start Writer Framework Builder, the framework's visual editor, which will be accessible via a local URL.
58
+
59
+ The following commands can be used to create, launch Writer Framework Builder and run an application.
60
+
61
+ ```sh
62
+ writer create my_app
63
+ writer edit my_app
64
+ writer run my_app
65
+ ```
66
+
67
+ ## Documentation
68
+
69
+ Full documentation, including how to use Writer's AI module and deployment options, is available at [Writer](https://dev.writer.com/framework?utm_source=github&utm_medium=readme&utm_campaign=framework).
70
+
71
+ ## About Writer
72
+
73
+ Writer is the full-stack generative AI platform for enterprises. Quickly and easily build and deploy generative AI apps with a suite of developer tools fully integrated with our platform of LLMs, graph-based RAG tools, AI guardrails, and more. Learn more at [writer.com](https://www.writer.com?utm_source=github&utm_medium=readme&utm_campaign=framework).
74
+
75
+ ## License
76
+
77
+ This project is licensed under the Apache 2.0 License.
@@ -0,0 +1,102 @@
1
+ [build-system]
2
+ requires = ["poetry-core"]
3
+ build-backend = "poetry.core.masonry.api"
4
+
5
+ [tool.poetry]
6
+ name = "writer"
7
+ version = "0.6.0"
8
+ description = "An open-source, Python framework for building feature-rich apps that are fully integrated with the Writer platform."
9
+ authors = ["Writer, Inc."]
10
+ readme = "README.md"
11
+ homepage = "https://www.writer.com"
12
+ repository = "https://www.github.com/streamsync-cloud/streamsync"
13
+ documentation = "https://dev.writer.com/framework"
14
+ keywords = ["data apps", "gui", "ui", "framework", "writer framework"]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3.9",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Development Status :: 4 - Beta"
21
+ ]
22
+ packages = [
23
+ { include = "writer", from = "src" }
24
+ ]
25
+ include = [
26
+ "src/writer/*.py",
27
+ "src/writer/static/**/*",
28
+ "src/writer/templates/**/*",
29
+ "src/writer/app_templates/**/*"
30
+ ]
31
+
32
+ [tool.poetry.dependencies]
33
+ authlib = "^1.3.0"
34
+ fastapi = ">= 0.89.1, < 1"
35
+ gitignore-parser = "^0.1.11"
36
+ jinja2 = "^3.1.4"
37
+ pandas = ">= 2.2.0, < 3"
38
+ plotly = ">= 5.18.0, < 6"
39
+ pyarrow = ">= 15.0.0, < 16.0.0"
40
+ pydantic = ">= 2.6.0, < 3"
41
+ python = ">=3.9.2, <4.0"
42
+ python-dateutil = "^2.9.0.post0"
43
+ pytz = "^2024.1"
44
+ requests = "^2.31.0"
45
+ uvicorn = ">= 0.20.0, < 1"
46
+ watchdog = ">= 3.0.0, < 4"
47
+ websockets = ">= 12, < 13"
48
+ writer-sdk = ">= 0.1.2, < 1"
49
+
50
+
51
+ [tool.poetry.group.build]
52
+ optional = true
53
+
54
+ [tool.poetry.group.build.dependencies]
55
+ alfred-cli = "^2.2.7"
56
+ altair = ">= 5.2.0, < 6"
57
+ httpx = ">=0.26.0, < 1"
58
+ mypy = ">= 1.8.0, < 2"
59
+ pandas = ">= 2.2.0, < 3"
60
+ pandas-stubs = ">= 2.0.0, <3"
61
+ plotly = ">= 5.18.0, < 6"
62
+ polars = "^0.20.15"
63
+ pyarrow = ">= 15.0.0, < 16.0.0"
64
+ pytest = ">= 7.0.0, < 8"
65
+ pytest-asyncio = ">= 0.23.4, < 1"
66
+ ruff = "^0.3.4"
67
+ types-requests = "^2.31.0.20240406"
68
+
69
+
70
+ [tool.poetry.group.dev.dependencies]
71
+ types-python-dateutil = "^2.9.0.20240316"
72
+
73
+ [tool.poetry.scripts]
74
+ writer = 'writer.command_line:main'
75
+
76
+
77
+ [tool.ruff]
78
+ exclude = [
79
+ "src/ui",
80
+ "src/writer/ui.py",
81
+ "docs",
82
+ "tests/e2e",
83
+ ".git",
84
+ ]
85
+
86
+ line-length = 100
87
+ indent-width = 4
88
+ target-version = "py39"
89
+
90
+ [tool.ruff.lint]
91
+ select = ["I","E", "F", "C"]
92
+ ignore = ["E501", "C901", "E712", "F401"]
93
+ fixable = ["ALL"]
94
+ unfixable = []
95
+
96
+ [tool.ruff.format]
97
+ quote-style = "double"
98
+ indent-style = "space"
99
+ skip-magic-trailing-comma = false
100
+ line-ending = "auto"
101
+
102
+
@@ -0,0 +1,130 @@
1
+ import importlib.metadata
2
+ from types import ModuleType
3
+ from typing import Any, Dict, List, Optional, Type, TypeVar, Union, cast
4
+
5
+ from writer.core import (
6
+ BytesWrapper,
7
+ Config,
8
+ FileWrapper,
9
+ Readable,
10
+ State,
11
+ WriterState,
12
+ base_component_tree,
13
+ initial_state,
14
+ new_initial_state,
15
+ session_manager,
16
+ session_verifier,
17
+ )
18
+ from writer.ui import WriterUIManager
19
+
20
+ VERSION = importlib.metadata.version("writer")
21
+
22
+ base_component_tree
23
+ session_manager
24
+ Config
25
+ session_verifier
26
+
27
+
28
+ def pack_file(file: Union[Readable, str], mime_type: Optional[str] = None):
29
+ """
30
+ Returns a FileWrapper for the file provided, which is automatically
31
+ serialised to a data URL.
32
+ """
33
+
34
+ return FileWrapper(file, mime_type)
35
+
36
+
37
+ def pack_bytes(raw_data, mime_type: Optional[str] = None):
38
+ """
39
+ Returns a BytesWrapper for the bytes raw data provided, which is automatically
40
+ serialised to a data URL.
41
+ """
42
+
43
+ return BytesWrapper(raw_data, mime_type)
44
+
45
+
46
+ S = TypeVar('S', bound=WriterState)
47
+
48
+
49
+ def init_ui() -> WriterUIManager:
50
+ """Initializes and returns an instance of WriterUIManager.
51
+ This manager provides methods to dynamically create and manage UI
52
+ components in a Writer Framework application.
53
+
54
+ The WriterUIManager allows for the creation of application-wide,
55
+ code-managed components during startup, ensuring that the set of components
56
+ is initially accessible by all sessions.
57
+
58
+ :return: An instance that serves as a bridge for programmatically
59
+ interacting with the frontend, facilitating dynamic UI component management.
60
+ :rtype: WriterUIManager
61
+
62
+ **Example**::
63
+
64
+ >>> import writer as wf
65
+ >>>
66
+ >>> with wf.init_ui() as ui:
67
+ >>> with ui.Page({"key": "hello"}):
68
+ >>> ui.Text({"text": "Hello pigeons"})
69
+ """
70
+ return WriterUIManager()
71
+
72
+
73
+ def init_state(raw_state: Dict[str, Any], schema: Optional[Type[S]] = None) -> Union[S, WriterState]:
74
+ """
75
+ Sets the initial state, which will be used as the starting point for
76
+ every session.
77
+
78
+ initial_state.user_state.state = {}
79
+ initial_state.user_state.ingest(state_dict)
80
+ return initial_state
81
+
82
+
83
+
84
+ >>> import writer as wf
85
+
86
+ >>> initial_state = wf.init_state({
87
+ >>> "counter": 0,
88
+ >>> }, schema=AppSchema)
89
+ """
90
+ concrete_schema = cast(Type[S], WriterState if schema is None else schema)
91
+ if not issubclass(concrete_schema, WriterState):
92
+ raise ValueError("Root schema must inherit from WriterState")
93
+
94
+ _initial_state: S = new_initial_state(concrete_schema, raw_state)
95
+ return _initial_state
96
+
97
+
98
+ def init_handlers(handler_modules: Union[List[ModuleType], ModuleType]):
99
+ """
100
+ Registers one or more handler modules to enable its containing functions
101
+ to be used as event handlers by the application's frontend.
102
+
103
+ :param handler_modules: A module or list of modules for registration.
104
+ :type handler_modules: module or list of modules
105
+
106
+ **Examples**
107
+
108
+ Register a single handler module:
109
+
110
+ >>> import writer as wf
111
+ >>> import my_handler_module
112
+ >>> wf.init_handlers(my_handler_module)
113
+
114
+ Register multiple handler modules:
115
+
116
+ >>> import writer as wf
117
+ >>> import module_one, module_two
118
+ >>> wf.init_handlers([module_one, module_two])
119
+
120
+ :raises ValueError: If an object that is not a module is attempted to be registered.
121
+ """
122
+ from writer.core import get_app_process
123
+ current_app_process = get_app_process()
124
+ handler_registry = current_app_process.handler_registry
125
+ # Ensure handler_modules is a list
126
+ if not isinstance(handler_modules, list):
127
+ handler_modules = [handler_modules]
128
+
129
+ for module in handler_modules:
130
+ handler_registry.register_module(module)