gust

Gust shim for Python.


Keywords
bazel, closure, frameworks, micronaut, soy
License
Other
Install
pip install gust==0.1-alpha

Documentation

@elide-tools/gust Build status codecov Codacy Badge Maintainability


Gust is beta software. Consider yourself warned...


Gust is a polyglot software application development framework. Bring the most road-tested toolchain on the planet to your development process, with Bazel, Protobuf, gRPC, Soy, and more, all pre-integrated and tested out of the box. Early support is included for Java, Kotlin, Python, and NodeJS on the backend; Closure, TypeScript, or even Java on the frontend (transpiled to highly-optimized and type-checked JS); and Java, Kotlin, Swift, Objective-C and C/C++ for mobile applications.

Runtime libraries are also published to support easy development of web applications (in Java and Python using Soy), and mobile applications (in Java and Swift). The framework is also capable of leveraging GraalVM to build your app into a native application (where supported), alleviating the need entirely for a JVM or Python runtime in your app containers. Native apps also have the nice benefit of way shorter startup times (try 30ms, lol!), and, in some cases, significant latency and memory use improvements.

Framework development

Right now, the primary goal of this work is a functional framework. This work is tracked in the following over-arching tickets:

Developing apps with Gust

Documentation is in the works. For now, there is API documentation in Java and some in JS. If you're familiar with the Closure/Bazel universe, navigating the framework should be relatively easy. If not, you may have a bad time.

If you'd like to use Gust for your own app, drop us a line by filing an issue, and we'll help you get there. Gust is already in use for production apps, but only inside our own team - so we can support it, but only on an individual/one-off basis, for now.

Sample Apps

As part of the framework code, a few sample apps are included. Each of these is usable as its own project, simply by copying the files in that directory to another location on disk, and then running bazel build //... from inside the new directory. Each sample app demonstrates diverse functionality supported by Gust, including supported languages and use cases, and at least one holistic application:

  • rest_mvc (Java): Example of RESTful servers with Micronaut.
  • soy_ssr (Java): Server-side-rendered pages with Soy and Micronaut.
  • node_mvc (TypeScript/JS): Server-side MVC app running in Node
  • todolist (Java/Closure): Full holistic app example (see below for more)

Todolist App (Demo)


Until this framework is out of beta, the below is a list of goals, not a current feature-list.


The richest and best example app is Todolist, which is designed to be an example SaaS startup in a box. This includes a server app, a web app, mobile apps (for Android and iOS), and full-blown declarative infrastructure to support it all. The app includes the following components and features:

  • Devops toolkit
    • Support for testing in each language, with coverage
    • Easy support for debugging the backend or frontend apps
    • Coverage reporting to Codecov
    • CI with Buildkite and GCB
    • Support for Google Cloud's RBE/RCE tools for shared build caching
  • Hosting and serving via GKE/GCLB
    • Seamless production deployment from CI
    • All-declarative infrastructure, from scratch
    • Anycast hosting (IPv4 and IPv6) with Cloud CDN support
    • Canary and blue/green deployment support
    • Rich error reporting and production debugging/logging
  • Server-side app written in Java and Micronaut
    • Central schema via Protobuf
    • SSR-based page serving with Soy
    • Schema-driven gRPC services with seamless Firebase auth
    • JSON/REST and Protobuf service invocation, via Endpoints Service Proxy (ESP) and Envoy
    • Seamless GraphQL support atop Protobuf/gRPC with Rejoiner
    • Automatic schema-driven object storage and querying via Firestore
    • Caching support via JSR-107 (JCache) and Redis
    • Packaging via Docker with intelligent layering
    • Native image support via GraalVM
    • Rich support for frontend security and performance features
      • Content Security Policy (CSP), with automatic JS nonces
      • Style rewriting for CSS classes and IDs via Soy
  • Client-side app written in Closure and J2CL
  • Android and iOS apps
    • Generated workspace support via Bazel (Xcode/IntelliJ IDEA/Android Studio)
    • Secure and declarative signing key material, via Cloud KMS
    • Seamless CI, CD, and release deployment (via App Store Connect and the Playstore)
    • Automatic service invocation wiring via Dagger and SwiftGRPC

Contributing

To build the framework, you'll need Bazel/Bazelisk and a standard toolchain of stuff (C/C++ compilers, Docker, JDK 11+, Git, and so on). Bazel should tell you what you need if it can't fetch it for you. Otherwise, file a bug on this repo if you have trouble building the framework itself.

Most development tasks on the framework involve the Makefile, which offers convenient invocation of common dev tools, including Bazelisk and ibazel. Running make help shows the commands supported, and generally returns something like this:

$ make help

GUST Framework Tools:
all                            Build and test all framework targets.
bases                          Build base images and push them.
build                          Build all framework targets.
builder-image                  Build a new version of the CI builder image for Gust.
clean-docs                     Clean built documentation.
clean-reports                  Clean built reports.
clean                          Clean ephemeral targets.
decrypt                        Decrypt private key material.
dev                            Develop against the specified target.
devtools                       Install local development dependencies.
distclean                      Clean targets, caches and dependencies.
docs                           Build documentation for the framework.
encrypt                        Encrypt private key material.
forceclean                     Clean everything, and sanitize the codebase (DANGEROUS).
help                           Show this help text.
release-images                 Pull, tag, and release Docker images.
report-coverage                Report coverage results to Codecov.
report-tests                   Report test results to Report.CI.
run                            Run the specified target.
samples                        Build and push sample app images.
serve-coverage                 Serve the current coverage report (must generate first).
serve-docs                     Serve the docs locally (must generate first).
test                           Run all framework testsuites.
update-deps                    Re-seal and update all dependencies.

Obviously, decrypting keys or pushing release images may require permissions, however there should be no barrier to simple dev tasks like building the framework, building sample apps, and so on.

Licensing

Below we specify licensing details for the Gust/Elide framework, including pointers to licenses for any dependent software. Gust/Elide itself is licensed under the Prosperity Public License 2.0.0, which is enclosed in the LICENSE.txt file. Licenses for any dependent software (as required/applicable) are embedded in the LICENSES/ directory, each within their own text file named for the software or framework.

  • Gust/Elide: Prosperity License
  • rules_closure: Apache 2.0 (Entry 1 in LICENSES.txt)
  • gRPC Gateway: Roughly Apache 2.0 (Entry 2 in LICENSES.txt)