Package: tappack
tappack: Tasmota Application PackagerThis 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.tappfiles).Downloads each, extracts and merges them, in a subfolder, it into your own code.Auto-generates anautoexec.befor your library that sets up all the relevant dependency paths.Packages the whole structure into a.tappfile ready for deployment.Manifest FileYour project needs to contain atappackmanifest file,manifest.yaml, with at least fieldsnameanddependencies. The latter is a mapping of module names to URLs of corresponding.tappfile. For example:name:my_librarydependencies:my_tools:https://example.com/my_tools.tappYou can also specify when a dependency should be read from a local path (which will be recursed automatically) as
follows:name:my_librarydependencies:my_dependency:.type:LocalPathpath:/usr/src/my_dependencyYou can also specify GitHub Release assets:name:my_librarydependencies:tools:.type:GitHubReleaseAssetorg:fmtrversion:v0.0.9# Omit this field for the latest version.repo:tools.befilename:tools.tappRelease 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:name:my_librarydependencies:tools:.type:URLurl:https://github.com/fmtr/tools/releases/download/v0.0.1/tools.tapp.channels:development:.type:LocalPathpath:/fm/tools.be/moduleExample Usage$tappack--helpUsage: 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 relevantif your manifests contain release channelinformation. Example: development--help                   Show this message and exit.$tappack--module-path/usr/src/my_berry_project--tapp-path~/my_project.tappInstalling$pip install tappackNoautoexec.beYour module shouldnotcontain anautoexec.be, astappackwill generate one. If you need to run any code in
theautoexeccontext, then ensure your module implements anautoexecmethod, which will be called once it is
imported. For example:varmod=module("my_module")defautoexec()# Do autoexec stuff here.endmod.autoexec=autoexecreturnmodRunning as a Servertappackcan 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.tappfiles.Opens a tunnel to the web app, letting you deploy your Tasmota Application to any device with an internet connection.How to Installpip install tappack[server]Example UsageTo serve a project:$tappack-server --project /usr/src/my_projectYou 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 ofberry_filesas a TAPP file calledproject_c.tapp.Sample OutputWaitingfortunneltoinitialise...*ServingFlaskapp'TappServer'*Debugmode:off
WARNING:Thisisadevelopmentserver.Donotuseitinaproductiondeployment.UseaproductionWSGIserverinstead.*Runningonhttp://127.0.0.1:80
PressCTRL+Ctoquit
Servingproject"project_a":`tasmota.urlfetch("http://c141-x-y-z-w.ngrok.io/project_a.tapp")`Servingproject"project_b":`tasmota.urlfetch("http://c141-x-y-z-w.ngrok.io/project_b.tapp")`:warning: Security WarningRunningtappack-serverinvolves opening up your project files to the public internet, using a development server.
Proceed with
caution.