arkitekt-next 0.31.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 (103) hide show
  1. arkitekt_next-0.31.0/.gitignore +148 -0
  2. arkitekt_next-0.31.0/LICENSE +21 -0
  3. arkitekt_next-0.31.0/PKG-INFO +175 -0
  4. arkitekt_next-0.31.0/README.md +117 -0
  5. arkitekt_next-0.31.0/arkitekt_next/__init__.py +108 -0
  6. arkitekt_next-0.31.0/arkitekt_next/app/__init__.py +3 -0
  7. arkitekt_next-0.31.0/arkitekt_next/app/app.py +73 -0
  8. arkitekt_next-0.31.0/arkitekt_next/app/fakts.py +116 -0
  9. arkitekt_next-0.31.0/arkitekt_next/builders.py +215 -0
  10. arkitekt_next-0.31.0/arkitekt_next/cli/__init__.py +0 -0
  11. arkitekt_next-0.31.0/arkitekt_next/cli/commands/call/__init__.py +0 -0
  12. arkitekt_next-0.31.0/arkitekt_next/cli/commands/call/local.py +107 -0
  13. arkitekt_next-0.31.0/arkitekt_next/cli/commands/call/main.py +28 -0
  14. arkitekt_next-0.31.0/arkitekt_next/cli/commands/call/remote.py +87 -0
  15. arkitekt_next-0.31.0/arkitekt_next/cli/commands/gen/__init__.py +0 -0
  16. arkitekt_next-0.31.0/arkitekt_next/cli/commands/gen/compile.py +45 -0
  17. arkitekt_next-0.31.0/arkitekt_next/cli/commands/gen/init.py +160 -0
  18. arkitekt_next-0.31.0/arkitekt_next/cli/commands/gen/main.py +29 -0
  19. arkitekt_next-0.31.0/arkitekt_next/cli/commands/gen/watch.py +32 -0
  20. arkitekt_next-0.31.0/arkitekt_next/cli/commands/init/__init__.py +0 -0
  21. arkitekt_next-0.31.0/arkitekt_next/cli/commands/init/main.py +184 -0
  22. arkitekt_next-0.31.0/arkitekt_next/cli/commands/inspect/__init__.py +0 -0
  23. arkitekt_next-0.31.0/arkitekt_next/cli/commands/inspect/implementations.py +107 -0
  24. arkitekt_next-0.31.0/arkitekt_next/cli/commands/inspect/main.py +24 -0
  25. arkitekt_next-0.31.0/arkitekt_next/cli/commands/inspect/requirements.py +71 -0
  26. arkitekt_next-0.31.0/arkitekt_next/cli/commands/inspect/variables.py +90 -0
  27. arkitekt_next-0.31.0/arkitekt_next/cli/commands/kabinet/__init__.py +0 -0
  28. arkitekt_next-0.31.0/arkitekt_next/cli/commands/kabinet/build.py +348 -0
  29. arkitekt_next-0.31.0/arkitekt_next/cli/commands/kabinet/init.py +117 -0
  30. arkitekt_next-0.31.0/arkitekt_next/cli/commands/kabinet/io.py +206 -0
  31. arkitekt_next-0.31.0/arkitekt_next/cli/commands/kabinet/main.py +43 -0
  32. arkitekt_next-0.31.0/arkitekt_next/cli/commands/kabinet/publish.py +101 -0
  33. arkitekt_next-0.31.0/arkitekt_next/cli/commands/kabinet/stage.py +67 -0
  34. arkitekt_next-0.31.0/arkitekt_next/cli/commands/kabinet/types.py +137 -0
  35. arkitekt_next-0.31.0/arkitekt_next/cli/commands/kabinet/utils.py +48 -0
  36. arkitekt_next-0.31.0/arkitekt_next/cli/commands/kabinet/validate.py +78 -0
  37. arkitekt_next-0.31.0/arkitekt_next/cli/commands/manifest/__init__.py +0 -0
  38. arkitekt_next-0.31.0/arkitekt_next/cli/commands/manifest/inspect.py +37 -0
  39. arkitekt_next-0.31.0/arkitekt_next/cli/commands/manifest/main.py +23 -0
  40. arkitekt_next-0.31.0/arkitekt_next/cli/commands/manifest/scopes.py +155 -0
  41. arkitekt_next-0.31.0/arkitekt_next/cli/commands/manifest/version.py +147 -0
  42. arkitekt_next-0.31.0/arkitekt_next/cli/commands/run/__init__.py +0 -0
  43. arkitekt_next-0.31.0/arkitekt_next/cli/commands/run/dev.py +361 -0
  44. arkitekt_next-0.31.0/arkitekt_next/cli/commands/run/main.py +22 -0
  45. arkitekt_next-0.31.0/arkitekt_next/cli/commands/run/prod.py +66 -0
  46. arkitekt_next-0.31.0/arkitekt_next/cli/commands/run/utils.py +24 -0
  47. arkitekt_next-0.31.0/arkitekt_next/cli/constants.py +58 -0
  48. arkitekt_next-0.31.0/arkitekt_next/cli/dockerfiles/vanilla.dockerfile +8 -0
  49. arkitekt_next-0.31.0/arkitekt_next/cli/errors.py +4 -0
  50. arkitekt_next-0.31.0/arkitekt_next/cli/inspect.py +1 -0
  51. arkitekt_next-0.31.0/arkitekt_next/cli/io.py +74 -0
  52. arkitekt_next-0.31.0/arkitekt_next/cli/main.py +81 -0
  53. arkitekt_next-0.31.0/arkitekt_next/cli/options.py +173 -0
  54. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/fluss.schema.graphql +2446 -0
  55. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/gucker.schema.graphql +8908 -0
  56. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/kabinet.schema.graphql +515 -0
  57. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/kluster.schema.graphql +109 -0
  58. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/konviktion.schema.graphql +70 -0
  59. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/kuay.schema.graphql +356 -0
  60. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/mikro.schema.graphql +8908 -0
  61. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/mikro_next.schema.graphql +1639 -0
  62. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/napari.schema.graphql +8908 -0
  63. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/omero_ark.schema.graphql +100 -0
  64. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/port.schema.graphql +356 -0
  65. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/rekuest.schema.graphql +4630 -0
  66. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/rekuest_next.schema.graphql +1159 -0
  67. arkitekt_next-0.31.0/arkitekt_next/cli/schemas/unlok.schema.graphql +1013 -0
  68. arkitekt_next-0.31.0/arkitekt_next/cli/templates/filter.py +26 -0
  69. arkitekt_next-0.31.0/arkitekt_next/cli/templates/simple.py +70 -0
  70. arkitekt_next-0.31.0/arkitekt_next/cli/texts.py +20 -0
  71. arkitekt_next-0.31.0/arkitekt_next/cli/types.py +41 -0
  72. arkitekt_next-0.31.0/arkitekt_next/cli/ui.py +123 -0
  73. arkitekt_next-0.31.0/arkitekt_next/cli/utils.py +15 -0
  74. arkitekt_next-0.31.0/arkitekt_next/cli/validators.py +17 -0
  75. arkitekt_next-0.31.0/arkitekt_next/cli/vars.py +39 -0
  76. arkitekt_next-0.31.0/arkitekt_next/cli/versions/v1.yaml +1 -0
  77. arkitekt_next-0.31.0/arkitekt_next/constants.py +2 -0
  78. arkitekt_next-0.31.0/arkitekt_next/init_registry.py +122 -0
  79. arkitekt_next-0.31.0/arkitekt_next/inspect.py +29 -0
  80. arkitekt_next-0.31.0/arkitekt_next/node_id.py +42 -0
  81. arkitekt_next-0.31.0/arkitekt_next/protocols.py +60 -0
  82. arkitekt_next-0.31.0/arkitekt_next/py.typed +0 -0
  83. arkitekt_next-0.31.0/arkitekt_next/pytest/__init__.py +1 -0
  84. arkitekt_next-0.31.0/arkitekt_next/pytest/fixtures.py +86 -0
  85. arkitekt_next-0.31.0/arkitekt_next/qt/__init__.py +15 -0
  86. arkitekt_next-0.31.0/arkitekt_next/qt/assets/dark/gear.png +0 -0
  87. arkitekt_next-0.31.0/arkitekt_next/qt/assets/dark/green pulse.gif +0 -0
  88. arkitekt_next-0.31.0/arkitekt_next/qt/assets/dark/orange pulse.gif +0 -0
  89. arkitekt_next-0.31.0/arkitekt_next/qt/assets/dark/pink pulse.gif +0 -0
  90. arkitekt_next-0.31.0/arkitekt_next/qt/assets/dark/red pulse.gif +0 -0
  91. arkitekt_next-0.31.0/arkitekt_next/qt/assets/light/gear.png +0 -0
  92. arkitekt_next-0.31.0/arkitekt_next/qt/assets/light/green pulse.gif +0 -0
  93. arkitekt_next-0.31.0/arkitekt_next/qt/assets/light/orange pulse.gif +0 -0
  94. arkitekt_next-0.31.0/arkitekt_next/qt/assets/light/pink pulse.gif +0 -0
  95. arkitekt_next-0.31.0/arkitekt_next/qt/assets/light/red pulse.gif +0 -0
  96. arkitekt_next-0.31.0/arkitekt_next/qt/builders.py +167 -0
  97. arkitekt_next-0.31.0/arkitekt_next/qt/magic_bar.py +527 -0
  98. arkitekt_next-0.31.0/arkitekt_next/qt/types.py +126 -0
  99. arkitekt_next-0.31.0/arkitekt_next/qt/utils.py +30 -0
  100. arkitekt_next-0.31.0/arkitekt_next/service_registry.py +203 -0
  101. arkitekt_next-0.31.0/arkitekt_next/tqdm.py +106 -0
  102. arkitekt_next-0.31.0/arkitekt_next/utils.py +76 -0
  103. arkitekt_next-0.31.0/pyproject.toml +154 -0
@@ -0,0 +1,148 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ **/__pycache__
4
+ *.py[cod]
5
+ *$py.class
6
+ *.pyc
7
+ *.DS_Store
8
+
9
+ # C extensions
10
+ *.so
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ wheels/
26
+ pip-wheel-metadata/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+
32
+ # PyInstaller
33
+ # Usually these files are written by a python script from a template
34
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
+
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py,cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+ cover/
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+ db.sqlite3-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ .pybuilder/
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # pyenv
89
+ # For a library or package, you might want to ignore these files since the code is
90
+ # intended to run in multiple environments; otherwise, check them in:
91
+ # .python-version
92
+
93
+ # pipenv
94
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
96
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
97
+ # install all needed dependencies.
98
+ #Pipfile.lock
99
+
100
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
101
+ __pypackages__/
102
+
103
+ # Celery stuff
104
+ celerybeat-schedule
105
+ celerybeat.pid
106
+
107
+ # SageMath parsed files
108
+ *.sage.py
109
+
110
+ # Environments
111
+ .env
112
+ .venv
113
+ env/
114
+ venv/
115
+ ENV/
116
+ env.bak/
117
+ venv.bak/
118
+
119
+ # Spyder project settings
120
+ .spyderproject
121
+ .spyproject
122
+
123
+ # Rope project settings
124
+ .ropeproject
125
+
126
+ # mkdocs documentation
127
+ /site
128
+
129
+ # mypy
130
+ .mypy_cache/
131
+ .dmypy.json
132
+ dmypy.json
133
+
134
+ # Pyre type checker
135
+ .pyre/
136
+
137
+ # pytype static type analyzer
138
+ .pytype/
139
+
140
+ # Cython debug symbols
141
+ cython_debug/
142
+
143
+ # static files generated from Django application using `collectstatic`
144
+ media
145
+ export
146
+ static_collected
147
+ data
148
+ token.temp
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Johannes Roos <jhnnsrs@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: arkitekt-next
3
+ Version: 0.31.0
4
+ Summary: client for the arkitekt_next platform
5
+ Author-email: jhnnsrs <jhnnsrs@gmail.com>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: <4,>=3.11
9
+ Requires-Dist: click>=8.2.0
10
+ Requires-Dist: dokker>=2.3.0
11
+ Requires-Dist: fakts-next>=2.3.0
12
+ Requires-Dist: kabinet>=0.9.0
13
+ Requires-Dist: koil>=2.0.6
14
+ Requires-Dist: platformdirs>=4.5.0
15
+ Requires-Dist: rath>=3.7.0
16
+ Requires-Dist: rekuest-next>=0.18.3
17
+ Requires-Dist: rich-click>=1.8.8
18
+ Requires-Dist: semver>=3.0.4
19
+ Requires-Dist: turms>=0.10.1
20
+ Requires-Dist: watchfiles>=1.0.5
21
+ Provides-Extra: all
22
+ Requires-Dist: fluss-next>=0.2.0; extra == 'all'
23
+ Requires-Dist: kabinet>=0.6.0; extra == 'all'
24
+ Requires-Dist: mikro-next>=0.7.2; extra == 'all'
25
+ Requires-Dist: reaktion-next>=0.2.0; extra == 'all'
26
+ Requires-Dist: rekuest-next>=0.7; extra == 'all'
27
+ Requires-Dist: rich-click>=1.6.1; extra == 'all'
28
+ Requires-Dist: semver>=3.0.1; extra == 'all'
29
+ Requires-Dist: turms>=0.9; extra == 'all'
30
+ Requires-Dist: unlok-next>=1.1.1; extra == 'all'
31
+ Requires-Dist: watchfiles>=0.18.1; extra == 'all'
32
+ Provides-Extra: alpaka
33
+ Requires-Dist: alpaka>=0.2.0; extra == 'alpaka'
34
+ Provides-Extra: blok
35
+ Requires-Dist: blok>=0.1.0; extra == 'blok'
36
+ Provides-Extra: cli
37
+ Requires-Dist: turms>=0.9.0; extra == 'cli'
38
+ Provides-Extra: elektro
39
+ Requires-Dist: elektro>=0.5.0; extra == 'elektro'
40
+ Provides-Extra: extended
41
+ Requires-Dist: alpaka>=0.2.0; extra == 'extended'
42
+ Requires-Dist: kraph>=0.2.0; extra == 'extended'
43
+ Provides-Extra: fluss
44
+ Requires-Dist: fluss-next>=0.2.0; extra == 'fluss'
45
+ Provides-Extra: kabinet
46
+ Requires-Dist: kabinet>=0.6.0; extra == 'kabinet'
47
+ Provides-Extra: kraph
48
+ Requires-Dist: kraph>=0.2.0; extra == 'kraph'
49
+ Provides-Extra: lovekit
50
+ Requires-Dist: lovekit>=0.2.0; extra == 'lovekit'
51
+ Provides-Extra: mikro
52
+ Requires-Dist: mikro-next>=0.7.2; extra == 'mikro'
53
+ Provides-Extra: reaktion
54
+ Requires-Dist: reaktion-next>=0.2.0; extra == 'reaktion'
55
+ Provides-Extra: unlok
56
+ Requires-Dist: unlok-next>=1.1.1; extra == 'unlok'
57
+ Description-Content-Type: text/markdown
58
+
59
+ # arkitekt-next
60
+
61
+ [![codecov](https://codecov.io/gh/jhnnsrs/arkitekt_next/branch/master/graph/badge.svg?token=UGXEA2THBV)](https://codecov.io/gh/jhnnsrs/arkitekt_next)
62
+ [![PyPI version](https://badge.fury.io/py/arkitekt_next.svg)](https://pypi.org/project/arkitekt_next/)
63
+ [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://pypi.org/project/arkitekt_next/)
64
+ ![Maintainer](https://img.shields.io/badge/maintainer-jhnnsrs-blue)
65
+ [![PyPI pyversions](https://img.shields.io/pypi/pyversions/arkitekt_next.svg)](https://pypi.python.org/pypi/arkitekt_next/)
66
+ [![PyPI status](https://img.shields.io/pypi/status/arkitekt_next.svg)](https://pypi.python.org/pypi/arkitekt_next/)
67
+
68
+ streaming analysis for mikroscopy
69
+
70
+ ## Idea
71
+
72
+ arkitekt-next is the python client for the arkitekt_next platform. It allows you to utilize the full extent of the platform from your python code.
73
+ To understand the idea behind arkitekt_next, you need to understand the idea behind the arkitekt_next platform.
74
+ (More on this in the [documentation](https://arkitekt.live))
75
+
76
+ ## Features
77
+
78
+ - Host your python functions and make them to your team
79
+ - Use functions from your team in your code
80
+ - Interact with and store data in a secure and scalable way on the platform
81
+ - Use the platform as a central storage for your data
82
+
83
+ ## Install
84
+
85
+ ```bash
86
+ pip install arkitekt-next[all]
87
+ ```
88
+
89
+ This installs all dependencies for the arkitekt_next platform, inlcuding the arkitekt_next CLI, which can be used to develop and create apps, containerize them and deploy t
90
+
91
+ arkitekt_next is relying heavily on asyncio patters and therfore supports python 3.8 and above. It also relies on the pydantic stack for serialization.
92
+
93
+ ## App
94
+
95
+ You can use the cli to create python based apps for the arkitekt_next platform, profiting from a battery of features like easy GUI creation based on
96
+ type annotations, orchestration of real-time (in memoery) workflows, data hosting, easy packaging and distribution in docker containers, etc...
97
+
98
+ To get started create a directory and run
99
+
100
+ ```bash
101
+ arkitekt-next init
102
+ ```
103
+
104
+ Which will lead you throught an app creation process.
105
+ Apps can simply registered functions, through the register decorator
106
+
107
+ ```python
108
+ from arkitekt_next import register
109
+
110
+ @register()
111
+ def rpc_function(x: int, name: str) -> str
112
+ """
113
+ A rpc function that we can
114
+ simple call from anywhere
115
+
116
+ ""
117
+
118
+ ```
119
+
120
+ And then connected to a local or remote server by running
121
+
122
+ Run example:
123
+
124
+ ```bash
125
+ arkitekt-next run dev
126
+ ```
127
+
128
+ For more details on how to create an app follow the tutorials on https://arkitekt.live.
129
+
130
+ ## Usage with complex Datastructures
131
+
132
+ ArkitektNext takes care of serialization and documentation of standard python datastructures
133
+
134
+ - str
135
+ - bool
136
+ - int
137
+ - float
138
+ - Enum
139
+ - Dict
140
+ - List
141
+
142
+ To increase performance and reduce latency it is not possible to serialize complex python objects like numpy arrays into the messages. These are best transformed into immutable objects on a centrally accessible storage and then only the reference is passed.
143
+
144
+ ArkitektNext does not impose any rules on how you handle this storage (see mikro for ideas), it provides however a simple api.
145
+
146
+ ```python
147
+
148
+ class ComplexStructure:
149
+ id: str # A reference for this structure on central storage
150
+
151
+ async def shrink(self):
152
+ return self.id
153
+
154
+ @classmethod
155
+ async def expand(cls, value):
156
+ return cls.load_from_server(value)
157
+
158
+
159
+ ```
160
+
161
+ by providing two functions:
162
+
163
+ - shrink
164
+ - expand
165
+
166
+ You can now use this Structure with simple typehints and arkitekt_next will automaticall shrink (serialize) and expand (deserialize) the structure on calling.
167
+
168
+ ```python
169
+
170
+ def complex_call(x: ComplexStrucuture) -> int:
171
+ return x.max()
172
+
173
+ ```
174
+
175
+ Check out the arkitekt_next [documentation](https://arkitekt.live) for usage of this libary
@@ -0,0 +1,117 @@
1
+ # arkitekt-next
2
+
3
+ [![codecov](https://codecov.io/gh/jhnnsrs/arkitekt_next/branch/master/graph/badge.svg?token=UGXEA2THBV)](https://codecov.io/gh/jhnnsrs/arkitekt_next)
4
+ [![PyPI version](https://badge.fury.io/py/arkitekt_next.svg)](https://pypi.org/project/arkitekt_next/)
5
+ [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://pypi.org/project/arkitekt_next/)
6
+ ![Maintainer](https://img.shields.io/badge/maintainer-jhnnsrs-blue)
7
+ [![PyPI pyversions](https://img.shields.io/pypi/pyversions/arkitekt_next.svg)](https://pypi.python.org/pypi/arkitekt_next/)
8
+ [![PyPI status](https://img.shields.io/pypi/status/arkitekt_next.svg)](https://pypi.python.org/pypi/arkitekt_next/)
9
+
10
+ streaming analysis for mikroscopy
11
+
12
+ ## Idea
13
+
14
+ arkitekt-next is the python client for the arkitekt_next platform. It allows you to utilize the full extent of the platform from your python code.
15
+ To understand the idea behind arkitekt_next, you need to understand the idea behind the arkitekt_next platform.
16
+ (More on this in the [documentation](https://arkitekt.live))
17
+
18
+ ## Features
19
+
20
+ - Host your python functions and make them to your team
21
+ - Use functions from your team in your code
22
+ - Interact with and store data in a secure and scalable way on the platform
23
+ - Use the platform as a central storage for your data
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pip install arkitekt-next[all]
29
+ ```
30
+
31
+ This installs all dependencies for the arkitekt_next platform, inlcuding the arkitekt_next CLI, which can be used to develop and create apps, containerize them and deploy t
32
+
33
+ arkitekt_next is relying heavily on asyncio patters and therfore supports python 3.8 and above. It also relies on the pydantic stack for serialization.
34
+
35
+ ## App
36
+
37
+ You can use the cli to create python based apps for the arkitekt_next platform, profiting from a battery of features like easy GUI creation based on
38
+ type annotations, orchestration of real-time (in memoery) workflows, data hosting, easy packaging and distribution in docker containers, etc...
39
+
40
+ To get started create a directory and run
41
+
42
+ ```bash
43
+ arkitekt-next init
44
+ ```
45
+
46
+ Which will lead you throught an app creation process.
47
+ Apps can simply registered functions, through the register decorator
48
+
49
+ ```python
50
+ from arkitekt_next import register
51
+
52
+ @register()
53
+ def rpc_function(x: int, name: str) -> str
54
+ """
55
+ A rpc function that we can
56
+ simple call from anywhere
57
+
58
+ ""
59
+
60
+ ```
61
+
62
+ And then connected to a local or remote server by running
63
+
64
+ Run example:
65
+
66
+ ```bash
67
+ arkitekt-next run dev
68
+ ```
69
+
70
+ For more details on how to create an app follow the tutorials on https://arkitekt.live.
71
+
72
+ ## Usage with complex Datastructures
73
+
74
+ ArkitektNext takes care of serialization and documentation of standard python datastructures
75
+
76
+ - str
77
+ - bool
78
+ - int
79
+ - float
80
+ - Enum
81
+ - Dict
82
+ - List
83
+
84
+ To increase performance and reduce latency it is not possible to serialize complex python objects like numpy arrays into the messages. These are best transformed into immutable objects on a centrally accessible storage and then only the reference is passed.
85
+
86
+ ArkitektNext does not impose any rules on how you handle this storage (see mikro for ideas), it provides however a simple api.
87
+
88
+ ```python
89
+
90
+ class ComplexStructure:
91
+ id: str # A reference for this structure on central storage
92
+
93
+ async def shrink(self):
94
+ return self.id
95
+
96
+ @classmethod
97
+ async def expand(cls, value):
98
+ return cls.load_from_server(value)
99
+
100
+
101
+ ```
102
+
103
+ by providing two functions:
104
+
105
+ - shrink
106
+ - expand
107
+
108
+ You can now use this Structure with simple typehints and arkitekt_next will automaticall shrink (serialize) and expand (deserialize) the structure on calling.
109
+
110
+ ```python
111
+
112
+ def complex_call(x: ComplexStrucuture) -> int:
113
+ return x.max()
114
+
115
+ ```
116
+
117
+ Check out the arkitekt_next [documentation](https://arkitekt.live) for usage of this libary
@@ -0,0 +1,108 @@
1
+ from .builders import easy, interactive
2
+ from .app.app import App
3
+ from fakts_next.helpers import afakt, fakt
4
+ from .init_registry import init, InitHookRegistry, get_default_init_hook_registry
5
+ from .service_registry import (
6
+ require,
7
+ ServiceBuilderRegistry,
8
+ get_default_service_registry,
9
+ )
10
+
11
+
12
+ def missing_install(name: str, error: Exception):
13
+ def real_missing_install(*args, **kwargs):
14
+ raise ImportError(
15
+ f"Missing import: {name}. Please install the missing package. "
16
+ ) from error
17
+
18
+ return real_missing_install
19
+
20
+
21
+ try:
22
+ from rekuest_next.register import register
23
+ from rekuest_next.agents.hooks.background import background
24
+ from rekuest_next.agents.hooks.startup import startup
25
+ from rekuest_next.agents.context import context
26
+ from rekuest_next.state.decorator import state
27
+ from rekuest_next.actors.context import abreakpoint, breakpoint
28
+ from rekuest_next.actors.context import progress, aprogress
29
+ from rekuest_next.actors.context import log, alog
30
+ from rekuest_next.structures.model import model
31
+ from rekuest_next.actors.context import apublish, publish
32
+ from rekuest_next.remote import (
33
+ call,
34
+ acall,
35
+ acall_raw,
36
+ iterate,
37
+ aiterate,
38
+ aiterate_raw,
39
+ find,
40
+ )
41
+ from rekuest_next.declare import declare, protocol
42
+ from .inspect import inspect
43
+ except ImportError as e:
44
+ raise e
45
+ inspect = missing_install("rekuest_next", e)
46
+ publish = missing_install("rekuest_next", e)
47
+ apublish = missing_install("rekuest_next", e)
48
+ structure = missing_install("rekuest_next", e)
49
+ register = missing_install("rekuest_next", e)
50
+ declare = missing_install("rekuest_next", e)
51
+ protocol = missing_install("rekuest_next", e)
52
+ background = missing_install("rekuest_next", e)
53
+ abreakpoint = missing_install("rekuest_next", e)
54
+ breakpoint = missing_install("rekuest_next", e)
55
+ startup = missing_install("rekuest_next", e)
56
+ context = missing_install("rekuest_next", e)
57
+ find = missing_install("rekuest_next", e)
58
+ state = missing_install("rekuest_next", e)
59
+ progress = missing_install("rekuest_next", e)
60
+ aprogress = missing_install("rekuest_next", e)
61
+ log = missing_install("rekuest_next", e)
62
+ alog = missing_install("rekuest_next", e)
63
+ call = missing_install("rekuest_next", e)
64
+ call_raw = missing_install("rekuest_next", e)
65
+ acall = missing_install("rekuest_next", e)
66
+ acall_raw = missing_install("rekuest_next", e)
67
+ find = missing_install("rekuest_next", e)
68
+ afind = missing_install("rekuest_next", e)
69
+ aiterate_raw = missing_install("rekuest_next", e)
70
+ aiterate = missing_install("rekuest_next", e)
71
+ iterate = missing_install("rekuest_next", e)
72
+
73
+
74
+ __all__ = [
75
+ "App",
76
+ "require",
77
+ "easy",
78
+ "interactive",
79
+ "log",
80
+ "alog",
81
+ "afakt",
82
+ "fakt",
83
+ "progress",
84
+ "InitHookRegistry",
85
+ "get_default_init_hook_registry",
86
+ "aprogress",
87
+ "ServiceBuilderRegistry",
88
+ "get_default_service_registry",
89
+ "register",
90
+ "find",
91
+ "breakpoint",
92
+ "abreakpoint",
93
+ "aiterate",
94
+ "inspect",
95
+ "iterate",
96
+ "aiterate_raw",
97
+ "call",
98
+ "acall",
99
+ "acall_raw",
100
+ "model",
101
+ "state",
102
+ "context",
103
+ "background",
104
+ "startup",
105
+ "init",
106
+ "InitHookRegisty",
107
+ "get_current_init_hook_registry",
108
+ ]
@@ -0,0 +1,3 @@
1
+ from .app import App
2
+
3
+ __all__ = ["App"]
@@ -0,0 +1,73 @@
1
+ """
2
+ This module contains the types for the apps
3
+ depending on the builder used.
4
+ This module imports all the apps and their types
5
+ and sets them as attributes on the App class, if they are available.
6
+ If they are not available, they are set to Any, so that we can add
7
+ an import exception to the app.
8
+
9
+
10
+ """
11
+
12
+ import logging
13
+ from typing import Any, Dict, TYPE_CHECKING
14
+ from koil import unkoil
15
+ from koil.composition import Composition
16
+ from fakts_next import Fakts
17
+
18
+
19
+ if TYPE_CHECKING:
20
+ from rekuest_next.rekuest import RekuestNext
21
+
22
+
23
+ logger = logging.getLogger(__name__)
24
+
25
+
26
+ class App(Composition):
27
+ """An app that is built with the easy builder"""
28
+
29
+ fakts: Fakts
30
+ services: Dict[str, Any]
31
+
32
+ @property
33
+ def rekuest(self) -> "RekuestNext":
34
+ """Get the rekuest service"""
35
+ if "rekuest" not in self.services:
36
+ raise ValueError("Rekuest service is not available")
37
+ return self.services["rekuest"]
38
+
39
+ def run(self):
40
+ """Run the app by calling rekuest.run()"""
41
+ return unkoil(self.rekuest.arun)
42
+
43
+ async def arun(self):
44
+ """Run the app asynchronously"""
45
+ return await self.rekuest.arun()
46
+
47
+ def run_detached(self):
48
+ """Run the app detached"""
49
+ return self.rekuest.run_detached()
50
+
51
+ def register(self, *args, **kwargs):
52
+ """Register a service"""
53
+
54
+ self.rekuest.register(*args, **kwargs)
55
+
56
+ def register_startup(self, *args, **kwargs):
57
+ """Register a startup service"""
58
+ self.rekuest.register_startup(*args, **kwargs)
59
+
60
+ def register_background(self, *args, **kwargs):
61
+ """Register a background service"""
62
+ self.rekuest.register_background(*args, **kwargs)
63
+
64
+ async def __aenter__(self):
65
+ await super().__aenter__()
66
+ for service in self.services.values():
67
+ await service.__aenter__()
68
+
69
+ return self
70
+
71
+ async def __aexit__(self, exc_type, exc_value, traceback):
72
+ for service in self.services.values():
73
+ await service.__aexit__(exc_type, exc_value, traceback)