Goblet is an easy-to-use framework that enables developers to quickly spin up fully featured REST APIs with python on GCP

Overview

GOBLET

PyPI PyPI - Python Version Tests codecov

Goblet is a framework for writing serverless rest apis in python in google cloud. It allows you to quickly create and deploy python apis backed by cloudfunctions.

It provides:

  • A command line tool for creating, deploying, and managing your api
  • A decorator based API for integrating with GCP API Gateway, Storage, Cloudfunctions, PubSub, Scheduler, and other GCP services.
  • Local environment for your api endpoints
  • Dynamically generated openapispec
  • Support for multiple stages

You can create Rest APIs:

from goblet import Goblet, jsonify

app = Goblet(function_name="goblet_example")

@app.route('/home')
def home():
    return {"hello": "world"}

@app.route('/home/{id}', methods=["POST"])
def post_example(id: int) -> List[int]:
    return jsonify([id])

Once you've written your code, you just run goblet deploy and Goblet takes care of deploying your app.

$ goblet deploy -l us-central1
...
https://api.uc.gateway.dev

$ curl https://api.uc.gateway.dev/home
{"hello": "world"}

Installation

To install goblet, open an interactive shell and run:

pip install goblet-gcp

Make sure to have the correct services enabled in your gcp project depending on what you want to deploy

api-gateway, cloudfunctions, storage, pubsub, scheduler

You will also need to install gcloud cli for authentication

QuickStart

In this tutorial, you'll use the goblet command line utility to create and deploy a basic REST API. This quickstart uses Python 3.7. You can find the latest versions of python on the Python download page.

To install Goblet, we'll first create and activate a virtual environment in python3.7:

$ python3 --version
Python 3.7.3
$ python3 -m venv venv37
$ . venv37/bin/activate

Next we'll install Goblet using pip:

python3 -m pip install goblet-gcp

You can verify you have goblet installed by running:

$ goblet --help
Usage: goblet [OPTIONS] COMMAND [ARGS]...
...

Credentials

Before you can deploy an application, be sure you have credentials configured. You should run gcloud auth application-default login and sign in to the desired project.

When setting the defaut location note that api-gateway is only available in asia-east1, europe-west1, us-east-1 and us-central1.

Creating Your Project

create your project directory, which should include an main.py and a requirements.txt. Make sure requirements.txt includes goblet-gcp

$ ls -la
drwxr-xr-x   .goblet
-rw-r--r--   main.py
-rw-r--r--   requirements.txt

You can ignore the .goblet directory for now, the two main files we'll focus on is app.py and requirements.txt.

Let's take a look at the main.py file:

from goblet import Goblet

app = Goblet(function_name="goblet_example")

@app.route('/home')
def home():
    return {"hello": "world"}

This app will deploy an api with endpoint /home.

Running Locally

Running your functions locally for testing and debugging is easy to do with goblet. First set a local param in the goblet class

from goblet import Goblet

app = Goblet(function_name="goblet_example", local='test')

Then run goblet local test and replace test with whatever variable you decide to use. Now you can hit your functions endpoint at localhost:8080 with your routes.

Deploying

Let's deploy this app. Make sure you're in the app directory and run goblet deploy making sure to specify the desired location:

$ goblet deploy -l us-central1
INFO:goblet.deployer:zipping function......
INFO:goblet.deployer:uploading function zip to gs......
INFO:goblet.deployer:function code uploaded
INFO:goblet.deployer:creating cloudfunction......
INFO:goblet.deployer:deploying api......
INFO:goblet.deployer:api successfully deployed...
INFO:goblet.deployer:api endpoint is goblet-example-yol8sbt.uc.gateway.dev

You now have an API up and running using API Gateway and cloudfunctions:

$ curl https://goblet-example-yol8sbt.uc.gateway.dev/home
{"hello": "world"}

Try making a change to the returned dictionary from the home() function. You can then redeploy your changes by running golet deploy.

Next Steps

You've now created your first app using goblet. You can make modifications to your main.py file and rerun goblet deploy to redeploy your changes.

At this point, there are several next steps you can take.

Docs - Goblet Documentation

If you're done experimenting with Goblet and you'd like to cleanup, you can use the goblet destroy command making sure to specify the desired location, and Goblet will delete all the resources it created when running the goblet deploy command.

$ goblet destroy -l us-central1
INFO:goblet.deployer:destroying api gateway......
INFO:goblet.deployer:api configs destroying....
INFO:goblet.deployer:apis successfully destroyed......
INFO:goblet.deployer:deleting google cloudfunction......
INFO:goblet.deployer:deleting storage bucket......

Docs

Goblet Documentation

Blog Posts

Building Python Serverless Applications on GCP

Tutorial: Publishing GitHub Findings to Security Command Center

Examples

Goblet Examples

Issues

Please file any issues, bugs or feature requests as an issue on our GitHub page.

Github Action

Goblet Github Action

Roadmap

Integration Tests
Api Gateway Auth
Configuration Options (function names, ...)
Use checksum for updates
☐ Generate Openapi clients
User generated dataclasses for openapi spec
Scheduler trigger
Pub Sub trigger
Cloud Storage trigger
Firestore trigger
Firebase trigger
Cloud Tasks trigger
Cloud Endpoints trigger

Want to Contribute

If you would like to contribute to the library (e.g. by improving the documentation, solving a bug or adding a cool new feature) submit a pull request.

Want to Support

Buy Me A Coffee


Based on chalice

Comments
  • Tutorial of `@app.route('/')` with authentication

    Tutorial of `@app.route('/')` with authentication

    I'm trying to setup a Cloud Function with multiple routes. The endpoint must be private but I don't really know much about authentication in Google Cloud. I've spend a lot of time reading Goblet docs Authentication Topic and all mentioned Google Docs + intensive research but I'm not sure how I should proceed : Do I have to setup something else in GCP ? (IAP, 0Auth) ?

    documentation question 
    opened by amirbtb 15
  • [FEATURE REQUEST] Build/Push docker image to external registry

    [FEATURE REQUEST] Build/Push docker image to external registry

    Description (what): I'd like to be able to build my docker image for cloud run using goblet and push it to an external artifact registry (outside of the one being deployed) and then have goblet deploy from that registry.

    Motivation (why): As a developer, I'd like to keep all of my artifacts in one central registry.

    How is this currently done?: Currently, if we deploy to a project, the artifact will be built in that projects artifact registry. In order to circumvent this, we need to do a docker build/push and then specify what image to use.

    Impact: Requires additional steps and glue during our CI/CD process

    Suggest a solution (optional): In .goblet/config.json add a field for the artifact registry to push to and deploy from

    {
        "cloudrun":{
            "max-instances": "1",
            "artifact_registry":"us-east1-docker.pkg.dev/gcp_project/artifact_name/image_name",
            "cpu": "1",
            "memory": "256Mi",
            "service-account": "[email protected]",
            "timeout": "3600",
            "vpc-connector": "projects/foo/locations/us-east1/connectors/connector"
        }
    }
    

    During the deploy process, have goblet build and push the image to that registry (potentially with a tag provided by the developer) and then once that image has been built, have goblet deploy to the cloud run specified in goblet deploy -p shazbot -l us-east1

    Potentially related issues:

    https://github.com/goblet/goblet/issues/163 - requests using the GCP client libraries which will require a separation of building and deploying.

    opened by eahrend 11
  • Bug: `0.9.0 ModuleNotFoundError: No module named 'goblet.infrastructures'`

    Bug: `0.9.0 ModuleNotFoundError: No module named 'goblet.infrastructures'`

    Hi. I just tried to update from version 0.8.4 to 0.9.0, and I get this error when I try to run goblet deploy:

    Run poetry run goblet deploy --location europe-north1
    Traceback (most recent call last):
      File "/home/runner/.cache/pypoetry/virtualenvs/bucket-to-bigquery-85QkY9Aq-py3.10/bin/goblet", line 5, in <module>
        from goblet.cli import main
      File "/home/runner/.cache/pypoetry/virtualenvs/bucket-to-bigquery-85QkY9Aq-py3.10/lib/python3.10/site-packages/goblet/__init__.py", line 1, in <module>
        from goblet.app import Goblet, jsonify, goblet_entrypoint  # noqa: F401
      File "/home/runner/.cache/pypoetry/virtualenvs/bucket-to-bigquery-85QkY9Aq-py3.10/lib/python3.10/site-packages/goblet/app.py", line 7, in <module>
        from goblet.decorators import Register_Handlers
      File "/home/runner/.cache/pypoetry/virtualenvs/bucket-to-bigquery-85QkY9Aq-py3.10/lib/python3.10/site-packages/goblet/decorators.py", line 8, in <module>
        from goblet.infrastructures.redis import Redis
    ModuleNotFoundError: No module named 'goblet.infrastructures'
    Error: Process completed with exit code 1.
    

    Anything I can do about this, or is this something that should be fixed on your end?

    bug 
    opened by rasnes 9
  • Add optional argument to keep last version of archive + delete archive in Cloud Storage when deleting the function

    Add optional argument to keep last version of archive + delete archive in Cloud Storage when deleting the function

    Hello,

    I noticed that the bucket used to store Cloud Function archives contains all the versions of all cloud functions deployed in the project. The number of objets is quite big after a couple of dev/try/test deployments.

    Feature request :

    • add an optional argument to goblet deploy to delete the previous version of the archive in Cloud Storage
    • add an optional argument to goblet destroy to delete the archive of the function in Cloud Storage

    Thanks !

    proposal 
    opened by amirbtb 8
  • Create multiple cloud scheduler to call the same function

    Create multiple cloud scheduler to call the same function

    Hello,

    I am working on a simple use case : I have a cloud function that accepts a 'URl' parameter, calls that URl (which is a public API endpoint) and saves the data in a JSON file stored in Cloud Storage. I want to be able to set multiple cloud scheduler to call different endpoints on different schedules, but I only need 1 function.

    Question : My guess is that @app.schedule('5 * * * *') creates both a Cloud Scheduler and a Cloud Function. Is there a possibility to only create a (or multiple) Cloud Scheduler and define parameters to use in the call to the Cloud Function ?

    enhancement question 
    opened by amirbtb 7
  • [Secret Manager] Secret Manager Integration

    [Secret Manager] Secret Manager Integration

    A built in integration with Secret Manager to inject secrets into cloudfunctions. Currently the options are to supply env variable, or to write the secret manager logic yourself.

    example config.json

    "secrets": {
      "GH_TOKEN": projects/{project_id}/secrets/GH_TOKEN/versions/2",
      "OTHER_TOKEN"
    }
    

    with default being projects/{project_id}/secrets/{secret_name}/versions/latest

    then in your code you would use config.secrets to access

    from goblet.config import Config
    
    config = Config()
    @app.route("/reveal")
    def reveal_secret():
        return config.secrets.GH_TOKEN
    
    proposal 
    opened by anovis 7
  • [Cloudrun backend] Missing None. Make sure you are in the correct directoty and this file exists

    [Cloudrun backend] Missing None. Make sure you are in the correct directoty and this file exists

    Hi, first of all, thanks for your work ! I use Goblet for cloud functions and it's very simple. But when I try to use cloud run as a backend, I have the error : "Missing None. Make sure you are in the correct directoty and this file exists" while I have a main.py and a dockerfile in the directory.

    Any idea of what can be the issue ? Thanks in advance, Regards

    bug documentation 
    opened by mikaelcoumet 6
  • Allow other files in zip along with *.py files

    Allow other files in zip along with *.py files

    Config parameters are usually stored in .ini or .txt files. Can we allow .ini and .txt files atleast?

    https://github.com/anovis/goblet/blob/61a8ce2e4e1ff8d3967d79437573843f5c88c389/goblet/deploy.py#L157

    enhancement 
    opened by ivmarkp 6
  • `TypeError: main_handler() takes 1 positional argument but 2 were given` with `@app.topic('mytopic')`

    `TypeError: main_handler() takes 1 positional argument but 2 were given` with `@app.topic('mytopic')`

    Hello,

    I created a topic in PubSub called mytopic and I tried to create a function triggered by a message in this topic. The deployment is successful but after I publish a message, I get a TypeError: dbt_handler() takes 1 positional argument but 2 were given. Here is the code of my function and the error traceback :

    Function code

    from goblet import Goblet
    
    app = Goblet(function_name="goblet-pubsub")
    
    
    @app.topic('mytopic')
    def main_handler(data):
        app.log.info(data)
        return 
    

    Error traceback

    2021-11-11T15:20:13.051Z goblet-pubsub-topic-mytopic6gbe9k87mz0j 
    Exception on / [POST] Traceback (most recent call last): 
    File "/layers/google.python.pip/pip/lib/python3.7/site-packages/flask/app.py", line 2073, in wsgi_app response
        = self.full_dispatch_request() 
    File "/layers/google.python.pip/pip/lib/python3.7/site-packages/flask/app.py", line 1518, in full_dispatch_request 
        rv = self.handle_user_exception(e) 
    File "/layers/google.python.pip/pip/lib/python3.7/site-packages/flask/app.py", line 1516, in full_dispatch_request 
        rv = self.dispatch_request() 
    File "/layers/google.python.pip/pip/lib/python3.7/site-packages/flask/app.py", line 1502, in dispatch_request 
        return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) 
    File "/layers/google.python.pip/pip/lib/python3.7/site-packages/functions_framework/__init__.py", line 171, in view_func 
        function(data, context) TypeError: main_handler() takes 1 positional argument but 2 were given
    
    Exception on / [POST] Traceback (most recent call last): 
    File "/layers/google.python.pip/pip/lib/python3.7/site-packages/flask/app.py", line 2073, in wsgi_app response 
        = self.full_dispatch_request() 
    File "/layers/google.python.pip/pip/lib/python3.7/site-packages/flask/app.py", line 1518, in full_dispatch_request 
        rv = self.handle_user_exception(e) 
    File "/layers/google.python.pip/pip/lib/python3.7/site-packages/flask/app.py", line 1516, in full_dispatch_request 
        rv = self.dispatch_request() 
    File "/layers/google.python.pip/pip/lib/python3.7/site-packages/flask/app.py", line 1502, in dispatch_request 
        return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) 
    File "/layers/google.python.pip/pip/lib/python3.7/site-packages/functions_framework/__init__.py", line 171, in view_func 
        function(data, context) 
    
    TypeError: main_handler() takes 1 positional argument but 2 were given
    

    What am I supposed to provided to main_handler ?

    Thank you !

    opened by amirbtb 5
  • Cloud run jobs not correctly interfacing with cloud logging

    Cloud run jobs not correctly interfacing with cloud logging

    When using logging like in the cloud run jobs tutorial, like: app.log.info(f"job...{id}")

    In cloud logging, this is being interpreted as print statements / stdout, not actually structured cloud logging. image

    Not a huge deal, but structured logging is nice to have

    enhancement 
    opened by AdeelK93 4
  • Cloud Run Jobs customization

    Cloud Run Jobs customization

    Hi I'm trying to customize a few things about the cloud run jobs deployment, but can't find any documentation or examples on how to change:

    • cpu/memory resources
    • timeout
    • number of retries
    • VPC connector
    • total number of tasks

    Would love some help! Thanks

    documentation 
    opened by AdeelK93 4
  • [Cloudrun] Unable to attach cloudsql connector

    [Cloudrun] Unable to attach cloudsql connector

    Looking at the docs it looks like the sql connector should be added as an annotation as below. But it seems to not be working. Works with the cloudrun jobs it seems.

            "run.googleapis.com/cloudsql-instances": "projects/PROJECT/locations/LOCATION/connectors/SQL_CONNECTION",
    
    bug documentation 
    opened by anovis 0
  • Resource: Alerts

    Resource: Alerts

    New Alert Resource (closes #278)

    You can deploy alerts related to your application by using the alert method. Each alert takes a name and a list of conditions. Notification channels can be added to the alerts.notification_channel key in config.json or explicity in the alert. The base AlertCondition class allows you to fully customize your alert based on the fields privided by the GCP Alert Resource

    If you do not need a fully customized alert you can use the built in classes for MetricCondition, LogMatchCondition, and CustomMetricCondition. These come with defaults in terms of duration and aggregations, but can be overriden as needed. The CustomMetricCondition creates a custom metric based on the filter provided and then creates an alert using that metric.

    from goblet.resources.alerts import MetricCondition,LogMatchCondition,CustomMetricCondition
    app = Goblet()
    
    # Example Metric Alert for the cloudfunctin metric execution_count with a threshold of 10
    app.alert("metric",conditions=[MetricCondition("test", metric="cloudfunctions.googleapis.com/function/execution_count", value=10)])
    
    # Example Log Match metric that will trigger an incendent off of any Error logs
    app.alert("error",conditions=[LogMatchCondition("error", "severity>=ERROR")])
    
    # Example Metric Alert that creates a custom metric for severe errors with http code in the 500's and creates an alert with a threshold of 10
    app.alert("custom",conditions=[CustomMetricCondition("custom", metric_filter='severity=(ERROR OR CRITICAL OR ALERT OR EMERGENCY) httpRequest.status=(500 OR 501 OR 502 OR 503 OR 504)', value=10)])
    
    opened by anovis 0
  • [Documentation] Feedback for Improvements

    [Documentation] Feedback for Improvements

    I am planning on revisiting some of the documentation and am starting to gather feedback for areas that can be improved.

    Areas I plan on focusing on initially will be

    • Contributor documentation
    • Config.json examples
    • Adding examples of all resources in the main readme.

    Feel free to comment with other areas you would like to see improved.

    documentation 
    opened by anovis 0
  • Cloudtrace plugin

    Cloudtrace plugin

    Addresses #110

    This PR is not propagating spans correctly.

    for tracing information see the following...

    https://opentelemetry.io/docs/instrumentation/python/manual/ https://cloud.google.com/trace/docs/setup#instrumenting_tracing_for_applications https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/init.py

    opened by anovis 2
  • Issue with config's and stages

    Issue with config's and stages

    Looks like the config in get_timeout is not correctly getting the staged values.

    for example

    "stages":{
    "dev":{
                "api_gateway":{
                    "deadline":3600
               } }},
               
    

    in a stage doesn't work

    but on the main route it works as expected.

    "api_gateway":{
                    "deadline":3600
               }
    
    bug 
    opened by anovis 1
  • Bigquery integration

    Bigquery integration

    I'd like to propose a new integration/decorator - bigquery. Remote functions are recently GA.

    Basically, this would be similar to the app.post decorator, but also:

    • create a cloud_resource connection (if it doesn't exist), sharing the name of the goblet app
    • register the cloud function or cloud run as a remote function in bigquery
    • require the user to provide the name of the BQ remote function to create, as well as the function type signature

    Interested in feedback on the idea!

    proposal 
    opened by AdeelK93 3
Releases(0.9.3)
  • 0.9.3(Dec 19, 2022)

    What's Changed

    • Add plugins section to docs by @anovis in https://github.com/goblet/goblet/pull/284
    • update cloudrun secrets documentation by @dennismutia in https://github.com/goblet/goblet/pull/286
    • pubsub message ordering added to immutable keys by @brianhlee in https://github.com/goblet/goblet/pull/289
    • Backend http endpoint by @anovis in https://github.com/goblet/goblet/pull/290
    • [Routes] Pass through custom deadline field by @anovis in https://github.com/goblet/goblet/pull/292
    • [Local] Add set-env flag to goblet local command by @anovis in https://github.com/goblet/goblet/pull/295
    • Bugfix for cloudfunction backend by @anovis in https://github.com/goblet/goblet/pull/296

    New Contributors

    • @dennismutia made their first contribution in https://github.com/goblet/goblet/pull/286

    Full Changelog: https://github.com/goblet/goblet/compare/0.9.2...0.9.3

    Source code(tar.gz)
    Source code(zip)
  • 0.9.2(Oct 31, 2022)

    What's Changed

    • Fix key error by @AdeelK93 in https://github.com/goblet/goblet/pull/265
    • Add gcloud logger by @anovis in https://github.com/goblet/goblet/pull/266
    • Add label for resources that support it by @anovis in https://github.com/goblet/goblet/pull/267
    • latest_build_source KeyError by @AdeelK93 in https://github.com/goblet/goblet/pull/268
    • Raise goblet error on cloud build failure by @anovis in https://github.com/goblet/goblet/pull/270
    • Readme + Ready Release by @anovis in https://github.com/goblet/goblet/pull/274
    • Pin protobuf version by @anovis in https://github.com/goblet/goblet/pull/275

    Full Changelog: https://github.com/goblet/goblet/compare/0.9.1...0.9.2

    Source code(tar.gz)
    Source code(zip)
  • 0.9.1(Oct 17, 2022)

    What's Changed

    • Cloudrun jobs metadata by @anovis in https://github.com/goblet/goblet/pull/262
    • add init file to infrastructures module by @jissac in https://github.com/goblet/goblet/pull/263 (fixes #261 bug in 0.9.0)

    New Contributors

    • @jissac made their first contribution in https://github.com/goblet/goblet/pull/263

    Full Changelog: https://github.com/goblet/goblet/compare/0.9.0...0.9.1

    Source code(tar.gz)
    Source code(zip)
  • 0.9.0(Oct 15, 2022)

    What's Changed

    • Bugfix252-parallel build artifacts by @anovis in https://github.com/goblet/goblet/pull/253
    • Support duplicate nested Pydantic models by @anovis in https://github.com/goblet/goblet/pull/256
    • Infrastructure Support by @qua-jones in https://github.com/goblet/goblet/pull/254
    • 0.9.0 prep by @anovis in https://github.com/goblet/goblet/pull/258

    New Features

    • Infrastructure support (currently redis and vpc connectors) #254

    Breaking Changes

    • update cli deploy flags from skip_function, only_function to skip_resources, skip_backend, skip_infra

    Full Changelog: https://github.com/goblet/goblet/compare/0.8.4...0.9.0

    Source code(tar.gz)
    Source code(zip)
  • 0.8.4(Sep 26, 2022)

    What's Changed

    • [CLI] goblet local custom port by @anovis in https://github.com/goblet/goblet/pull/244
    • Create CODE_OF_CONDUCT.md by @anovis in https://github.com/goblet/goblet/pull/246
    • Deployment vars by @anovis in https://github.com/goblet/goblet/pull/248
    • Pass in cloudrun flags, fix force by @anovis in https://github.com/goblet/goblet/pull/249
    • [OpenApi] Pydantic Support by @anovis in https://github.com/goblet/goblet/pull/240
    • fix logging by @anovis in https://github.com/goblet/goblet/pull/250
    • Add private python library example to docs by @anovis in https://github.com/goblet/goblet/pull/251

    Breaking Changes

    • request_body openapi generation takes a pydantic or marshmallow object instead of a nested dictionary

    Full Changelog: https://github.com/goblet/goblet/compare/0.8.3...0.8.4

    Source code(tar.gz)
    Source code(zip)
  • 0.8.3(Sep 14, 2022)

    What's Changed

    • Add support for content_types and tags fields for openapi spec creation by @kylejohnson514 in https://github.com/goblet/goblet/pull/234
    • requirements.txt override by @brianhlee in https://github.com/goblet/goblet/pull/236
    • Add exit 1 codes to cli by @anovis in https://github.com/goblet/goblet/pull/235
    • skip requirements.txt for cloudrun if not needed by @anovis in https://github.com/goblet/goblet/pull/237
    • [README] Add new blog post by @anovis in https://github.com/goblet/goblet/pull/238

    New Contributors

    • @kylejohnson514 made their first contribution in https://github.com/goblet/goblet/pull/234

    Full Changelog: https://github.com/goblet/goblet/compare/0.8.2...0.8.3

    Source code(tar.gz)
    Source code(zip)
  • 0.8.2(Aug 29, 2022)

    What's Changed

    • Gateway timeout by @anovis in https://github.com/goblet/goblet/pull/225
    • refresh auth credentials by @qua-jones in https://github.com/goblet/goblet/pull/227
    • Cloudrun jobs by @anovis in https://github.com/goblet/goblet/pull/231
    • MissingArtifact exception by @anovis in https://github.com/goblet/goblet/pull/233

    New Feature

    • Cloudrun Jobs Trigger

    Full Changelog: https://github.com/goblet/goblet/compare/0.8.1...0.8.2

    Source code(tar.gz)
    Source code(zip)
  • 0.8.1(Aug 20, 2022)

    What's Changed

    • Cloudbuild Timeout by @anovis in https://github.com/goblet/goblet/pull/219
    • Fix custom files by @anovis in https://github.com/goblet/goblet/pull/220
    • #119 by @brianhlee in https://github.com/goblet/goblet/pull/221
    • Default cloud run command by @AdeelK93 in https://github.com/goblet/goblet/pull/222

    Full Changelog: https://github.com/goblet/goblet/compare/0.8.0...0.8.1

    Source code(tar.gz)
    Source code(zip)
  • 0.8.0(Aug 15, 2022)

    What's Changed

    • Cloudfunction V2 support
    • Cloudrun deployment changed to allow for better configuration (see breaking change below)
    • [PubSub] pass through configuration for subscriptions

    Breaking Changes

    • Cloudrun now uses the GCP rest apis instead of the gcloud cli for deployments (#163 ). This will require changes in config.json. See exampe below for possible fields. Cloudbuild configs and traffics are now able to be specified
    {
        "cloudrun": {
            "traffic": 25
        },
        "cloudrun_revision": {
            "serviceAccount": "[email protected]"
        },
        "cloudbuild": {
            "artifact_registry": "us-central1-docker.pkg.dev/CROSS_PROJECT/cloud-run-source-deploy/SOURCE_NAME",
            "serviceAccount": "projects/PROJECT/serviceAccounts/[email protected]"
        },
        "cloudrun_container": {
            "env": [
                {
                    "name": "env-variable-name",
                    "value": "env-variable-value"
                },
                {
                    "name": "env-variable-name",
                    "valueSource": {
                        "secretKeyRef" : {
                            "secret": "secret-name",
                            "version": "secret-version"
                        }
                    }
                }
            ]
        }
    }
    
    • remove check for authentication flag by @qua-jones in https://github.com/goblet/goblet/pull/200
    • Removed unused CMD by @AdeelK93 in https://github.com/goblet/goblet/pull/202
    • Include timezone as a schedule argument by @AdeelK93 in https://github.com/goblet/goblet/pull/203
    • chore(Dockerfile): update python 3.7 -> 3.10 by @jward-premise in https://github.com/goblet/goblet/pull/206
    • [PubSub] pass through configuration for subscriptions by @qua-jones in https://github.com/goblet/goblet/pull/209
    • Split Cloud Build and Deploy and added Traffic by @luke-xue in https://github.com/goblet/goblet/pull/208
    • Bugfix: Subscription attribute filter by @anovis in https://github.com/goblet/goblet/pull/211
    • new backend classes and support for gen 2 cloudfunctions by @samdevo in https://github.com/goblet/goblet/pull/198
    • fix cloudrun delta check by @samdevo in https://github.com/goblet/goblet/pull/212
    • Fix aliasing with rueyaml dump by @anovis in https://github.com/goblet/goblet/pull/213
    • Container Config and Project ID Fix by @luke-xue in https://github.com/goblet/goblet/pull/216
    • Add waiters for api gateway destroy by @anovis in https://github.com/goblet/goblet/pull/217

    New Contributors

    • @qua-jones made their first contribution in https://github.com/goblet/goblet/pull/200
    • @AdeelK93 made their first contribution in https://github.com/goblet/goblet/pull/202
    • @jward-premise made their first contribution in https://github.com/goblet/goblet/pull/206
    • @luke-xue made their first contribution in https://github.com/goblet/goblet/pull/208
    • @samdevo made their first contribution in https://github.com/goblet/goblet/pull/198

    Full Changelog: https://github.com/goblet/goblet/compare/0.7.6...0.8.0

    Source code(tar.gz)
    Source code(zip)
  • 0.7.6(Jul 18, 2022)

    What's Changed

    • [Cloudfunction] uses python runtime by @anovis in https://github.com/goblet/goblet/pull/193
    • [Pubsub] Return Response by @anovis in https://github.com/goblet/goblet/pull/194
    • Bugfix cors args by @anovis in https://github.com/goblet/goblet/pull/195

    Full Changelog: https://github.com/goblet/goblet/compare/0.7.5...0.7.6

    Source code(tar.gz)
    Source code(zip)
  • 0.7.5(Jul 14, 2022)

    What's Changed

    • [Cloudrun] Allow port and command to be overiden by @anovis in https://github.com/goblet/goblet/pull/180
    • [Openapispec] Make operationId unique by @anovis in https://github.com/goblet/goblet/pull/184
    • [OpenAPI] openapi -v 3 option by @anovis in https://github.com/goblet/goblet/pull/186
    • Update readme to include Cloud Run by @ethanwlo in https://github.com/goblet/goblet/pull/189
    • Add preflight cors support by @anovis in https://github.com/goblet/goblet/pull/192

    New Contributors

    • @ethanwlo made their first contribution in https://github.com/goblet/goblet/pull/189

    Full Changelog: https://github.com/goblet/goblet/compare/0.7.4...0.7.5

    Source code(tar.gz)
    Source code(zip)
  • 0.7.4(Jun 9, 2022)

    What's Changed

    • Add gcloud config for cloudrun deployments by @anovis in https://github.com/goblet/goblet/pull/175

    Full Changelog: https://github.com/goblet/goblet/compare/0.7.3...0.7.4

    Source code(tar.gz)
    Source code(zip)
  • 0.7.3(May 31, 2022)

    What's Changed

    • [Openapi] Custom type support by @anovis in https://github.com/goblet/goblet/pull/168
    • Skipping tests folder when deploying function by @piusnig in https://github.com/goblet/goblet/pull/169
    • Bugfix - cloudrun + apigateway missing client by @anovis in https://github.com/goblet/goblet/pull/171
    • Pubsub subscription attributes by @anovis in https://github.com/goblet/goblet/pull/172

    New Contributors

    • @piusnig made their first contribution in https://github.com/goblet/goblet/pull/169

    Full Changelog: https://github.com/goblet/goblet/compare/0.7.2.2...0.7.3

    Source code(tar.gz)
    Source code(zip)
  • 0.7.2.2(May 18, 2022)

    What's Changed

    • Bugfix json error 2 by @anovis in https://github.com/anovis/goblet/pull/167

    Full Changelog: https://github.com/anovis/goblet/compare/0.7.2.1...0.7.2.2

    Source code(tar.gz)
    Source code(zip)
  • 0.7.2.1(May 11, 2022)

    What's Changed

    • Bugfix-json headers, gateway update by @anovis in https://github.com/anovis/goblet/pull/165

    Full Changelog: https://github.com/anovis/goblet/compare/0.7.2...0.7.2.1

    Source code(tar.gz)
    Source code(zip)
  • 0.7.2(May 2, 2022)

    What's Changed

    • Update Requirements, Tests for python 3.10 by @anovis in https://github.com/anovis/goblet/pull/161
    • Bugfix: Add is_json check by @anovis in https://github.com/anovis/goblet/pull/162

    Full Changelog: https://github.com/anovis/goblet/compare/0.7.1...0.7.2

    Source code(tar.gz)
    Source code(zip)
  • 0.7.1(Apr 18, 2022)

    What's Changed

    • [Routes] cloudrun and apigateway route_type option by @anovis in https://github.com/anovis/goblet/pull/153
    • [Sync] Fix resource permission issue by @anovis in https://github.com/anovis/goblet/pull/157
    • [Docs] Test scheduler locally by @anovis in https://github.com/anovis/goblet/pull/158

    Full Changelog: https://github.com/anovis/goblet/compare/0.7.0...0.7.1

    Source code(tar.gz)
    Source code(zip)
  • 0.7.0(Apr 1, 2022)

    What's Changed

    • Refactor Clients by @anovis in https://github.com/anovis/goblet/pull/139
    • [Documentation] Secrets Manager Integration by @anovis in https://github.com/anovis/goblet/pull/141
    • Cross project subscription by @anovis in https://github.com/anovis/goblet/pull/142
    • Fix docs related to #143 by @anovis in https://github.com/anovis/goblet/pull/144
    • [Pubsub] Fix subscription update and destroy by @anovis in https://github.com/anovis/goblet/pull/146
    • [Pubsub] Cross subscription correctly triggers by @anovis in https://github.com/anovis/goblet/pull/148
    • [EventArc] New resource by @anovis in https://github.com/anovis/goblet/pull/149

    Full Changelog: https://github.com/anovis/goblet/compare/0.6.3...0.7.0

    Source code(tar.gz)
    Source code(zip)
  • 0.6.3(Feb 22, 2022)

    What's Changed

    • [Goblet] Request Context by @anovis in https://github.com/anovis/goblet/pull/130
    • Add Before and After Middleware handlers by @anovis in https://github.com/anovis/goblet/pull/134

    Full Changelog: https://github.com/anovis/goblet/compare/0.6.1...0.6.3

    Source code(tar.gz)
    Source code(zip)
  • 0.6.1(Jan 23, 2022)

    What's Changed

    • add query support for goblet openspec generation by @davidyum in https://github.com/anovis/goblet/pull/126
    • [CLI] Goblet sync by @anovis in https://github.com/anovis/goblet/pull/127

    New Contributors

    • @davidyum made their first contribution in https://github.com/anovis/goblet/pull/126

    Full Changelog: https://github.com/anovis/goblet/compare/0.6.0...0.6.1

    Source code(tar.gz)
    Source code(zip)
  • 0.6.0(Jan 12, 2022)

    What's Changed

    • [.github] Add stale.yml config by @anovis in https://github.com/anovis/goblet/pull/106
    • Documentation for service account auth by @anovis in https://github.com/anovis/goblet/pull/114
    • Multi Cloudfunction Support by @anovis in https://github.com/anovis/goblet/pull/116
    • Cloudrun backend by @anovis in https://github.com/anovis/goblet/pull/122
    • Black formatter by @anovis in https://github.com/anovis/goblet/pull/123

    Full Changelog: https://github.com/anovis/goblet/compare/0.5.2...0.6.0

    Source code(tar.gz)
    Source code(zip)
  • 0.5.2(Nov 18, 2021)

    • Add flag --all to destroy cli command to delete all artifacts in cloud storage related to the cloudfunction. goblet destroy --all (closes #98 )
    • Custom storage cloudfunction name
    • Add test and venv directories to be excluded in zip_directory function (closes #104 )
    • Set local default to "local", so default command will be goblet local. (closes #80 )
    Source code(tar.gz)
    Source code(zip)
  • 0.5.1(Nov 12, 2021)

    • add scheduler support for retryConfig , attemptDeadline, name (closes #93 )
    • set entrypoint to goblet_entrypoint instead of app because of #88 (closes #95)
    Source code(tar.gz)
    Source code(zip)
  • 0.5.0(Nov 2, 2021)

    • multiple schedulers for one entry function (#91)
    @app.schedule('5 * * * *')
    @app.schedule('2 * * * *')
    def scheduled_function()
       app.current_request
       return
    
    • pass through custom scheduler params such as body, headers, httpMethod
    @app.schedule('5 * * * *', httpMethod='POST', headers={'X-Custom': 'header'}, body='BASE64 ENCODED STRING')
    @app.schedule('5 * * * *', httpMethod='GET', headers={'X-Custom': 'header2'}, body='BASE64 ENCODED STRING 2')
    def scheduled_function()
       app.current_request
       return
    
    • adds helper to set entrypoint. add_entrypoint (#88 )
    from goblet import Goblet, jsonify, Response, add_entrypoint
    
    app = Goblet(function_name="goblet-test-issue", local="test")
    add_entrypoint(app)
    
    @app.http()
    def main(request):
        app.log.info("triggered")
        return jsonify(request.json)
    
    Source code(tar.gz)
    Source code(zip)
  • 0.4.10.1(Sep 29, 2021)

  • 0.4.10(Sep 28, 2021)

    • Adding ability to add security definition at the method level
    @app.route('/method_security', security=[{"your_custom_auth_id": []}])
    def method_security():
        return
    
      • config-from-json-string
    goblet deploy --project PROJECT -l LOCATION --config-from-json-string '{"cloudfunction": {"serviceAccount": "[email protected]"}}'
    
    • Local logger fix
    • Bugfix for a GCP breaking change with generateUploadUr
    Source code(tar.gz)
    Source code(zip)
  • 0.4.9(Jul 19, 2021)

    • Ability to configure apiSpec using config.json, which included gatewayServiceAccount (closes #71)
        {
            "apiConfig": {
                "gatewayServiceAccount": "projects/-/serviceAccounts/ServiceAccount@PROJECT",
                "labels": {
                    "label1" : "value1"
                }
            }
        }  
    
    • Add security section to openApispec based on securityDefinitions or security field in config.json (closes #72 )

    • Cors can be set on the route level or on the Goblet application level. Setting cors=True uses the default cors setting. (closes #60 )

    app=goblet("example",cors=True)
    

    or

        @app.route('/custom_backend', cors=True)
        def home():
            return "cors headers"
    

    results in these headers

        headers : {
            "Access-Control-Allow-Headers" : ['Content-Type', 'Authorization'],
            "Access-Control-Allow-Origin": "*"
        }
    

    Use the CORSConfig class to set customized cors headers from the goblet.resources.routes class.

        from goblet.resources.routes import CORSConfig
        @app.route('/custom_cors', cors=CORSConfig(allow_origin='localhost'))
        def custom_cors():
            return jsonify('localhost is allowed')
    
    Source code(tar.gz)
    Source code(zip)
  • 0.4.8(Jun 4, 2021)

  • 0.4.7(May 20, 2021)

    • Improve get_event_type so don't need to add headers for local testing (closes #49 )
    • Skips deployment if no changes detected (closes #27 )
    • Docstrings
    Source code(tar.gz)
    Source code(zip)
  • 0.4.6(May 12, 2021)

    • iam bindings
    {
        "bindings": [
            {
                "role": "roles/cloudfunctions.invoker",
                "members": [
                "allUsers"
                ]
            }
        ]
    }
    
    • goblet init command
    • minor doc fixes
    Source code(tar.gz)
    Source code(zip)
Fully featured framework for fast, easy and documented API development with Flask

Flask RestPlus IMPORTANT NOTICE: This project has been forked to Flask-RESTX and will be maintained by by the python-restx organization. Flask-RESTPlu

Axel H. 2.5k Feb 17, 2021
The no-nonsense, minimalist REST and app backend framework for Python developers, with a focus on reliability, correctness, and performance at scale.

The Falcon Web Framework Falcon is a reliable, high-performance Python web framework for building large-scale app backends and microservices. It encou

Falconry 9k Jan 1, 2023
Pyrin is an application framework built on top of Flask micro-framework to make life easier for developers who want to develop an enterprise application using Flask

Pyrin A rich, fast, performant and easy to use application framework to build apps using Flask on top of it. Pyrin is an application framework built o

Mohamad Nobakht 10 Jan 25, 2022
Embrace the APIs of the future. Hug aims to make developing APIs as simple as possible, but no simpler.

Read Latest Documentation - Browse GitHub Code Repository hug aims to make developing Python driven APIs as simple as possible, but no simpler. As a r

Hug API Framework 6.7k Dec 27, 2022
Containers And REST APIs Workshop

Containers & REST APIs Workshop Containers vs Virtual Machines Ferramentas Podman: https://podman.io/ Docker: https://www.docker.com/ IBM CLI: https:/

Vanderlei Munhoz 8 Dec 16, 2021
Flask Sugar is a web framework for building APIs with Flask, Pydantic and Python 3.6+ type hints.

Flask Sugar is a web framework for building APIs with Flask, Pydantic and Python 3.6+ type hints. check parameters and generate API documents automatically. Flask Sugar是一个基于flask,pyddantic,类型注解的API框架, 可以检查参数并自动生成API文档

null 162 Dec 26, 2022
Chisel is a light-weight Python WSGI application framework built for creating well-documented, schema-validated JSON web APIs

chisel Chisel is a light-weight Python WSGI application framework built for creating well-documented, schema-validated JSON web APIs. Here are its fea

Craig Hobbs 2 Dec 2, 2021
An easy-to-use high-performance asynchronous web framework.

An easy-to-use high-performance asynchronous web framework.

Aber 264 Dec 31, 2022
An easy-to-use high-performance asynchronous web framework.

中文 | English 一个易用的高性能异步 web 框架。 Index.py 文档 Index.py 实现了 ASGI3 接口,并使用 Radix Tree 进行路由查找。是最快的 Python web 框架之一。一切特性都服务于快速开发高性能的 Web 服务。 大量正确的类型注释 灵活且高效的

Index.py 264 Dec 31, 2022
Endpoints is a lightweight REST api framework written in python and used in multiple production systems that handle millions of requests daily.

Endpoints Quickest API builder in the West! Endpoints is a lightweight REST api framework written in python and used in multiple production systems th

Jay Marcyes 30 Mar 5, 2022
REST API framework designed for human beings

Eve Eve is an open source Python REST API framework designed for human beings. It allows to effortlessly build and deploy highly customizable, fully f

eve 6.6k Jan 7, 2023
REST API framework designed for human beings

Eve Eve is an open source Python REST API framework designed for human beings. It allows to effortlessly build and deploy highly customizable, fully f

eve 6.3k Feb 17, 2021
Django Ninja - Fast Django REST Framework

Django Ninja is a web framework for building APIs with Django and Python 3.6+ type hints.

Vitaliy Kucheryaviy 3.8k Jan 2, 2023
An alternative serializer implementation for REST framework written in cython built for speed.

drf-turbo An alternative serializer implementation for REST framework written in cython built for speed. Free software: MIT license Documentation: htt

Mng 74 Dec 30, 2022
A Python package to easily create APIs in Python.

API_Easy An Python Package for easily create APIs in Python pip install easy-api-builder Requiremnets: <= python 3.6 Required modules --> Flask Docume

Envyre-Coding 2 Jan 4, 2022
Web APIs for Django. 🎸

Django REST framework Awesome web-browsable Web APIs. Full documentation for the project is available at https://www.django-rest-framework.org/. Fundi

Encode 24.7k Jan 3, 2023
NO LONGER MAINTAINED - A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models.

NO LONGER MAINTAINED This repository is no longer maintained due to lack of time. You might check out the fork https://github.com/mrevutskyi/flask-res

null 1k Jan 4, 2023
NO LONGER MAINTAINED - A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models.

NO LONGER MAINTAINED This repository is no longer maintained due to lack of time. You might check out the fork https://github.com/mrevutskyi/flask-res

null 1k Jan 15, 2021
Web3.py plugin for using Flashbots' bundle APIs

This library works by injecting a new module in the Web3.py instance, which allows submitting "bundles" of transactions directly to miners. This is done by also creating a middleware which captures calls to eth_sendBundle and eth_callBundle, and sends them to an RPC endpoint which you have specified, which corresponds to mev-geth.

Georgios Konstantopoulos 294 Jan 4, 2023