hosteday-python 0.1.0__py3-none-any.whl

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 (50) hide show
  1. hosteday/__init__.py +111 -0
  2. hosteday/_version.py +3 -0
  3. hosteday/auth/__init__.py +34 -0
  4. hosteday/auth/hosteday_auth.py +444 -0
  5. hosteday/auth/hosteday_auth_storage.py +130 -0
  6. hosteday/auth/hosteday_session.py +184 -0
  7. hosteday/auth/hosteday_token_provider.py +82 -0
  8. hosteday/auth/hosteday_user.py +223 -0
  9. hosteday/cli/__init__.py +5 -0
  10. hosteday/cli/setup.py +163 -0
  11. hosteday/config/__init__.py +15 -0
  12. hosteday/config/hosteday_config.py +576 -0
  13. hosteday/config/hosteday_option_keys.py +60 -0
  14. hosteday/config/hosteday_url_resolver.py +255 -0
  15. hosteday/connectivity/__init__.py +5 -0
  16. hosteday/connectivity/hosteday_connectivity.py +147 -0
  17. hosteday/exceptions.py +233 -0
  18. hosteday/features/__init__.py +5 -0
  19. hosteday/features/hosteday_features.py +78 -0
  20. hosteday/hosteday.py +346 -0
  21. hosteday/hosteday_client.py +579 -0
  22. hosteday/http/__init__.py +18 -0
  23. hosteday/http/hosteday_http_client.py +340 -0
  24. hosteday/http/hosteday_response_reader.py +171 -0
  25. hosteday/http/query_builder.py +204 -0
  26. hosteday/jobs/__init__.py +9 -0
  27. hosteday/jobs/hosteday_job_response.py +76 -0
  28. hosteday/jobs/hosteday_jobs_client.py +109 -0
  29. hosteday/notifications/__init__.py +13 -0
  30. hosteday/notifications/hosteday_notification_client.py +290 -0
  31. hosteday/notifications/hosteday_notification_response.py +79 -0
  32. hosteday/py.typed +1 -0
  33. hosteday/reactive/__init__.py +5 -0
  34. hosteday/reactive/observable_state.py +67 -0
  35. hosteday/realtime/__init__.py +31 -0
  36. hosteday/realtime/connection_state.py +14 -0
  37. hosteday/realtime/hosteday_channel.py +258 -0
  38. hosteday/realtime/hosteday_channel_auth.py +163 -0
  39. hosteday/realtime/hosteday_channel_type.py +68 -0
  40. hosteday/realtime/hosteday_realtime_client.py +790 -0
  41. hosteday/realtime/hosteday_realtime_event.py +130 -0
  42. hosteday/web/__init__.py +5 -0
  43. hosteday/web/server.py +637 -0
  44. hosteday_python/__init__.py +6 -0
  45. hosteday_python/py.typed +1 -0
  46. hosteday_python-0.1.0.dist-info/METADATA +205 -0
  47. hosteday_python-0.1.0.dist-info/RECORD +50 -0
  48. hosteday_python-0.1.0.dist-info/WHEEL +4 -0
  49. hosteday_python-0.1.0.dist-info/entry_points.txt +2 -0
  50. hosteday_python-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.5
2
+ Name: hosteday_python
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for HosteDay — Isolated Cloud Backends, Dynamic REST CRUD, Auth, Realtime (Laravel Reverb / Pusher v7), Push Notifications, and Background Jobs.
5
+ Project-URL: Homepage, https://hosteday.com
6
+ Project-URL: Documentation, https://hosteday.com/docs/hosteday-python
7
+ Project-URL: Portal, https://hosteday.com/sdks/hosteday-python
8
+ Project-URL: Repository, https://github.com/mustafa3max/hosteday-python
9
+ Project-URL: Issues, https://github.com/mustafa3max/hosteday-python/issues
10
+ Author-email: HosteDay Engineering <sdk@hosteday.com>
11
+ License: MIT
12
+ License-File: LICENSE
13
+ Keywords: async,baas,hosteday,hosteday_python,laravel-reverb,pusher,realtime,sdk,websockets
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Framework :: AsyncIO
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: fastapi<1.0.0,>=0.115.0
26
+ Requires-Dist: httpx<1.0.0,>=0.27.0
27
+ Requires-Dist: python-multipart<1.0.0,>=0.0.9
28
+ Requires-Dist: uvicorn[standard]<1.0.0,>=0.30.0
29
+ Requires-Dist: websockets<16.0,>=13.0
30
+ Provides-Extra: all
31
+ Requires-Dist: cryptography>=43.0.0; extra == 'all'
32
+ Requires-Dist: keyring>=25.0.0; extra == 'all'
33
+ Requires-Dist: pynacl>=1.5.0; extra == 'all'
34
+ Requires-Dist: rich>=13.7.0; extra == 'all'
35
+ Provides-Extra: cli
36
+ Requires-Dist: rich>=13.7.0; extra == 'cli'
37
+ Provides-Extra: crypto
38
+ Requires-Dist: pynacl>=1.5.0; extra == 'crypto'
39
+ Provides-Extra: dev
40
+ Requires-Dist: mypy>=1.11.0; extra == 'dev'
41
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
42
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
43
+ Requires-Dist: pytest>=8.3.0; extra == 'dev'
44
+ Requires-Dist: ruff>=0.6.0; extra == 'dev'
45
+ Provides-Extra: encrypted
46
+ Requires-Dist: cryptography>=43.0.0; extra == 'encrypted'
47
+ Requires-Dist: keyring>=25.0.0; extra == 'encrypted'
48
+ Description-Content-Type: text/markdown
49
+
50
+ # HosteDay Python SDK (`hosteday_python`)
51
+
52
+ [![PyPI version](https://img.shields.io/pypi/v/hosteday_python.svg)](https://pypi.org/project/hosteday_python/)
53
+ [![Python Versions](https://img.shields.io/pypi/pyversions/hosteday_python.svg)](https://pypi.org/project/hosteday_python/)
54
+ [![License: MIT](https://img.shields.io/badge/License-MIT-10B981.svg)](https://opensource.org/licenses/MIT)
55
+
56
+ Official asynchronous Python SDK for **HosteDay** — isolated cloud backends with standard REST CRUD, authentication, Laravel Reverb / Pusher v7 realtime WebSockets, push notifications, background jobs, and an embedded BFF web server.
57
+
58
+ Designed for 100% architectural and wire-protocol parity with **`hosteday_flutter`** and **`hosteday_kotlin`**.
59
+
60
+ ---
61
+
62
+ ## Installation
63
+
64
+ ```bash
65
+ pip install hosteday_python
66
+ ```
67
+
68
+ Optional extras:
69
+
70
+ ```bash
71
+ # Encrypted private channels (PyNaCl)
72
+ pip install "hosteday_python[crypto]"
73
+
74
+ # OS keyring session persistence
75
+ pip install "hosteday_python[encrypted]"
76
+
77
+ # Rich CLI output
78
+ pip install "hosteday_python[cli]"
79
+
80
+ # Everything
81
+ pip install "hosteday_python[all]"
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Zero-Config Setup CLI
87
+
88
+ Generate `hosteday_config.json` (or `.env`) directly from your HosteDay dashboard setup token:
89
+
90
+ ```bash
91
+ hosteday-setup --project my-app --token "<setup_token>" --output hosteday_config.json
92
+ # Or generate a .env file:
93
+ hosteday-setup --project my-app --token "<setup_token>" --format env --output .env
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Quickstart
99
+
100
+ You can import from either `hosteday` or `hosteday_python`:
101
+
102
+ ```python
103
+ import asyncio
104
+ from pathlib import Path
105
+ from hosteday import Hosteday, JsonFileHostedayAuthStorage
106
+
107
+
108
+ async def main() -> None:
109
+ await Hosteday.initialize_app(
110
+ config_path=Path("hosteday_config.json"),
111
+ auth_storage=JsonFileHostedayAuthStorage(Path(".hosteday_session.json")),
112
+ )
113
+ try:
114
+ # 1. Authentication
115
+ cred = await Hosteday.auth.sign_in_with_email_and_password(
116
+ email="dev@hosteday.com",
117
+ password="StrongPassword!123",
118
+ )
119
+ print("Signed in:", cred.user.display_name)
120
+
121
+ # 2. Standard CRUD (index, show, create, update, delete)
122
+ # No `/api/` prefix needed — Hosteday resolves `/api` automatically.
123
+ page = await Hosteday.client.index(
124
+ "notes",
125
+ page=1,
126
+ per_page=15,
127
+ search="launch",
128
+ with_auth=True,
129
+ )
130
+ first = await Hosteday.client.show("notes", id=page.items[0]["id"], with_auth=True)
131
+ created = await Hosteday.client.create("notes", body={"data": "Shipped v0.1.0!"})
132
+ updated = await Hosteday.client.update("notes", id=created["id"], body={"data": "Updated!"})
133
+ await Hosteday.client.delete("notes", id=updated["id"])
134
+
135
+ # 3. Realtime WebSockets (Laravel Reverb / Pusher v7)
136
+ await Hosteday.realtime.listen_public(
137
+ channel="announcements",
138
+ event="NotificationReceived",
139
+ on_event=lambda e: print(e.name, e.payload),
140
+ )
141
+
142
+ # 4. Push Notifications
143
+ await Hosteday.notifications.sync_device_token(
144
+ token="<fcm_device_token>",
145
+ device_type="web",
146
+ device_name="Chrome Desktop",
147
+ )
148
+
149
+ # 5. Background Jobs
150
+ job = await Hosteday.jobs.dispatch(name="GenerateReport", payload={"report_id": 1})
151
+ print("Job ID:", job.job_id, "Status:", job["status"])
152
+ finally:
153
+ await Hosteday.dispose()
154
+
155
+
156
+ asyncio.run(main())
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Embedded Web App & BFF Server (`HostedayWebApp`)
162
+
163
+ Build and serve a full SPA + BFF web application with built-in auth, realtime channel authorization, device token sync, and one-line CRUD endpoints — without writing any web-framework boilerplate:
164
+
165
+ ```python
166
+ from pathlib import Path
167
+ from hosteday import Hosteday
168
+
169
+ web = Hosteday.create_web_app(
170
+ title="My HosteDay App",
171
+ config_path=Path("hosteday_config.json"),
172
+ static_dir=Path("static"),
173
+ )
174
+
175
+ # Register GET/POST/PUT/DELETE /bff/notes in one line:
176
+ web.crud("notes", owner_field="user_id")
177
+
178
+ # Or add custom routes cleanly:
179
+ @web.get("health")
180
+ async def health() -> dict[str, bool]:
181
+ return {"ok": True}
182
+
183
+ if __name__ == "__main__":
184
+ web.serve(host="127.0.0.1", port=8000)
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Development & Verification
190
+
191
+ ```bash
192
+ pip install -e ".[dev]"
193
+ ruff check src tests examples
194
+ mypy src
195
+ pytest -v
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Official Links
201
+
202
+ - **SDK Portal:** <https://hosteday.com/sdks/hosteday-python>
203
+ - **Documentation:** <https://hosteday.com/docs/hosteday-python>
204
+ - **PyPI:** <https://pypi.org/project/hosteday_python/>
205
+ - **Source & Issues:** <https://github.com/mustafa3max/hosteday-python>
@@ -0,0 +1,50 @@
1
+ hosteday/__init__.py,sha256=Uo0yyicbIePFq_frDAjTCezQj61wZAPt1yuoBUilUnY,2989
2
+ hosteday/_version.py,sha256=ZhIVT5V-bPB1OQ2FrPFC1iaDNSlErtORrtdX5ALflKk,84
3
+ hosteday/exceptions.py,sha256=0Rq4BuXqPJUcSt5gVSyJ4X5UmJEX0u-RD9kjHghVR0g,7767
4
+ hosteday/hosteday.py,sha256=42kndBEobXc-rU94FJHwZcvg23JQnyrMVbeQ_vnhypM,11772
5
+ hosteday/hosteday_client.py,sha256=KiJpKcvIoi1mCj_cqp_72QefpiltW5tMHMmCZ-0_Xog,20138
6
+ hosteday/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
7
+ hosteday/auth/__init__.py,sha256=kKvh-UVWyHsgepfi2kCJbXoSmLoJdc50Req-d30TNJg,1050
8
+ hosteday/auth/hosteday_auth.py,sha256=mt2s_HCWJHxwG8iNyWfb2MgFvvZZ4HlZPgbarZC9R7c,16908
9
+ hosteday/auth/hosteday_auth_storage.py,sha256=qFbFxb3XycmXAVpC_YZdkOSn2Sz6TvCGFRu9atG7hco,4268
10
+ hosteday/auth/hosteday_session.py,sha256=82gqzjx6NbCXLtRD-YW2AHXx1HOSHiT5FQo8i5SKC6Y,6533
11
+ hosteday/auth/hosteday_token_provider.py,sha256=tnx_-mq3FJixhdRVgmbmBHXisVGo79ukNBMm0670LkY,2512
12
+ hosteday/auth/hosteday_user.py,sha256=4XT0xbaOEkcXHPyPM1_d9wV1tdiVOfwXsznXv14rwOA,7282
13
+ hosteday/cli/__init__.py,sha256=csntWKYfWkXH-FQyUq6qK36q3H9-GnremMy8NQHY04Y,208
14
+ hosteday/cli/setup.py,sha256=G36DimZi4K6Jlb8BBmE4RefBGVGUD2yzMQzttEKmRYY,5171
15
+ hosteday/config/__init__.py,sha256=92_Kuc0tQQp9HNHv7ePUpKJiaDyC1ZGtwLkEOok7gDk,420
16
+ hosteday/config/hosteday_config.py,sha256=u4J9veU76qXEBnr9ZYOh6rh6XsH09w0gwCQUwpmPIQ8,21604
17
+ hosteday/config/hosteday_option_keys.py,sha256=uiht7vSwSWb1FX7564mdw7KegGbw2zXuHXz_FMDnp9I,2398
18
+ hosteday/config/hosteday_url_resolver.py,sha256=ESF22lMWovNjVZy5u--k3qpjYe0vF-tgCj7pQQiCqHk,8836
19
+ hosteday/connectivity/__init__.py,sha256=MxxedNdC2jYkUCGzCAZFg-KQpgleMmjsLacBRmsVPXU,170
20
+ hosteday/connectivity/hosteday_connectivity.py,sha256=9G_FHDj_XNLUr4LyZiir-ylujOHaVyfbsuoxGJF5fXs,5342
21
+ hosteday/features/__init__.py,sha256=AAbFSZvWCm93Ob-tzn7DIQ2F30lSyLqngOQ2r49ajoA,141
22
+ hosteday/features/hosteday_features.py,sha256=RBNZRpgO9LQ1eI3znYne1Tz1m0IN824Dr6Sq_Sz3MVA,2768
23
+ hosteday/http/__init__.py,sha256=iBi5VD5U1SFtQK9qUWwVQyN1LlFVC-O297p8ODHbxIo,486
24
+ hosteday/http/hosteday_http_client.py,sha256=QsBR5HjXsYQ3RcSPPda_OYEDahW0Lt_nA5ffmeP9xPY,11468
25
+ hosteday/http/hosteday_response_reader.py,sha256=3E2T-Dnb6H-relQU1SOuVLNN5wlUPqtwiV9U5oRF1tQ,6690
26
+ hosteday/http/query_builder.py,sha256=jmpfZXA_lCyf7EgdIKIyG5pN5Aq-_wDesSCC6fP-uvM,7665
27
+ hosteday/jobs/__init__.py,sha256=W-E0bJIsDTg9PAcDdql9_z_Z_nuVq3qvYswQ4UfwmXs,252
28
+ hosteday/jobs/hosteday_job_response.py,sha256=DlZ7AiKiDXcld_GDdLCF9JeeFgSBvy9zRFTUN8sJxZI,2520
29
+ hosteday/jobs/hosteday_jobs_client.py,sha256=JVCE_nfW_Suo_4al1hnZnVCb4Vak2VO-pi8X3K7dL-o,3396
30
+ hosteday/notifications/__init__.py,sha256=PsRqNGffQjRZRhtetAeeQKJjP9_QeISoOfs_bbpaDqE,352
31
+ hosteday/notifications/hosteday_notification_client.py,sha256=-s3oio0Cp6dw_sCRmCTz_1Q6UtSQ_yzuDSQxf3PCTY8,10177
32
+ hosteday/notifications/hosteday_notification_response.py,sha256=7IoQMdp_ZE7-El7rG3AXGckgA7V8BnWOagkAoq-86aM,2712
33
+ hosteday/reactive/__init__.py,sha256=Su5BusYNMciOySoDygI7231XdQKo1bORQ6RBg0Wz0hI,149
34
+ hosteday/reactive/observable_state.py,sha256=iUUAtTOB1jYU3SgULz7HUJIB1-EzIEHUdmJbCrQQhvM,2166
35
+ hosteday/realtime/__init__.py,sha256=BPNVbDaJWZbVFZyrrIhKWvtq9hvxzcVKlKVer3wpIMs,951
36
+ hosteday/realtime/connection_state.py,sha256=b-1_S59AWPAzBau5Fp4f2J1MwYdrL8Qu7Ff_J7ZixWc,385
37
+ hosteday/realtime/hosteday_channel.py,sha256=jQdMRWhzin5Vh51CfhMgg8FwH-BpLVDWmsckfSKOPc8,9628
38
+ hosteday/realtime/hosteday_channel_auth.py,sha256=zpW-4r901gc-elug69pzWhlUjhtp20qm9GklrS_gCRo,5985
39
+ hosteday/realtime/hosteday_channel_type.py,sha256=TKmXd5rD-RUObNbeU1zGFTP-oS89I_h4pYBcu3mnS9o,2675
40
+ hosteday/realtime/hosteday_realtime_client.py,sha256=8UHsYHrONUOIxAFdTCU04Gy0KMyugLIXaGAKgVzwnCI,29138
41
+ hosteday/realtime/hosteday_realtime_event.py,sha256=SW2dNGVkqbxAChTPFeIFZAdBstRazX0_m9L0ZD5X4nc,3240
42
+ hosteday/web/__init__.py,sha256=P6C97BJ2QCKzbfXdXmWyAF0rz49v_9USm-AzDWv6s4w,203
43
+ hosteday/web/server.py,sha256=FHqC0LvZn8cIobPm5bZHGOjUiE2miA0G9B3TIsalkVk,25881
44
+ hosteday_python/__init__.py,sha256=jHAlVYgO3YGO0Qb26-r6hntA8ICXyE6KUKRj4Z5Ue1k,208
45
+ hosteday_python/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
46
+ hosteday_python-0.1.0.dist-info/METADATA,sha256=OO6KsoJJ_kIry90uJrY4iZYB7DNUMoxwlpdigKRvDu4,6806
47
+ hosteday_python-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
48
+ hosteday_python-0.1.0.dist-info/entry_points.txt,sha256=iJvsqkkk6XFvTwP4GLahYX0Fcwb1Bqpih2EaUaU5ziA,59
49
+ hosteday_python-0.1.0.dist-info/licenses/LICENSE,sha256=zU6kBZXsw3hZ0lZfVMvLVAZVxMBRvvQVIQMP_g2iago,1065
50
+ hosteday_python-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ hosteday-setup = hosteday.cli.setup:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 HosteDay
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.