neutralino-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.
- neutralino/__init__.py +88 -0
- neutralino/_catalog.py +297 -0
- neutralino/_data/LICENSE.neutralino-js-client +21 -0
- neutralino/_data/LICENSE.neutralinojs +1066 -0
- neutralino/_data/docs/cli.md +315 -0
- neutralino/_data/docs/custom-components.md +107 -0
- neutralino/_data/docs/custom-frontends.md +80 -0
- neutralino/_data/docs/desktop-helpers.md +296 -0
- neutralino/_data/docs/guide.md +131 -0
- neutralino/_data/docs/llms-full.txt +3921 -0
- neutralino/_data/docs/llms.txt +43 -0
- neutralino/_data/docs/manifests/components.json +20128 -0
- neutralino/_data/docs/manifests/examples.json +52 -0
- neutralino/_data/docs/manifests/native.json +3024 -0
- neutralino/_data/docs/manifests/schema.json +43 -0
- neutralino/_data/docs/manual-checklist.md +189 -0
- neutralino/_data/docs/packaging.md +252 -0
- neutralino/_data/docs/performance.md +15 -0
- neutralino/_data/docs/platforms.md +15 -0
- neutralino/_data/docs/reference/components.md +1685 -0
- neutralino/_data/docs/reference/native.md +148 -0
- neutralino/_data/docs/security.md +60 -0
- neutralino/_data/docs/ui.md +249 -0
- neutralino/_data/docs/updates.md +366 -0
- neutralino/_data/examples/README.md +6 -0
- neutralino/_data/examples/crud/README.md +36 -0
- neutralino/_data/examples/crud/app.py +243 -0
- neutralino/_data/examples/dashboard/README.md +36 -0
- neutralino/_data/examples/dashboard/app.py +367 -0
- neutralino/_data/examples/editor/README.md +35 -0
- neutralino/_data/examples/editor/app.py +190 -0
- neutralino/_data/examples/file-manager/README.md +40 -0
- neutralino/_data/examples/file-manager/app.py +120 -0
- neutralino/_data/examples/file-manager/frontend/index.html +20 -0
- neutralino/_data/examples/file-manager/frontend/main.js +55 -0
- neutralino/_data/examples/file-manager/frontend/neutralino.js +1 -0
- neutralino/_data/examples/file-manager/frontend/python-bridge.d.ts +207 -0
- neutralino/_data/examples/file-manager/frontend/python-bridge.mjs +854 -0
- neutralino/_data/examples/file-manager/frontend/style.css +4 -0
- neutralino/_data/examples/hybrid/README.md +48 -0
- neutralino/_data/examples/hybrid/app.py +80 -0
- neutralino/_data/examples/hybrid/components/counter.mjs +37 -0
- neutralino/_data/examples/hybrid/components/widget.mjs +23 -0
- neutralino/_data/examples/hybrid/styles.css +21 -0
- neutralino/_data/examples/hybrid/widget/package.json +20 -0
- neutralino/_data/examples/hybrid/widget/src/Widget.jsx +25 -0
- neutralino/_data/examples/hybrid/widget/vite.config.mjs +19 -0
- neutralino/_data/examples/monitor/README.md +36 -0
- neutralino/_data/examples/monitor/app.py +375 -0
- neutralino/_data/examples/react/README.md +90 -0
- neutralino/_data/examples/react/app.py +68 -0
- neutralino/_data/examples/react/frontend/.gitignore +5 -0
- neutralino/_data/examples/react/frontend/index.html +17 -0
- neutralino/_data/examples/react/frontend/package-lock.json +1232 -0
- neutralino/_data/examples/react/frontend/package.json +25 -0
- neutralino/_data/examples/react/frontend/scripts/prepare-bridge.mjs +49 -0
- neutralino/_data/examples/react/frontend/src/App.tsx +157 -0
- neutralino/_data/examples/react/frontend/src/backend.ts +21 -0
- neutralino/_data/examples/react/frontend/src/calls.test.ts +206 -0
- neutralino/_data/examples/react/frontend/src/calls.ts +306 -0
- neutralino/_data/examples/react/frontend/src/globals.d.ts +14 -0
- neutralino/_data/examples/react/frontend/src/hooks.ts +45 -0
- neutralino/_data/examples/react/frontend/src/main.tsx +13 -0
- neutralino/_data/examples/react/frontend/src/styles.css +11 -0
- neutralino/_data/examples/react/frontend/tsconfig.json +18 -0
- neutralino/_data/examples/react/frontend/vite.config.ts +9 -0
- neutralino/_data/examples/settings/README.md +38 -0
- neutralino/_data/examples/settings/app.py +440 -0
- neutralino/_data/examples/updater/.gitignore +2 -0
- neutralino/_data/examples/updater/README.md +82 -0
- neutralino/_data/examples/updater/app.py +160 -0
- neutralino/_data/examples/updater/app.toml +21 -0
- neutralino/_data/examples/updater/demo.py +107 -0
- neutralino/_data/examples/updater/requirements.txt +2 -0
- neutralino/_data/examples/updater/sources/github-private.toml +21 -0
- neutralino/_data/examples/updater/sources/github-public.toml +21 -0
- neutralino/_data/examples/vanilla/README.md +35 -0
- neutralino/_data/examples/vanilla/app.py +46 -0
- neutralino/_data/examples/vanilla/frontend/index.html +17 -0
- neutralino/_data/examples/vanilla/frontend/main.js +29 -0
- neutralino/_data/examples/vanilla/frontend/neutralino.js +1 -0
- neutralino/_data/examples/vanilla/frontend/python-bridge.d.ts +207 -0
- neutralino/_data/examples/vanilla/frontend/python-bridge.mjs +854 -0
- neutralino/_data/examples/vanilla/frontend/style.css +4 -0
- neutralino/_data/explorer/app.py +1328 -0
- neutralino/_data/explorer/catalogue.json +48179 -0
- neutralino/_data/explorer/explorer_previews.py +247 -0
- neutralino/_data/explorer/sources/native/always_on_top.py +55 -0
- neutralino/_data/explorer/sources/native/binary.py +125 -0
- neutralino/_data/explorer/sources/native/borderless.py +99 -0
- neutralino/_data/explorer/sources/native/broadcast.py +90 -0
- neutralino/_data/explorer/sources/native/config.py +78 -0
- neutralino/_data/explorer/sources/native/controls.py +140 -0
- neutralino/_data/explorer/sources/native/directory.py +163 -0
- neutralino/_data/explorer/sources/native/displays.py +75 -0
- neutralino/_data/explorer/sources/native/env.py +98 -0
- neutralino/_data/explorer/sources/native/events.py +124 -0
- neutralino/_data/explorer/sources/native/exec_command.py +79 -0
- neutralino/_data/explorer/sources/native/folder.py +70 -0
- neutralino/_data/explorer/sources/native/icon_badge.py +101 -0
- neutralino/_data/explorer/sources/native/image.py +119 -0
- neutralino/_data/explorer/sources/native/lifecycle.py +99 -0
- neutralino/_data/explorer/sources/native/locale.py +70 -0
- neutralino/_data/explorer/sources/native/main_menu.py +103 -0
- neutralino/_data/explorer/sources/native/message_box.py +101 -0
- neutralino/_data/explorer/sources/native/mouse.py +70 -0
- neutralino/_data/explorer/sources/native/multi_window.py +134 -0
- neutralino/_data/explorer/sources/native/notification.py +74 -0
- neutralino/_data/explorer/sources/native/open_external.py +81 -0
- neutralino/_data/explorer/sources/native/open_file.py +102 -0
- neutralino/_data/explorer/sources/native/paths.py +77 -0
- neutralino/_data/explorer/sources/native/print_snapshot.py +84 -0
- neutralino/_data/explorer/sources/native/read_write.py +192 -0
- neutralino/_data/explorer/sources/native/resources.py +110 -0
- neutralino/_data/explorer/sources/native/save_file.py +101 -0
- neutralino/_data/explorer/sources/native/server_mount.py +106 -0
- neutralino/_data/explorer/sources/native/sound.py +84 -0
- neutralino/_data/explorer/sources/native/spawn_process.py +128 -0
- neutralino/_data/explorer/sources/native/states.py +122 -0
- neutralino/_data/explorer/sources/native/stats_permissions.py +147 -0
- neutralino/_data/explorer/sources/native/storage.py +108 -0
- neutralino/_data/explorer/sources/native/system_info.py +115 -0
- neutralino/_data/explorer/sources/native/text.py +133 -0
- neutralino/_data/explorer/sources/native/trash.py +98 -0
- neutralino/_data/explorer/sources/native/tray.py +109 -0
- neutralino/_data/explorer/sources/native/watcher.py +167 -0
- neutralino/_data/explorer/sources/patterns/content_blocks.py +119 -0
- neutralino/_data/explorer/sources/patterns/dynamic_dashboard.py +121 -0
- neutralino/_data/explorer/sources/patterns/dynamic_form.py +120 -0
- neutralino/_data/explorer/sources/patterns/dynamic_table.py +109 -0
- neutralino/_data/explorer/sources/patterns/error_reporting.mjs +24 -0
- neutralino/_data/explorer/sources/patterns/error_reporting.py +124 -0
- neutralino/_data/explorer/sources/patterns/errors_timeouts.py +108 -0
- neutralino/_data/explorer/sources/patterns/feature_flags.py +99 -0
- neutralino/_data/explorer/sources/patterns/file_drop.py +126 -0
- neutralino/_data/explorer/sources/patterns/http_from_python.py +152 -0
- neutralino/_data/explorer/sources/patterns/keyboard_shortcuts.py +153 -0
- neutralino/_data/explorer/sources/patterns/live_config_reload.py +160 -0
- neutralino/_data/explorer/sources/patterns/logging.py +184 -0
- neutralino/_data/explorer/sources/patterns/long_tasks.py +121 -0
- neutralino/_data/explorer/sources/patterns/multi_window_sync.py +68 -0
- neutralino/_data/explorer/sources/patterns/navigation_from_backend.py +109 -0
- neutralino/_data/explorer/sources/patterns/onboarding.py +123 -0
- neutralino/_data/explorer/sources/patterns/optimistic_updates.py +89 -0
- neutralino/_data/explorer/sources/patterns/persistence.py +114 -0
- neutralino/_data/explorer/sources/patterns/python_calls_page.mjs +10 -0
- neutralino/_data/explorer/sources/patterns/python_calls_page.py +64 -0
- neutralino/_data/explorer/sources/patterns/python_push.py +84 -0
- neutralino/_data/explorer/sources/patterns/recurring_events.py +114 -0
- neutralino/_data/explorer/sources/patterns/roles_permissions.py +104 -0
- neutralino/_data/explorer/sources/patterns/scheduled_jobs.py +194 -0
- neutralino/_data/explorer/sources/patterns/settings_page.py +165 -0
- neutralino/_data/explorer/sources/patterns/sqlite.py +181 -0
- neutralino/_data/explorer/sources/patterns/streaming.py +102 -0
- neutralino/_data/explorer/sources/patterns/texts_i18n.py +81 -0
- neutralino/_data/explorer/sources/patterns/theme_from_backend.py +86 -0
- neutralino/_data/explorer/sources/patterns/updater.py +232 -0
- neutralino/_data/explorer/sources/workspace/calendar/app.py +547 -0
- neutralino/_data/explorer/sources/workspace/customers/app.py +467 -0
- neutralino/_data/explorer/sources/workspace/dashboard/README.md +36 -0
- neutralino/_data/explorer/sources/workspace/dashboard/app.py +367 -0
- neutralino/_data/explorer/sources/workspace/documents/app.py +511 -0
- neutralino/_data/explorer/sources/workspace/inbox/app.py +439 -0
- neutralino/_data/explorer/sources/workspace/orders/app.py +491 -0
- neutralino/_data/explorer/sources/workspace/reports/app.py +386 -0
- neutralino/_data/explorer/sources/workspace/settings/README.md +38 -0
- neutralino/_data/explorer/sources/workspace/settings/app.py +440 -0
- neutralino/_data/explorer/sources/workspace/system/README.md +36 -0
- neutralino/_data/explorer/sources/workspace/system/app.py +375 -0
- neutralino/_data/explorer/sources/workspace/tasks/app.py +462 -0
- neutralino/_data/renderer/LICENSES/@babel__runtime@7.29.17/LICENSE +22 -0
- neutralino/_data/renderer/LICENSES/@codemirror__autocomplete@6.20.4/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__commands@6.11.2/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-css@6.3.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-html@6.4.12/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-javascript@6.2.5/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-json@6.0.2/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-markdown@6.5.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-python@6.2.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-sql@6.10.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-yaml@6.1.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__language@6.13.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__search@6.7.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__state@6.7.6/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__view@6.44.2/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@dnd-kit__accessibility@3.1.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@dnd-kit__core@6.3.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@dnd-kit__sortable@10.0.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@dnd-kit__utilities@3.2.2/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@emoji-mart__data@1.2.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@floating-ui__core@1.8.0/LICENSE +20 -0
- neutralino/_data/renderer/LICENSES/@floating-ui__dom@1.8.0/LICENSE +20 -0
- neutralino/_data/renderer/LICENSES/@floating-ui__react-dom@2.1.9/LICENSE +20 -0
- neutralino/_data/renderer/LICENSES/@floating-ui__react@0.27.20/LICENSE +20 -0
- neutralino/_data/renderer/LICENSES/@floating-ui__utils@0.2.12/LICENSE +20 -0
- neutralino/_data/renderer/LICENSES/@lezer__common@1.5.7/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__css@1.3.9/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__highlight@1.2.5/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__html@1.3.13/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__javascript@1.5.7/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__json@1.0.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__lr@1.4.13/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__markdown@1.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__python@1.1.21/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__yaml@1.0.4/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__carousel@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__charts@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__code-highlight@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__core@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__dates@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__dropzone@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__emoji@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__hooks@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__lightbox@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__notifications@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__nprogress@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__schedule@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__spotlight@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__store@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__tiptap@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@marijn__find-cluster-break@1.0.4/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@reduxjs__toolkit@2.16.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@tabler__icons-react@3.55.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@tanstack__react-virtual@3.14.32/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@tanstack__virtual-core@3.19.17/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__core@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-blockquote@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-bold@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-code-block@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-code@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-document@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-hard-break@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-heading@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-horizontal-rule@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-italic@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-link@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-list@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-paragraph@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-strike@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-text@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-underline@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extensions@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__react@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__starter-kit@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/attr-accept@4.0.1/LICENSE +22 -0
- neutralino/_data/renderer/LICENSES/clsx@2.1.1/license +9 -0
- neutralino/_data/renderer/LICENSES/crelt@1.0.7/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/d3-array@3.2.5/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-color@3.1.1/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-format@3.1.3/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-interpolate@3.0.2/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-path@3.1.1/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-scale@4.0.3/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-shape@3.2.1/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-time-format@4.1.1/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-time@3.1.1/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/dayjs@1.11.23/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/decimal.js-light@2.5.1/LICENCE.md +23 -0
- neutralino/_data/renderer/LICENSES/diff@9.0.0/LICENSE +29 -0
- neutralino/_data/renderer/LICENSES/dompurify@3.5.1/LICENSE +202 -0
- neutralino/_data/renderer/LICENSES/dompurify@3.5.1/LICENSE-MPL +373 -0
- neutralino/_data/renderer/LICENSES/embla-carousel-react@8.6.0/MIT-embla-carousel.txt +21 -0
- neutralino/_data/renderer/LICENSES/embla-carousel-reactive-utils@8.6.0/MIT-embla-carousel.txt +21 -0
- neutralino/_data/renderer/LICENSES/embla-carousel@8.6.0/MIT-embla-carousel.txt +21 -0
- neutralino/_data/renderer/LICENSES/es-toolkit@1.53.2/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/es-toolkit@1.53.2/NOTICE +39 -0
- neutralino/_data/renderer/LICENSES/eventemitter3@5.0.4/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/fast-equals@5.4.7/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/file-selector@5.0.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/get-nonce@1.0.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/immer@11.2.14/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/linkifyjs@4.4.0/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/marked@18.4.0/LICENSE +44 -0
- neutralino/_data/renderer/LICENSES/neutralino.js@6.11.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/orderedmap@2.1.1/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/packages.json +1838 -0
- neutralino/_data/renderer/LICENSES/prosemirror-commands@1.7.2/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-dropcursor@1.8.4/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-gapcursor@1.4.1/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-history@1.5.2/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-keymap@1.2.3/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-model@1.25.13/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-schema-list@1.6.1/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-state@1.4.4/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-transform@1.12.7/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-view@1.44.0/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/react-dom@19.3.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/react-dropzone@20.1.4/LICENSE +22 -0
- neutralino/_data/renderer/LICENSES/react-is@19.3.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/react-number-format@5.4.5/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/react-redux@9.3.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/react-remove-scroll-bar@2.3.8/MIT-react-remove-scroll-bar.txt +21 -0
- neutralino/_data/renderer/LICENSES/react-remove-scroll@2.7.2/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/react-style-singleton@2.2.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/react-transition-group@4.4.5/LICENSE +30 -0
- neutralino/_data/renderer/LICENSES/react@19.3.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/recharts@3.11.3/LICENSE +22 -0
- neutralino/_data/renderer/LICENSES/redux-thunk@3.1.0/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/redux@5.0.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/reselect@5.2.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/rolldown@1.3.4/LICENSE +25 -0
- neutralino/_data/renderer/LICENSES/rope-sequence@1.3.4/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/rrule@2.8.1/LICENCE +65 -0
- neutralino/_data/renderer/LICENSES/scheduler@0.28.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/style-mod@4.1.5/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/tiny-invariant@1.3.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/tslib@2.9.1/LICENSE.txt +12 -0
- neutralino/_data/renderer/LICENSES/use-callback-ref@1.3.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/use-sidecar@1.1.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/use-sync-external-store@1.7.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/victory-vendor@38.1.1/LICENSE.txt +150 -0
- neutralino/_data/renderer/LICENSES/vite@8.4.1/LICENSE.md +2320 -0
- neutralino/_data/renderer/LICENSES/w3c-keyname@2.2.8/LICENSE +19 -0
- neutralino/_data/renderer/assets/IconGripVertical-BlJrWVuo.js +1 -0
- neutralino/_data/renderer/assets/carousel-D1j1SkWR.css +1 -0
- neutralino/_data/renderer/assets/carousel-DniHwTLK.js +1 -0
- neutralino/_data/renderer/assets/chunk-CCkLOSkX.css +1 -0
- neutralino/_data/renderer/assets/chunk-Du0h7lB-.js +9 -0
- neutralino/_data/renderer/assets/codehighlight-CCe_blv1.js +10 -0
- neutralino/_data/renderer/assets/codehighlight-THJMNDh8.css +1 -0
- neutralino/_data/renderer/assets/codemirror-CinrNxVJ.js +2 -0
- neutralino/_data/renderer/assets/css-CMUk25uq.js +1 -0
- neutralino/_data/renderer/assets/dist-70Le0T2N.js +1 -0
- neutralino/_data/renderer/assets/dist-BCHbQlae.js +11 -0
- neutralino/_data/renderer/assets/dist-BXts23GT.js +1 -0
- neutralino/_data/renderer/assets/dist-D2RX2UgP.js +23 -0
- neutralino/_data/renderer/assets/dist-DikJK2lp.js +1 -0
- neutralino/_data/renderer/assets/dist-acbbRM1z.js +1 -0
- neutralino/_data/renderer/assets/dnd-DaaaVala.js +5 -0
- neutralino/_data/renderer/assets/dropzone-CeqF5SZx.js +1 -0
- neutralino/_data/renderer/assets/dropzone-aPCBPjDN.css +1 -0
- neutralino/_data/renderer/assets/embla-carousel-react.esm-CbyYjwMN.js +1 -0
- neutralino/_data/renderer/assets/emoji-BfRPfoVw.js +1 -0
- neutralino/_data/renderer/assets/emoji-DV8OzU1E.css +1 -0
- neutralino/_data/renderer/assets/esm-C5ZYjSBQ.js +82 -0
- neutralino/_data/renderer/assets/highlight-CB6hGb5A.js +3 -0
- neutralino/_data/renderer/assets/highlight-Dlb5DJwL.css +1 -0
- neutralino/_data/renderer/assets/html-Dad3kwIa.js +1 -0
- neutralino/_data/renderer/assets/icon-chunk-X3Kr0nh-.js +1 -0
- neutralino/_data/renderer/assets/index-CU0HB-J7.js +69 -0
- neutralino/_data/renderer/assets/index-TWpF4Lef.css +1 -0
- neutralino/_data/renderer/assets/javascript-BQb8vpw3.js +1 -0
- neutralino/_data/renderer/assets/json-BCFmxlML.js +1 -0
- neutralino/_data/renderer/assets/lightbox-BHtgbsUV.js +1 -0
- neutralino/_data/renderer/assets/lightbox-BzKDpkAD.css +1 -0
- neutralino/_data/renderer/assets/markdown-DSuAylvy.js +5 -0
- neutralino/_data/renderer/assets/markdown-DjaNWMgH.js +77 -0
- neutralino/_data/renderer/assets/python-pdbIAveZ.js +9 -0
- neutralino/_data/renderer/assets/richtext-DIAsHMuK.css +1 -0
- neutralino/_data/renderer/assets/richtext-Z6fG9G2_.js +137 -0
- neutralino/_data/renderer/assets/spotlight-Ccstaz1-.css +1 -0
- neutralino/_data/renderer/assets/spotlight-knlyJw_A.js +1 -0
- neutralino/_data/renderer/assets/sql-DLoQFEde.js +2 -0
- neutralino/_data/renderer/assets/with-selector-BOM9_OlN.js +1 -0
- neutralino/_data/renderer/assets/yaml-BJNzokSe.js +1 -0
- neutralino/_data/renderer/index.html +22 -0
- neutralino/_data/renderer/manifest.json +202 -0
- neutralino/_data/renderer/neutralino.js +1 -0
- neutralino/_data/renderer/shared/mantine-core.mjs +5 -0
- neutralino/_data/renderer/shared/mantine-hooks.mjs +5 -0
- neutralino/_data/renderer/shared/react-dom-client.mjs +5 -0
- neutralino/_data/renderer/shared/react-dom.mjs +6 -0
- neutralino/_data/renderer/shared/react-jsx-runtime.mjs +5 -0
- neutralino/_data/renderer/shared/react.mjs +6 -0
- neutralino/_data/skills/README.md +6 -0
- neutralino/_data/skills/neutralino-app-patterns/SKILL.md +101 -0
- neutralino/_data/skills/neutralino-app-patterns/references/dashboards-and-background-work.md +55 -0
- neutralino/_data/skills/neutralino-app-patterns/references/storage-and-settings.md +57 -0
- neutralino/_data/skills/neutralino-app-patterns/references/tables-and-crud.md +81 -0
- neutralino/_data/skills/neutralino-frontend/SKILL.md +121 -0
- neutralino/_data/skills/neutralino-frontend/references/bridge.md +63 -0
- neutralino/_data/skills/neutralino-frontend/references/custom-components.md +84 -0
- neutralino/_data/skills/neutralino-frontend/references/frameworks.md +61 -0
- neutralino/_data/skills/neutralino-maintenance/SKILL.md +85 -0
- neutralino/_data/skills/neutralino-maintenance/references/platforms-and-gates.md +35 -0
- neutralino/_data/skills/neutralino-maintenance/references/records.md +38 -0
- neutralino/_data/skills/neutralino-maintenance/references/review-process.md +36 -0
- neutralino/_data/skills/neutralino-native/SKILL.md +107 -0
- neutralino/_data/skills/neutralino-native/references/api-conventions.md +72 -0
- neutralino/_data/skills/neutralino-native/references/desktop-helpers.md +53 -0
- neutralino/_data/skills/neutralino-native/references/permissions-windows.md +53 -0
- neutralino/_data/skills/neutralino-packaging/SKILL.md +99 -0
- neutralino/_data/skills/neutralino-packaging/references/build-layout.md +51 -0
- neutralino/_data/skills/neutralino-packaging/references/managed-install.md +59 -0
- neutralino/_data/skills/neutralino-packaging/references/templates-and-config.md +63 -0
- neutralino/_data/skills/neutralino-python/SKILL.md +109 -0
- neutralino/_data/skills/neutralino-python/references/architecture.md +53 -0
- neutralino/_data/skills/neutralino-python/references/cli.md +60 -0
- neutralino/_data/skills/neutralino-python/references/platforms-security.md +44 -0
- neutralino/_data/skills/neutralino-rpc/SKILL.md +114 -0
- neutralino/_data/skills/neutralino-rpc/references/errors-and-limits.md +44 -0
- neutralino/_data/skills/neutralino-rpc/references/expose-and-context.md +74 -0
- neutralino/_data/skills/neutralino-rpc/references/streams-and-cancellation.md +53 -0
- neutralino/_data/skills/neutralino-ui/SKILL.md +115 -0
- neutralino/_data/skills/neutralino-ui/references/components-and-tree.md +74 -0
- neutralino/_data/skills/neutralino-ui/references/state-forms-events.md +85 -0
- neutralino/_data/skills/neutralino-ui/references/themes-profiles-assets.md +105 -0
- neutralino/_data/skills/neutralino-updates/SKILL.md +94 -0
- neutralino/_data/skills/neutralino-updates/references/config-and-api.md +80 -0
- neutralino/_data/skills/neutralino-updates/references/releases-and-install.md +77 -0
- neutralino/_data/skills/neutralino-updates/references/security-rollback.md +48 -0
- neutralino/_data/ui/contracts.json +32927 -0
- neutralino/_data/ui/emoji.json +1 -0
- neutralino/_data/upstream-lock.json +97 -0
- neutralino/_managed.py +1099 -0
- neutralino/_paths.py +220 -0
- neutralino/_platform.py +150 -0
- neutralino/_scaffold.py +344 -0
- neutralino/api/_base.py +99 -0
- neutralino/api/_custom.py +1350 -0
- neutralino/api/_dec.py +21 -0
- neutralino/api/_enc.py +80 -0
- neutralino/api/app.py +119 -0
- neutralino/api/clipboard.py +101 -0
- neutralino/api/computer.py +261 -0
- neutralino/api/custom.py +36 -0
- neutralino/api/debug.py +41 -0
- neutralino/api/extensions.py +57 -0
- neutralino/api/filesystem.py +633 -0
- neutralino/api/net.py +22 -0
- neutralino/api/os.py +508 -0
- neutralino/api/resources.py +124 -0
- neutralino/api/server.py +66 -0
- neutralino/api/storage.py +98 -0
- neutralino/api/types.py +342 -0
- neutralino/api/updater.py +22 -0
- neutralino/api/window.py +397 -0
- neutralino/application.py +1260 -0
- neutralino/bundle.py +187 -0
- neutralino/cli.py +629 -0
- neutralino/client.py +496 -0
- neutralino/config.py +671 -0
- neutralino/devtools.py +1973 -0
- neutralino/errors.py +142 -0
- neutralino/events.py +579 -0
- neutralino/execution.py +293 -0
- neutralino/extension.py +134 -0
- neutralino/frontend/python-bridge.d.ts +207 -0
- neutralino/frontend/python-bridge.mjs +854 -0
- neutralino/protocol.py +456 -0
- neutralino/py.typed +0 -0
- neutralino/rpc.py +1625 -0
- neutralino/runtime.py +591 -0
- neutralino/supervisor.py +866 -0
- neutralino/sync_client.py +376 -0
- neutralino/templates/default/app.py +32 -0
- neutralino/templates/default/frontend/app.js +28 -0
- neutralino/templates/default/frontend/index.html +26 -0
- neutralino/templates/default/frontend/neutralino.js +1 -0
- neutralino/templates/default/frontend/styles.css +8 -0
- neutralino/templates/default/gitignore.txt +3 -0
- neutralino/templates/default/neutralino.config.json +25 -0
- neutralino/templates/hybrid/README.md +17 -0
- neutralino/templates/hybrid/app.py +49 -0
- neutralino/templates/hybrid/components/counter.mjs +37 -0
- neutralino/templates/hybrid/styles.css +21 -0
- neutralino/templates/python-ui/README.md +15 -0
- neutralino/templates/python-ui/app.py +44 -0
- neutralino/templates/python-ui/gitignore.txt +3 -0
- neutralino/templates/python-ui/requirements.txt +4 -0
- neutralino/templates/react/README.md +28 -0
- neutralino/templates/react/app.py +52 -0
- neutralino/templates/react/components/widget.mjs +23 -0
- neutralino/templates/react/widget/package.json +20 -0
- neutralino/templates/react/widget/src/Widget.jsx +25 -0
- neutralino/templates/react/widget/vite.config.mjs +19 -0
- neutralino/transport.py +661 -0
- neutralino/types.py +93 -0
- neutralino/ui/__init__.py +139 -0
- neutralino/ui/_app.py +1529 -0
- neutralino/ui/_assets.py +407 -0
- neutralino/ui/_bases.py +1210 -0
- neutralino/ui/_behaviours.py +1066 -0
- neutralino/ui/_charts.py +732 -0
- neutralino/ui/_component.py +882 -0
- neutralino/ui/_dates.py +168 -0
- neutralino/ui/_desktop.py +879 -0
- neutralino/ui/_events.py +192 -0
- neutralino/ui/_filters.py +427 -0
- neutralino/ui/_forms.py +282 -0
- neutralino/ui/_protocol.py +201 -0
- neutralino/ui/_schedule.py +543 -0
- neutralino/ui/_security.py +106 -0
- neutralino/ui/_session.py +969 -0
- neutralino/ui/_state.py +199 -0
- neutralino/ui/_tables.py +256 -0
- neutralino/ui/_theme.py +154 -0
- neutralino/ui/blocks/__init__.py +19 -0
- neutralino/ui/blocks/_data.py +2239 -0
- neutralino/ui/blocks/_interactive.py +622 -0
- neutralino/ui/blocks/_layout.py +2967 -0
- neutralino/ui/components/__init__.py +81 -0
- neutralino/ui/components/_dates.py +879 -0
- neutralino/ui/components/_editors.py +217 -0
- neutralino/ui/components/_extensions.py +790 -0
- neutralino/ui/components/_extras.py +303 -0
- neutralino/ui/components/_generated.py +30565 -0
- neutralino/ui/components/_types.py +17 -0
- neutralino/ui/schema.py +824 -0
- neutralino/ui/validators.py +362 -0
- neutralino/updates/__init__.py +96 -0
- neutralino/updates/_http.py +320 -0
- neutralino/updates/_layout.py +762 -0
- neutralino/updates/archive.py +216 -0
- neutralino/updates/config.py +256 -0
- neutralino/updates/errors.py +97 -0
- neutralino/updates/install.sh.in +201 -0
- neutralino/updates/launcher.py +18 -0
- neutralino/updates/manager.py +808 -0
- neutralino/updates/manifest.py +196 -0
- neutralino/updates/release.py +314 -0
- neutralino/updates/semver.py +84 -0
- neutralino/updates/sources.py +392 -0
- neutralino/windows.py +316 -0
- neutralino_python-0.1.0.dist-info/METADATA +121 -0
- neutralino_python-0.1.0.dist-info/RECORD +521 -0
- neutralino_python-0.1.0.dist-info/WHEEL +4 -0
- neutralino_python-0.1.0.dist-info/entry_points.txt +3 -0
- neutralino_python-0.1.0.dist-info/licenses/LICENSE +21 -0
- neutralino_python-0.1.0.dist-info/licenses/THIRD_PARTY_NOTICES.md +16 -0
- neutralino_python-0.1.0.dist-info/licenses/src/neutralino/_data/renderer/LICENSES/packages.json +1838 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: neutralino-python
|
|
3
|
+
description: Entry point for neutralino-python, a Python SDK that drives the stock Neutralinojs runtime (pinned 6.11.0) and builds desktop apps with a Python UI or any web frontend. Use it first to install the package, choose a mode (Python UI, hybrid, own frontend, extension) and run the right CLI command; then move to the focused neutralino-* skills.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# neutralino-python
|
|
7
|
+
|
|
8
|
+
One package (`neutralino-python`, import name `neutralino`) with a CLI (`neutralino`).
|
|
9
|
+
Python launches the pinned official Neutralinojs runtime in a private instance
|
|
10
|
+
directory, connects to it as an extension and serves a window. Nothing is downloaded
|
|
11
|
+
on import and nothing is ever published by the CLI. Linux x86_64 is the tested
|
|
12
|
+
platform; Windows is secondary (test suite and a window smoke pass) and macOS is not
|
|
13
|
+
verified (see `references/platforms-security.md`).
|
|
14
|
+
|
|
15
|
+
## 1. Install and check
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
neutralino --version
|
|
19
|
+
neutralino runtime install # downloads and hash-checks the pinned runtime once
|
|
20
|
+
neutralino doctor # read-only checks: python, runtime, webview, display, renderer
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`neutralino runtime install --archive ZIP` or `--offline` never uses the network.
|
|
24
|
+
Linux needs the WebView libraries (`libwebkit2gtk-4.1-0`, a desktop session). Python 3.11+.
|
|
25
|
+
|
|
26
|
+
## 2. Choose a mode (decision rules)
|
|
27
|
+
|
|
28
|
+
| You want | Use | Skill |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| A desktop UI written only in Python, no Node | `neutralino.ui` (`--template python-ui`) | neutralino-ui |
|
|
31
|
+
| Python UI plus one custom control in JS or React | `--template hybrid` or `react` | neutralino-ui, neutralino-frontend |
|
|
32
|
+
| Your own HTML/JS/React/Vue/Svelte frontend calling Python | `neutralino.Application(resources=...)` + `python-bridge.mjs` | neutralino-frontend, neutralino-rpc |
|
|
33
|
+
| Python calling the native API (files, window, clipboard, ...) | `app.native.<namespace>` | neutralino-native |
|
|
34
|
+
| The runtime starts your Python program | `neutralino.Extension` | neutralino-rpc |
|
|
35
|
+
|
|
36
|
+
Default to `python-ui`: it needs no Node, no build step and has a permission profile.
|
|
37
|
+
Use an own frontend only when the UI already exists as web code.
|
|
38
|
+
|
|
39
|
+
## 3. Scaffold, run, build
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
neutralino init myapp --template python-ui --name "My App"
|
|
43
|
+
cd myapp
|
|
44
|
+
neutralino run --watch # restarts on Python/config change
|
|
45
|
+
neutralino build # portable directory in dist/
|
|
46
|
+
neutralino build --mode managed # installer with its own venv (see neutralino-packaging)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`init` never overwrites a differing file without `--force` (exit 3, unified diff shown).
|
|
50
|
+
Templates: `python-ui`, `hybrid`, `react`, `vanilla`; no `--template` writes the original
|
|
51
|
+
scaffold (`neutralino.Application` + `frontend/`, no `app.toml`).
|
|
52
|
+
|
|
53
|
+
Discover what ships with the package, offline:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
neutralino components list # UI component contracts; `components describe NAME`
|
|
57
|
+
neutralino examples list # runnable examples; `examples export NAME DEST`
|
|
58
|
+
neutralino skills list # these skills; `skills export DEST`
|
|
59
|
+
neutralino docs export DEST # offline docs: llms.txt index, guides, reference, manifests
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 4. Minimal working app
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from neutralino import ui
|
|
66
|
+
|
|
67
|
+
app = ui.Application(title="Hello", width=480, height=240, profile="restricted")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@app.page("/")
|
|
71
|
+
def home() -> None:
|
|
72
|
+
with ui.Stack(gap="md", p="lg"):
|
|
73
|
+
name = ui.TextInput(label="Your name", value="")
|
|
74
|
+
out = ui.Text("Type a name and press Greet.")
|
|
75
|
+
|
|
76
|
+
def greet() -> None:
|
|
77
|
+
out.text = f"Hello, {name.value or 'world'}!"
|
|
78
|
+
|
|
79
|
+
ui.Button("Greet", on_click=greet)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
if __name__ == "__main__":
|
|
83
|
+
app.run()
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Source: the `neutralino init --template python-ui` template (its `app.py`). `app.run()` blocks until the window closes or Ctrl-C.
|
|
87
|
+
|
|
88
|
+
## 5. Rules that avoid the common failures
|
|
89
|
+
|
|
90
|
+
- Exit codes: 0 ok, 1 operation failed, 2 usage, 3 validation (project, config, name, would-overwrite),
|
|
91
|
+
4 environment (runtime missing, no display, missing tool). `--help` on any command is exact.
|
|
92
|
+
- Permissions are one list for the page and for Python (`native_allow_list`, or `profile=`). Without it
|
|
93
|
+
Python's own native calls (`app.native.os...`) fail with `NE_RT_NATPRME`. See neutralino-native.
|
|
94
|
+
- Never call a blocking method from the event-loop thread: sync callbacks run on worker threads,
|
|
95
|
+
async callbacks on the loop. The blocking facades raise `RuntimeError` instead of deadlocking.
|
|
96
|
+
- Shutdown stops runtimes the SDK launched, not processes your app spawned through them.
|
|
97
|
+
- The runtime's local HTTP server is an upstream limitation (traversal, token exposure, ADR-016):
|
|
98
|
+
keep window mode, do not run on shared multi-user machines with private data.
|
|
99
|
+
- Do not invent API: check `neutralino components describe NAME`, the signature in the installed
|
|
100
|
+
package, or the generated reference before using a name.
|
|
101
|
+
|
|
102
|
+
## References
|
|
103
|
+
|
|
104
|
+
- [references/cli.md](references/cli.md): every command with options and exit codes.
|
|
105
|
+
- [references/architecture.md](references/architecture.md): the objects (Application, Extension, Client), lifecycle, config rules, limits.
|
|
106
|
+
- [references/platforms-security.md](references/platforms-security.md): platform status, security model, what a profile is and is not.
|
|
107
|
+
|
|
108
|
+
Next skills: neutralino-ui, neutralino-native, neutralino-frontend, neutralino-rpc,
|
|
109
|
+
neutralino-app-patterns, neutralino-packaging, neutralino-updates, neutralino-maintenance.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Architecture and configuration rules
|
|
2
|
+
|
|
3
|
+
| Object | Role |
|
|
4
|
+
|---|---|
|
|
5
|
+
| `neutralino.Application` / `neutralino.AsyncApplication` | Python launches the pinned runtime in a private instance directory, connects as an extension, serves exposed functions, stops everything it owns. |
|
|
6
|
+
| `neutralino.Extension` / `neutralino.AsyncExtension` | The runtime started this Python program (`extensions[].command`); adopt the stdin bootstrap, serve, exit when the runtime closes the connection. |
|
|
7
|
+
| `neutralino.AsyncClient` / `neutralino.Client` | One authenticated connection with typed namespaces (`client.filesystem`, `client.window`, ...), `events`, `invoke_native`. |
|
|
8
|
+
| `ui.Application` / `ui.AsyncApplication` | Python-defined UI on top of the core application (`app.native` is the core application). |
|
|
9
|
+
| `app.windows` | Managed windows: one extra owned runtime per window. |
|
|
10
|
+
| `app.frontend` | Call functions that pages registered with `backend.register(name, fn)`. |
|
|
11
|
+
| `python-bridge.mjs` | Page side: `PythonBackend(NL_PYTHON_EXTENSION_ID)` with `invoke`, `stream`, `emit`, `discover`, `register`. |
|
|
12
|
+
|
|
13
|
+
## Lifecycle
|
|
14
|
+
|
|
15
|
+
`run()` blocks until the window closes or Ctrl-C, then shuts down: RPC peers get `bye`, the socket
|
|
16
|
+
closes, the runtime gets SIGTERM (then terminate/kill after `Limits.shutdown_grace`), the private
|
|
17
|
+
directory is removed. `start()` returns once the session is READY; `shutdown()` is idempotent;
|
|
18
|
+
`request_stop()` is safe from any thread; `restart()` starts a fresh runtime (pending calls fail with
|
|
19
|
+
`DISCONNECTED`). Constructing an application creates no process.
|
|
20
|
+
|
|
21
|
+
Children started through the runtime (`os.spawn_process`, background `exec_command`) outlive
|
|
22
|
+
`shutdown()`. Stop them first:
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
async def stop_children(app) -> None: # `app`: a running neutralino.AsyncApplication
|
|
26
|
+
for proc in await app.client.os.get_spawned_processes():
|
|
27
|
+
await app.client.os.update_spawned_process(proc["id"], "exit")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use `spawn_process` for anything long-running; background `exec_command` children are not listed.
|
|
31
|
+
|
|
32
|
+
## Configuration the SDK enforces
|
|
33
|
+
|
|
34
|
+
- `Application(config=...)` takes a dict or a `neutralino.config.json` path. Without a config the
|
|
35
|
+
`nativeAllowList` is the SDK minimum (`app.broadcast`, `app.exit`, `extensions.dispatch`,
|
|
36
|
+
`extensions.getStats`); `native_allow_list=[...]` adds routes, `"*"` allows all.
|
|
37
|
+
- `nativeAllowList`/`nativeBlockList` must allow `extensions.getStats` and `app.broadcast`
|
|
38
|
+
(start-up fails otherwise) and should allow `extensions.dispatch` (page to Python calls).
|
|
39
|
+
- Forced: `enableServer`, `enableNativeAPI`, `enableExtensions`, `exportAuthInfo`. Defaults when
|
|
40
|
+
unset: `port: 0`, `storageLocation: "system"`, `tokenSecurity: "one-time"`.
|
|
41
|
+
- Refused with `ValidationError`: any `tokenSecurity` other than `"one-time"`; runtime arguments that
|
|
42
|
+
undo the instance config (`--path`, `--config-file`, `--mode`, `--enable-server`, ...);
|
|
43
|
+
`dataLocation` other than `"app"`; `storageLocation: "app"`. `mode="cloud"` works but logs a
|
|
44
|
+
warning because the runtime then binds every network interface.
|
|
45
|
+
- Window calls wait until the runtime's window exists; outside window mode the getters raise
|
|
46
|
+
`UnsupportedError`.
|
|
47
|
+
|
|
48
|
+
## Limits
|
|
49
|
+
|
|
50
|
+
Native messages 8 MiB (`neutralino.Limits.max_message_bytes`), RPC messages 4 MiB, stream items
|
|
51
|
+
256 KiB (`neutralino.RpcLimits`). Native calls take `timeout=`; a timeout raises
|
|
52
|
+
`CallTimeoutError` with `outcome_unknown = True` and nothing is retried. For large files use
|
|
53
|
+
`filesystem.open_file` plus `update_opened_file` events.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# `neutralino` command line
|
|
2
|
+
|
|
3
|
+
Installed with the package (`neutralino`, or `python -m neutralino.cli`). Offline except:
|
|
4
|
+
`runtime install` without `--archive`, `build --bundle` without `--offline`, `build`/`release
|
|
5
|
+
--mode managed` without `--wheelhouse`, and `updates check`. `--help` on any command is exact.
|
|
6
|
+
|
|
7
|
+
| Exit | Meaning |
|
|
8
|
+
|---|---|
|
|
9
|
+
| 0 | success |
|
|
10
|
+
| 1 | operation failed (a command it ran failed, the app exited non-zero, I/O error, Ctrl-C) |
|
|
11
|
+
| 2 | usage error (unknown option, options that need each other) |
|
|
12
|
+
| 3 | validation (project, `app.toml`, requirements, wheelhouse, archive, name/path; file that would be overwritten without `--force`) |
|
|
13
|
+
| 4 | environment (runtime missing or not the pinned build, unsupported platform, missing tool, no network for a download, missing UI assets) |
|
|
14
|
+
|
|
15
|
+
## Scaffold and discover
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
neutralino init [PATH] [--name NAME] [--force] [--template {python-ui,hybrid,vanilla,react}] [--app-id ID] [--updates github --repo OWNER/NAME]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
neutralino init myapp --template python-ui --name "My App"
|
|
23
|
+
neutralino components list --json
|
|
24
|
+
neutralino components describe Button
|
|
25
|
+
neutralino examples list --json
|
|
26
|
+
neutralino examples export NAME DEST
|
|
27
|
+
neutralino skills list --json
|
|
28
|
+
neutralino skills export DEST --skill neutralino-ui
|
|
29
|
+
neutralino docs export DEST
|
|
30
|
+
neutralino frontend export src/bridge --with-client
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- `--app-id`, `--updates`, `--repo` need `--template`; `--updates` and `--repo` need each other (exit 2).
|
|
34
|
+
- Writes are atomic. A symlink among the targets is refused even with `--force`.
|
|
35
|
+
- `examples export`, `skills export` and `docs export` use the same no-overwrite rules; an unknown name is exit 3.
|
|
36
|
+
- `components describe` prints props, events, slots and examples of one component contract.
|
|
37
|
+
|
|
38
|
+
## Run and diagnose
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
neutralino run --project . --app app.py --watch --debounce 250
|
|
42
|
+
neutralino explorer # the installed API/component explorer
|
|
43
|
+
neutralino doctor --json --smoke # --smoke starts a hidden window and makes one call
|
|
44
|
+
neutralino runtime path
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`run` uses the current Python; a missing entry is exit 3. `--watch` restarts the backend on
|
|
48
|
+
Python/config changes and reloads the page on `--frontend` changes. `doctor` exits 4 when a
|
|
49
|
+
check failed and prints no secrets.
|
|
50
|
+
|
|
51
|
+
## Build and release (see neutralino-packaging, neutralino-updates)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
neutralino build # portable, dist/<slug>/
|
|
55
|
+
neutralino build --mode managed --python-version 3.12 --wheelhouse ./wheels
|
|
56
|
+
neutralino release --out ../release --mode managed # local files only, never uploads
|
|
57
|
+
neutralino updates check --config app.toml --json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`--bundle` (resources.neu) needs Node at build time and is refused with `--mode managed`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Platforms and security model
|
|
2
|
+
|
|
3
|
+
## Platform status (this version)
|
|
4
|
+
|
|
5
|
+
| Platform | Status |
|
|
6
|
+
|---|---|
|
|
7
|
+
| Linux x86_64, X11 code path | verified under a private Xvfb only; no real X11 desktop session was available |
|
|
8
|
+
| Linux x86_64, KDE Plasma Wayland | smoke-verified once (launch, title, RPC round trip, second window, clean exit); manual GUI checklist not run |
|
|
9
|
+
| Linux x86_64, GNOME Wayland | not verified |
|
|
10
|
+
| Linux arm64/armhf | not verified |
|
|
11
|
+
| Windows Server 2022 x64 (Windows 11 expected the same) | secondary: test suite and a real-window smoke pass; tray, dialogs, `run.bat` and managed install not verified (WebView2 required) |
|
|
12
|
+
| macOS arm64/x64 | not verified |
|
|
13
|
+
| Windows arm64 | unsupported (no official runtime binary) |
|
|
14
|
+
|
|
15
|
+
Linux packages (Debian/Ubuntu): `libwebkit2gtk-4.1-0`, `libgtk-3-0`, `libayatana-appindicator3-1`
|
|
16
|
+
(tray), and one of `zenity`/`kdialog`/`qarma`/`matedialog` (dialogs, notifications).
|
|
17
|
+
`neutralino doctor` reports what is missing. `window.set_badge` does nothing on Linux.
|
|
18
|
+
Never claim a platform as verified from this table's unverified rows.
|
|
19
|
+
|
|
20
|
+
## Security model
|
|
21
|
+
|
|
22
|
+
- One trust domain: the runtime, every page it serves and the Python backend. Do not load untrusted
|
|
23
|
+
remote content into a window that has the native API.
|
|
24
|
+
- The allow list, block list and `filesystemScopes` apply to the page and to Python alike (ADR-006).
|
|
25
|
+
A profile is a permission list, not a sandbox: Python keeps every privilege of its process.
|
|
26
|
+
- The frontend can call only functions you exposed with `@app.expose()`; there is no eval and no
|
|
27
|
+
generic native proxy for pages.
|
|
28
|
+
- Upstream limitation (ADR-016): the runtime's local HTTP server does not normalise paths and hands
|
|
29
|
+
the one-time token to the first requester. Any local process that finds the port can read the
|
|
30
|
+
user's files while the app runs. The SDK keeps window mode and `tokenSecurity: "one-time"` but
|
|
31
|
+
cannot fix this without forking the runtime. Do not run on shared multi-user machines with private data.
|
|
32
|
+
- `os.exec_command`/`spawn_process` run through `/bin/sh -c`; `commandAllowList` is not a shell
|
|
33
|
+
filter. Never build a command string from untrusted input.
|
|
34
|
+
- Credentials (runtime token, connect token) stay in memory: not in argv, environment, logs or `repr`.
|
|
35
|
+
- Files created through native APIs are 0600/0700 (runtime umask 077). Use
|
|
36
|
+
`filesystem.set_permissions` when others must read them.
|
|
37
|
+
- Runtime archives are checked against SHA-256 values in the shipped lock; upstream publishes no
|
|
38
|
+
signatures, so a hash proves the bytes match the reviewed release, nothing more.
|
|
39
|
+
|
|
40
|
+
## Performance (one machine, Linux x86_64, measured once)
|
|
41
|
+
|
|
42
|
+
Python to native call 0.22 ms; page round trip about 44 ms (the runtime lacks `TCP_NODELAY`);
|
|
43
|
+
10,000 stream items about 30 s with batched credit. For bulk data send fewer, larger items
|
|
44
|
+
(up to 256 KiB). Memory was not measured.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: neutralino-rpc
|
|
3
|
+
description: Expose Python functions to a page or to another process with app.expose, read the RpcContext (progress, cancellation, native client), stream results with credit, raise RpcError, and run Python as a runtime-started Extension. Use it for any page-to-Python call, long task, stream, or Python-to-page call.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# neutralino-rpc
|
|
7
|
+
|
|
8
|
+
The RPC layer connects pages and Python over the runtime's extension channel. Only functions you
|
|
9
|
+
register are callable; names are case-sensitive; there is no module scanning and no eval.
|
|
10
|
+
|
|
11
|
+
## Decision rules
|
|
12
|
+
|
|
13
|
+
| Need | Use |
|
|
14
|
+
|---|---|
|
|
15
|
+
| Page asks, Python answers | `@app.expose()` (plain function runs on a worker thread; `async def` runs on the loop) |
|
|
16
|
+
| Many results over time | `@app.expose(stream=True)` with a (async) generator |
|
|
17
|
+
| Report progress, support cancel | a parameter named `ctx` (`RpcContext`) |
|
|
18
|
+
| Call a native API for the calling window | `ctx.client.<namespace>` |
|
|
19
|
+
| Python asks the page | `await app.frontend.invoke(name, params)` (page registered it with `backend.register`) |
|
|
20
|
+
| Runtime starts your Python program | `neutralino.Extension.from_stdin()` (config `extensions[].command`) |
|
|
21
|
+
|
|
22
|
+
## Minimal working example
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from neutralino import Application, RpcContext, RpcError
|
|
26
|
+
|
|
27
|
+
app = Application(resources="frontend", title="Tasks", native_allow_list=["computer.getMemoryInfo"])
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@app.expose()
|
|
31
|
+
async def memory(ctx: RpcContext) -> dict:
|
|
32
|
+
return await ctx.client.computer.get_memory_info()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@app.expose("job.run", schema={"type": "object", "properties": {"steps": {"type": "integer"}}})
|
|
36
|
+
def run_job(steps: int, ctx: RpcContext) -> int:
|
|
37
|
+
for i in range(steps):
|
|
38
|
+
if ctx.cancelled: # cooperative: threads are never killed
|
|
39
|
+
raise RpcError("CANCELLED", f"stopped after {i} of {steps}")
|
|
40
|
+
ctx.progress(current=i + 1, total=steps, message="working")
|
|
41
|
+
return steps
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@app.expose(stream=True)
|
|
45
|
+
async def ticks(n: int, ctx: RpcContext):
|
|
46
|
+
for i in range(n):
|
|
47
|
+
if ctx.cancelled:
|
|
48
|
+
return
|
|
49
|
+
yield {"i": i}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
if __name__ == "__main__":
|
|
53
|
+
app.run()
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Sources: `examples/monitor/app.py` (`ctx.client`, stream), `examples/patterns/long_tasks.py`
|
|
57
|
+
(progress and cancel), `examples/patterns/streaming.py` (stream with `ctx`). Page side: neutralino-frontend.
|
|
58
|
+
|
|
59
|
+
Extension mode (the runtime starts Python; source `examples/extension_mode/backend/main.py`):
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from neutralino import Extension
|
|
63
|
+
|
|
64
|
+
ext = Extension.from_stdin()
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@ext.expose()
|
|
68
|
+
def calculate(a: int, b: int):
|
|
69
|
+
return a + b
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
ext.run()
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Rules
|
|
76
|
+
|
|
77
|
+
- **Parameters** arrive as a JSON object: unknown or missing ones, and values that do not match simple
|
|
78
|
+
annotations (`str`, `int`, `float`, `bool`, `list`, `dict`, unions) or the optional JSON-schema subset,
|
|
79
|
+
fail with `INVALID_PARAMS`. Discovery (`backend.discover()`) lists names, parameters, schema and stream
|
|
80
|
+
mode, and `description` only when you pass `description=`; docstrings are never published.
|
|
81
|
+
- **Return values** must be JSON with integers within +-(2**53-1). Integral floats (`1.0`) count as
|
|
82
|
+
integers in RPC messages. Application errors: `raise RpcError(code, message, details)`. Any other
|
|
83
|
+
exception becomes `INTERNAL_ERROR` without details.
|
|
84
|
+
- **`RpcContext`**: `ctx.cancelled`, `await ctx.wait_cancelled()`, `ctx.progress(current=, total=,
|
|
85
|
+
message=)` (thread-safe, coalesced to 10/s, latest delivered before the final message), `ctx.client`,
|
|
86
|
+
`ctx.window`, `ctx.peer`, `ctx.run(coro)` (async SDK code from a plain function), `ctx.set_result(v)`.
|
|
87
|
+
- **Cancellation is cooperative.** Async handlers are cancelled; plain functions see `ctx.cancelled` and
|
|
88
|
+
their late result is discarded. A handler deadline gives `TIMEOUT` (`expose(timeout=...)`, default 30 s).
|
|
89
|
+
- **Streams** use credit (default window 16, max 64); each item is bounded by the method timeout or
|
|
90
|
+
`RpcLimits.stream_idle_timeout` (30 s). Items at most 256 KiB. The terminal value comes from a sync
|
|
91
|
+
generator's `return value` or `ctx.set_result(v)` (async generators cannot return a value).
|
|
92
|
+
- **Concurrency.** Plain handlers run on a bounded pool (default 4, `workers=`); at most 32 active calls per
|
|
93
|
+
page, further ones get `BUSY`. Handlers may use the blocking API; async handlers may not block the loop.
|
|
94
|
+
- **Python calls the page:** `async with app.frontend.stream(name, params) as s:` cancels on early exit.
|
|
95
|
+
|
|
96
|
+
## Pitfalls
|
|
97
|
+
|
|
98
|
+
- A generator without `stream=True` is not a stream.
|
|
99
|
+
- Blocking in an `async def` handler stalls the loop: use a plain function or `await asyncio.to_thread`.
|
|
100
|
+
- Calling a blocking SDK method from the loop thread raises `RuntimeError` (it would deadlock).
|
|
101
|
+
- A hung handler is reported at shutdown (`Limits.shutdown_grace`), never killed; handler threads are
|
|
102
|
+
daemon threads.
|
|
103
|
+
- `TimeoutError` raised by your own code is `INTERNAL_ERROR`, not `TIMEOUT`.
|
|
104
|
+
- RPC peer ids route messages; they do not authenticate. Any page the runtime serves can call every
|
|
105
|
+
exposed function: validate inputs, and keep privileged work behind explicit functions.
|
|
106
|
+
|
|
107
|
+
## References
|
|
108
|
+
|
|
109
|
+
Paths written `examples/...` in this skill are in the framework's source repository only; the wheel ships the
|
|
110
|
+
apps that `neutralino examples list` shows (`neutralino examples export NAME DIR`).
|
|
111
|
+
|
|
112
|
+
- [references/expose-and-context.md](references/expose-and-context.md): registering, schemas, discovery, threading model, Extension mode.
|
|
113
|
+
- [references/streams-and-cancellation.md](references/streams-and-cancellation.md): credit, progress, results, early exit, shutdown behaviour.
|
|
114
|
+
- [references/errors-and-limits.md](references/errors-and-limits.md): codes, limits, size rules, what the page sees.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Errors and limits
|
|
2
|
+
|
|
3
|
+
## Codes the page sees (`RpcError.code`)
|
|
4
|
+
|
|
5
|
+
`METHOD_NOT_FOUND`, `INVALID_PARAMS`, `BUSY`, `TIMEOUT`, `CANCELLED`, `PROTOCOL_ERROR`,
|
|
6
|
+
`INTERNAL_ERROR`, `DISCONNECTED`, `UNSUPPORTED`, `STREAM_OVERFLOW`.
|
|
7
|
+
|
|
8
|
+
- Your own errors: `raise RpcError("MY_CODE", "message", details)`; `details` must be JSON.
|
|
9
|
+
- Any other exception: `INTERNAL_ERROR` with no details (logged on the Python side).
|
|
10
|
+
- `TimeoutError` raised by your code is `INTERNAL_ERROR`; a handler deadline gives `TIMEOUT`.
|
|
11
|
+
- A call with no mounted page raises `RpcError("DISCONNECTED", ...)` on the Python side.
|
|
12
|
+
|
|
13
|
+
## Limits (`neutralino.RpcLimits`, `neutralino.Limits`)
|
|
14
|
+
|
|
15
|
+
| Limit | Default |
|
|
16
|
+
|---|---|
|
|
17
|
+
| RPC message | 4 MiB (`RpcLimits.max_message_bytes`) |
|
|
18
|
+
| Stream item | 256 KiB (`max_chunk_bytes`) |
|
|
19
|
+
| Stream credit | 16 initial, 64 max |
|
|
20
|
+
| Active calls per peer | 32 (`max_active_per_peer`), then `BUSY` |
|
|
21
|
+
| Call timeout | 30 s (`call_timeout`) |
|
|
22
|
+
| Stream idle timeout | 30 s |
|
|
23
|
+
| Handshake | 15 s |
|
|
24
|
+
| Progress | 10 per second |
|
|
25
|
+
| Native message | 8 MiB (`Limits.max_message_bytes`) |
|
|
26
|
+
| Native request timeout | 30 s (`Limits.request_timeout`) |
|
|
27
|
+
| Shutdown grace | 5 s (`Limits.shutdown_grace`) |
|
|
28
|
+
| JSON depth | 64 |
|
|
29
|
+
| Workers | 4 (`workers=`) |
|
|
30
|
+
|
|
31
|
+
Pass a custom `neutralino.RpcLimits(...)` as `rpc_limits=` to an application; raise limits explicitly and
|
|
32
|
+
only with a reason.
|
|
33
|
+
|
|
34
|
+
## Page-side behaviour
|
|
35
|
+
|
|
36
|
+
Calls settle at their `timeoutMs`, on abort and on `dispose()`. `emit()` rejects `TIMEOUT` when the notification
|
|
37
|
+
is not handed to the runtime in time and `DISCONNECTED` on dispose. A handshake that timed out is retried by
|
|
38
|
+
the next call.
|
|
39
|
+
|
|
40
|
+
## Security notes
|
|
41
|
+
|
|
42
|
+
Peer ids route messages; they do not authenticate anyone. The runtime, every page it serves and the Python
|
|
43
|
+
backend are one trust domain. The page can call only exposed functions, but it can call all of them:
|
|
44
|
+
validate inputs, bound sizes, and never build shell commands or file paths from page input without checks.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Exposing functions
|
|
2
|
+
|
|
3
|
+
```python
|
|
4
|
+
@app.expose() # name = function name
|
|
5
|
+
def get_users(department: str): ...
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@app.expose("users.count", schema={"type": "object", "properties": {"min": {"type": "integer"}}})
|
|
9
|
+
async def count_users(ctx: RpcContext, min: int = 0) -> int: ...
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@app.expose(stream=True) # generators and async generators stream
|
|
13
|
+
def lines(path: str, ctx: RpcContext):
|
|
14
|
+
with open(path, encoding="utf-8") as f:
|
|
15
|
+
for line in f:
|
|
16
|
+
if ctx.cancelled:
|
|
17
|
+
return
|
|
18
|
+
yield line
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`expose(name=None, *, stream=False, schema=None, description=None, timeout=None)`; the bare form
|
|
22
|
+
`@app.expose` registers under the function name. The same decorator exists on `neutralino.Application`,
|
|
23
|
+
`AsyncApplication`, `Extension`, `AsyncExtension`, and on `ui.Application` (forwarded to the core).
|
|
24
|
+
`register(name, fn, ...)` is the non-decorator form.
|
|
25
|
+
|
|
26
|
+
## Validation
|
|
27
|
+
|
|
28
|
+
- Parameters are a JSON object by name. Unknown or missing parameters, wrong simple annotations
|
|
29
|
+
(`str`, `int`, `float`, `bool`, `list`, `dict`, unions) and violations of the optional JSON-schema subset
|
|
30
|
+
fail with `INVALID_PARAMS` before your function runs.
|
|
31
|
+
- Always re-validate what matters (paths, sizes, ids) inside the function. Confine file access to a root
|
|
32
|
+
as the packaged `file-manager` example (`app.py`) does (`inside_root`, then `RpcError("INVALID_PARAMS", ...)`).
|
|
33
|
+
- Return JSON only; integers within +-(2**53-1).
|
|
34
|
+
|
|
35
|
+
## Discovery
|
|
36
|
+
|
|
37
|
+
`backend.discover()` on the page returns names, parameters, schema and stream mode. `description` appears
|
|
38
|
+
only when passed to `expose`.
|
|
39
|
+
|
|
40
|
+
## Threading model
|
|
41
|
+
|
|
42
|
+
- `AsyncApplication`, `AsyncClient`, `AsyncExtension` run on your asyncio loop; nothing user-defined
|
|
43
|
+
runs on the socket reader.
|
|
44
|
+
- Plain functions run on a bounded pool (default 4, `Application(workers=)`); coroutines on the loop.
|
|
45
|
+
Sync generators advance one item at a time on the pool; an abandoned one is closed on that worker as
|
|
46
|
+
soon as `next()` returns, so `finally`/`with` blocks run.
|
|
47
|
+
- The blocking `Application` and `Client` run a private loop thread. Calling a blocking method from that
|
|
48
|
+
thread, or from a thread running another loop, raises `RuntimeError`.
|
|
49
|
+
- At most 32 active calls per page; more get `BUSY`.
|
|
50
|
+
|
|
51
|
+
## `RpcContext`
|
|
52
|
+
|
|
53
|
+
| Member | Meaning |
|
|
54
|
+
|---|---|
|
|
55
|
+
| `cancelled`, `await wait_cancelled()` | cooperative cancellation |
|
|
56
|
+
| `progress(current=, total=, message=)` | to the page's `onProgress`; thread-safe, 10/s, latest wins |
|
|
57
|
+
| `client` | native API of the calling window (needs the allow-list routes) |
|
|
58
|
+
| `window`, `peer` | the calling window / peer id |
|
|
59
|
+
| `run(coro)` | run async SDK code from a plain function |
|
|
60
|
+
| `set_result(value)` | terminal value of a stream |
|
|
61
|
+
|
|
62
|
+
## Extension mode
|
|
63
|
+
|
|
64
|
+
The runtime starts your program (`extensions: [{"id": ..., "command": "python3 \"${NL_PATH}/backend/main.py\""}]`
|
|
65
|
+
in `neutralino.config.json`), writes the bootstrap JSON to stdin and closes it. `Extension.from_stdin()`
|
|
66
|
+
adopts it, serves exposed functions, and `run()` returns when the runtime closes the connection. It never
|
|
67
|
+
kills the runtime. `from_auth_file` refuses symlinks, non-regular files, files of another user and
|
|
68
|
+
writable-by-others files (`CredentialsError`). The extension keeps the umask it was started with.
|
|
69
|
+
Source: `examples/extension_mode/`; `config` in that folder lists `nativeAllowList` and the extension id.
|
|
70
|
+
|
|
71
|
+
## Calling the page from Python
|
|
72
|
+
|
|
73
|
+
`app.frontend.invoke(name, params)` and `app.frontend.stream(...)` call functions pages registered with
|
|
74
|
+
`backend.register(name, fn)`. In a Python UI use `ui.CustomComponent.request(...)`.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Streams, progress and cancellation
|
|
2
|
+
|
|
3
|
+
## Producing a stream
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
@app.expose(stream=True)
|
|
7
|
+
async def watch(interval_ms: int, ctx: RpcContext):
|
|
8
|
+
interval = max(0.2, interval_ms / 1000)
|
|
9
|
+
while not ctx.cancelled:
|
|
10
|
+
yield {"free": await read_free()}
|
|
11
|
+
await asyncio.sleep(interval)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
(`examples/monitor/app.py` has the complete function.) A sync generator may `return value`; any
|
|
15
|
+
generator may call `ctx.set_result(value)`; async generators cannot `return value`. The page reads
|
|
16
|
+
the terminal value from `await stream.result` after consuming to the end.
|
|
17
|
+
|
|
18
|
+
## Credit and bounds
|
|
19
|
+
|
|
20
|
+
- Flow control by credit: the producer pauses when the consumer has not granted credit (initial 16,
|
|
21
|
+
max 64; JS `stream(name, params, {credit: 64})`).
|
|
22
|
+
- Producing each item is bounded by the method's `timeout` or `RpcLimits.stream_idle_timeout` (30 s);
|
|
23
|
+
waiting for credit by `stream_idle_timeout`.
|
|
24
|
+
- Item size at most 256 KiB (`RpcLimits.max_chunk_bytes`); for bulk data send fewer, larger items. A
|
|
25
|
+
10,000-item stream took about 30 s with batched credit on the measured machine.
|
|
26
|
+
|
|
27
|
+
## Cancellation
|
|
28
|
+
|
|
29
|
+
- The page cancels by leaving its `for await` loop (or aborting its `AbortSignal`); Python-side
|
|
30
|
+
consumers use `async with app.frontend.stream(...) as s:` or `await s.aclose()`.
|
|
31
|
+
- Async handlers are cancelled (`CancelledError`): clean up in `finally`. Plain functions poll
|
|
32
|
+
`ctx.cancelled`; their late result is discarded. Threads are never killed.
|
|
33
|
+
- The CANCELLED/TIMEOUT reply is sent immediately and never waits for a free worker.
|
|
34
|
+
- Leaving a stream early rejects `result` with `CANCELLED`.
|
|
35
|
+
|
|
36
|
+
## Progress
|
|
37
|
+
|
|
38
|
+
`ctx.progress(current=3, total=10, message="step")`; JS `onProgress`. Rate-limited to 10 per second, only the
|
|
39
|
+
latest value kept, delivered before the terminal message. Advisory: consumers tolerate gaps and drop
|
|
40
|
+
stale or duplicate updates. Do not use progress as the only record of work done.
|
|
41
|
+
|
|
42
|
+
## Shutdown
|
|
43
|
+
|
|
44
|
+
`shutdown()` waits `Limits.shutdown_grace` (5 s), then logs handlers still running and leaves them (daemon
|
|
45
|
+
threads). `EventBus.aclose()` returns the names of event subscriptions whose handlers did not stop.
|
|
46
|
+
When the runtime connection ends on its own, event streams raise `ConnectionLostError`; when you close
|
|
47
|
+
the session, they end.
|
|
48
|
+
|
|
49
|
+
## A UI-side progress pattern
|
|
50
|
+
|
|
51
|
+
For a Python UI use `ui.Progress`, a Start/Cancel button pair and `Window.notify` at the end
|
|
52
|
+
(`examples/patterns/long_tasks.py`); a background `asyncio` task is created from an async handler so
|
|
53
|
+
it has the running loop (`examples/patterns/python_push.py`).
|