# `tappack`: Tasmota Application Packager
This tool aims to simplify packaging Tasmota Berry code as a TAPP file, including basic dependency resolution. It can be
run locally, but is primarily intended for use during a release workflow, e.g. GitHub Actions.
## What Does It Do?
It performs the following:
* Reads your project manifest file (see below), with a list of dependency URLs (other `.tapp` files).
* Downloads each, extracts and merges them, in a subfolder, it into your own code.
* Auto-generates an `autoexec.be` for your library that sets up all the relevant dependency paths.
* Packages the whole structure into a `.tapp` file ready for deployment.
## Manifest File
Your project needs to contain a `tappack` manifest file, `manifest.yaml`, with at least fields `name`
and `dependencies`. The latter is a mapping of module names to URLs of corresponding `.tapp` file. For example:
```yaml
name: my_library
dependencies:
my_tools: https://example.com/my_tools.tapp
```
You can also specify when a dependency should be read from a local path (which will be recursed automatically) as
follows:
```yaml
name: my_library
dependencies:
my_dependency:
.type: LocalPath
path: /usr/src/my_dependency
```
You can also specify GitHub Release assets:
```yaml
name: my_library
dependencies:
tools:
.type: GitHubReleaseAsset
org: fmtr
version: v0.0.9 # Omit this field for the latest version.
repo: tools.be
filename: tools.tapp
```
Release channels are also supported. So pulling from a URL during normal packaging, but from a local path during a
development build (i.e. with parameter `--channel-id development`), is done like this:
```yaml
name: my_library
dependencies:
tools:
.type: URL
url: https://github.com/fmtr/tools/releases/download/v0.0.1/tools.tapp
.channels:
development:
.type: LocalPath
path: /fm/tools.be/module
```
## Example Usage
```bash
$ tappack --help
```
```console
Usage: tappack [OPTIONS]
Options:
--module-path DIRECTORY Path to your module, containing any Berry files,
manifests, assets, etc. Example:
/usr/src/my_berry_project [required]
--output FILE Path to write the output .tapp package. Example:
~/my_project.tapp
--channel-id TEXT Identifier for the release channel. Only relevant
if your manifests contain release channel
information. Example: development
--help Show this message and exit.
```
```bash
$tappack --module-path /usr/src/my_berry_project --tapp-path ~/my_project.tapp
```
## Installing
`$pip install tappack`
## No `autoexec.be`
Your module should _not_ contain an `autoexec.be`, as `tappack` will generate one. If you need to run any code in
the `autoexec` context, then ensure your module implements an `autoexec` method, which will be called once it is
imported. For example:
```be
var mod = module("my_module")
def autoexec()
# Do autoexec stuff here.
end
mod.autoexec=autoexec
return mod
```
# Running as a Server
`tappack` can also be run as a development server. This aims to simplify Tasmota Berry script development by doing two
things:
* Starts a web app that automatically packages your project(s), and serves them as a `.tapp` files.
* Opens a tunnel to the web app, letting you deploy your Tasmota Application to any device with an internet connection.
## How to Install
`pip install tappack[server]`
## Example Usage
To serve a project:
`$tappack-server --project /usr/src/my_project`
You can serve as many projects as you like, for example:
`$tappack-server --project /usr/src/project_a --project /usr/src/project_b ...`
If you want to give a project a name other than its directory name, you can prefix its path with `:`, e.g.
`$tappack-server --project project_c:/usr/src/project_c/berry_files ...`
This will serve the contents of `berry_files` as a TAPP file called `project_c.tapp`.
### Sample Output
```bash
Waiting for tunnel to initialise...
* Serving Flask app 'TappServer'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:80
Press CTRL+C to quit
Serving project "project_a": `tasmota.urlfetch("http://c141-x-y-z-w.ngrok.io/project_a.tapp")`
Serving project "project_b": `tasmota.urlfetch("http://c141-x-y-z-w.ngrok.io/project_b.tapp")`
```
## :warning: Security Warning
Running `tappack-server` involves opening up your project files to the public internet, using a development server.
Proceed with
caution.
Raw data
{
"_id": null,
"home_page": "https://link.frontmatter.ai/tappack",
"name": "tappack",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "development berry script tasmota tapp",
"author": "Frontmatter",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/e6/7f/7290014b1b6aa8b67b08e1895feb9b44a702029dd5a979752753a90f295c/tappack-0.3.2.tar.gz",
"platform": null,
"description": "# `tappack`: Tasmota Application Packager\n\nThis tool aims to simplify packaging Tasmota Berry code as a TAPP file, including basic dependency resolution. It can be\nrun locally, but is primarily intended for use during a release workflow, e.g. GitHub Actions.\n\n## What Does It Do?\n\nIt performs the following:\n\n* Reads your project manifest file (see below), with a list of dependency URLs (other `.tapp` files).\n* Downloads each, extracts and merges them, in a subfolder, it into your own code.\n* Auto-generates an `autoexec.be` for your library that sets up all the relevant dependency paths.\n* Packages the whole structure into a `.tapp` file ready for deployment.\n\n## Manifest File\n\nYour project needs to contain a `tappack` manifest file, `manifest.yaml`, with at least fields `name`\nand `dependencies`. The latter is a mapping of module names to URLs of corresponding `.tapp` file. For example:\n\n```yaml\nname: my_library\ndependencies:\n my_tools: https://example.com/my_tools.tapp\n\n```\n\nYou can also specify when a dependency should be read from a local path (which will be recursed automatically) as\nfollows:\n\n```yaml\nname: my_library\ndependencies:\n my_dependency:\n .type: LocalPath\n path: /usr/src/my_dependency\n```\n\nYou can also specify GitHub Release assets:\n\n```yaml\nname: my_library\ndependencies:\n tools:\n .type: GitHubReleaseAsset\n org: fmtr\n version: v0.0.9 # Omit this field for the latest version.\n repo: tools.be\n filename: tools.tapp\n```\n\nRelease channels are also supported. So pulling from a URL during normal packaging, but from a local path during a\ndevelopment build (i.e. with parameter `--channel-id development`), is done like this:\n\n```yaml\nname: my_library\ndependencies:\n tools:\n .type: URL\n url: https://github.com/fmtr/tools/releases/download/v0.0.1/tools.tapp\n .channels:\n development:\n .type: LocalPath\n path: /fm/tools.be/module\n```\n\n## Example Usage\n\n```bash\n$ tappack --help\n```\n\n```console\nUsage: tappack [OPTIONS]\n\nOptions:\n --module-path DIRECTORY Path to your module, containing any Berry files,\n manifests, assets, etc. Example:\n /usr/src/my_berry_project [required]\n --output FILE Path to write the output .tapp package. Example:\n ~/my_project.tapp\n --channel-id TEXT Identifier for the release channel. Only relevant\n if your manifests contain release channel\n information. Example: development\n --help Show this message and exit.\n```\n\n```bash\n$tappack --module-path /usr/src/my_berry_project --tapp-path ~/my_project.tapp\n```\n\n## Installing\n\n`$pip install tappack`\n\n## No `autoexec.be`\n\nYour module should _not_ contain an `autoexec.be`, as `tappack` will generate one. If you need to run any code in\nthe `autoexec` context, then ensure your module implements an `autoexec` method, which will be called once it is\nimported. For example:\n\n```be\nvar mod = module(\"my_module\")\n\ndef autoexec()\n\n # Do autoexec stuff here.\n\nend\n\nmod.autoexec=autoexec\nreturn mod\n```\n\n# Running as a Server\n\n`tappack` can also be run as a development server. This aims to simplify Tasmota Berry script development by doing two\nthings:\n\n* Starts a web app that automatically packages your project(s), and serves them as a `.tapp` files.\n* Opens a tunnel to the web app, letting you deploy your Tasmota Application to any device with an internet connection.\n\n## How to Install\n\n`pip install tappack[server]`\n\n## Example Usage\n\nTo serve a project:\n\n`$tappack-server --project /usr/src/my_project`\n\nYou can serve as many projects as you like, for example:\n\n`$tappack-server --project /usr/src/project_a --project /usr/src/project_b ...`\n\nIf you want to give a project a name other than its directory name, you can prefix its path with `:`, e.g.\n\n`$tappack-server --project project_c:/usr/src/project_c/berry_files ...`\n\nThis will serve the contents of `berry_files` as a TAPP file called `project_c.tapp`.\n\n### Sample Output\n\n```bash\nWaiting for tunnel to initialise...\n * Serving Flask app 'TappServer'\n * Debug mode: off\nWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.\n * Running on http://127.0.0.1:80\nPress CTRL+C to quit\nServing project \"project_a\": `tasmota.urlfetch(\"http://c141-x-y-z-w.ngrok.io/project_a.tapp\")`\nServing project \"project_b\": `tasmota.urlfetch(\"http://c141-x-y-z-w.ngrok.io/project_b.tapp\")`\n```\n\n## :warning: Security Warning\n\nRunning `tappack-server` involves opening up your project files to the public internet, using a development server.\nProceed with\ncaution. \n\n\n\n\n\n",
"bugtrack_url": null,
"license": "Copyright \u00a9 2023 Frontmatter. All rights reserved.",
"summary": "A packager for Tasmota Berry Application (TAPP) apps",
"version": "0.3.2",
"project_urls": {
"Homepage": "https://link.frontmatter.ai/tappack"
},
"split_keywords": [
"development",
"berry",
"script",
"tasmota",
"tapp"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ed3fe95393f38a8ba0420f2ab3f58057e9ae12db98003a450e317d91f3d9678c",
"md5": "befd3b0e7eb5f9afcc4922db2b76cf74",
"sha256": "ff6e1462f4d9c8e1e0c33b73408153c921c98f21189d07b62a9e9d4023a17cd4"
},
"downloads": -1,
"filename": "tappack-0.3.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "befd3b0e7eb5f9afcc4922db2b76cf74",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10537,
"upload_time": "2024-03-27T14:49:35",
"upload_time_iso_8601": "2024-03-27T14:49:35.171755Z",
"url": "https://files.pythonhosted.org/packages/ed/3f/e95393f38a8ba0420f2ab3f58057e9ae12db98003a450e317d91f3d9678c/tappack-0.3.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e67f7290014b1b6aa8b67b08e1895feb9b44a702029dd5a979752753a90f295c",
"md5": "3133abbc86e1039135adaa5268fb607f",
"sha256": "0ca5ecb7d7b6709dead8550fcc3943bae8c342e2a8853974e36826437fd3df67"
},
"downloads": -1,
"filename": "tappack-0.3.2.tar.gz",
"has_sig": false,
"md5_digest": "3133abbc86e1039135adaa5268fb607f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10339,
"upload_time": "2024-03-27T14:49:36",
"upload_time_iso_8601": "2024-03-27T14:49:36.265799Z",
"url": "https://files.pythonhosted.org/packages/e6/7f/7290014b1b6aa8b67b08e1895feb9b44a702029dd5a979752753a90f295c/tappack-0.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-27 14:49:36",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "tappack"
}