{"id":18004138,"url":"https://github.com/ivorforce/dash-standalone-boilerplate","last_synced_at":"2025-03-26T10:31:07.790Z","repository":{"id":247966543,"uuid":"820502867","full_name":"Ivorforce/Dash-Standalone-Boilerplate","owner":"Ivorforce","description":"A boilerplate repository for standalone dash apps, using nuitka.","archived":false,"fork":false,"pushed_at":"2024-08-30T10:21:05.000Z","size":380,"stargazers_count":27,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T15:00:44.768Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ivorforce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-26T15:41:20.000Z","updated_at":"2025-03-06T21:42:34.000Z","dependencies_parsed_at":"2024-07-11T16:27:16.106Z","dependency_job_id":null,"html_url":"https://github.com/Ivorforce/Dash-Standalone-Boilerplate","commit_stats":null,"previous_names":["ivorforce/dash-standalone-boilerplate"],"tags_count":2,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ivorforce%2FDash-Standalone-Boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ivorforce%2FDash-Standalone-Boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ivorforce%2FDash-Standalone-Boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ivorforce%2FDash-Standalone-Boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ivorforce","download_url":"https://codeload.github.com/Ivorforce/Dash-Standalone-Boilerplate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245636150,"owners_count":20647917,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-30T00:13:28.178Z","updated_at":"2025-03-26T10:31:07.438Z","avatar_url":"https://github.com/Ivorforce.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dash Standalone Boilerplate\n\nThis package is a template for [Dash](https://dash.plotly.com) (and generally [Flask](https://flask.palletsprojects.com/en/3.0.x/)) based Python web programs that want to be a standalone desktop app rather than a local website.\n\n![screenshot](./docs/screenshot.png)\n\n## Setup\n\nYou can install the project with pip:\n```bash\n# set up project\npip install .\n# run the app without compiling\npython src/dnb/main.py\n```\n\nAlternatively, you can use poetry. For that, first [install poetry](https://python-poetry.org/docs/). Then:\n\n```bash\n# set up project\npoetry install\n# run the app without compiling\npoetry run python src/dnb/main.py\n```\n\n## How does it work?\n\nFirst, a [Flask](https://flask.palletsprojects.com/en/3.0.x/) server is opened through a local port (8050). This server can be accessed through any local web browser. [Dash](https://dash.plotly.com) is attached to the Flask server.\n\nTo make it a standalone app, a web view (through [pywebview](https://pywebview.flowrl.com)) is opened to visit the address. In contrast to something like Electron, the web view is completely native and thus not included in the final app bundle. This makes the app leaner and less RAM intensive.\n\nFinally, the app is bundled into an executable using [Nuitka](https://nuitka.net). Nuitka compiles the whole python interpreter, including required packages, into an app that can be run without an existing python installation.\n\nThese tricks combine to make an app that behaves just as one would expect from a normal app, avoiding the myriad issues that are normally associated with shipping a python web app.\n\n## Building and shipping the app\n\nIt is possible to build the app for the current operating system using the following code:\n\n```bash\n# You need to install with nuitka\npoetry install -E nuitka\n# compile binary\npoetry run python -m nuitka --output-dir=build --onefile --macos-create-app-bundle --include-package-data=dash --include-package-data=dash_core_components --include-package-data=dash_html_components --include-package-data=packaging --include-package=plotly --include-package-data=plotly --include-package-data=dnb src/dnb/main.py\n# run binary\n./main.bin\n```\n\nThis repository also comes with a [github action](https://docs.github.com/en/actions) that builds it for macOS, Linux, and Windows. This action takes about 2 hours to execute, using about 360 of your [2000 free minutes](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-action) offered by GitHub - so use it sparingly. To trigger it, tag a commit as release:\n\n```bash\ngit tag release.0.1\ngit push --tags\n```\n\nYou will be able to download the artifacts of the build from the workflow page. I recommend publishing them locally on GitHub with the [Releases](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository) feature. Note that the macOS and Linux builds are not executable by default. Before uploading, make sure you `chmod +x path/to/executable` and re-zip the application.\n\n## Alternatives\n\nThere are a few alternatives to using Nuitka to create binaries:\n- Some (like [PyApp](https://ofek.dev/pyapp/latest/), [pyinstaller](https://pyinstaller.org/en/stable/) and [PyOxidizer](https://pyoxidizer.readthedocs.io/en/stable/)), bundle an automated setup script. Actual python code is run on target machines, which reduces build times and may avoid some issues while introducing others. It will also require the target machine to set up itself.\n- [Cython](https://cython.org) has an [embedding option](https://github.com/cython/cython/wiki/EmbeddingCython) that allows it to create executables. Cython can gain considerable speed over Nuitka, but may be more work to get running.\n\n## In the Wild\n\nSee how I'm using this template with a more advanced project in [ECG Viewer](https://github.com/Ivorforce/ECG-Viewer/tree/main).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivorforce%2Fdash-standalone-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivorforce%2Fdash-standalone-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivorforce%2Fdash-standalone-boilerplate/lists"}