Metadata-Version: 2.1
Name: scw-serverless
Version: 0.0.2
Summary: An API framework to make it easy to work with Scaleway Serverless functions.
License: MIT License
        
        Copyright (c) 2022 Scaleway
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: documentation, https://serverless-api-project.readthedocs.io/en/latest/
Project-URL: repository, https://github.com/scaleway/serverless-api-project
Keywords: serverless,scaleway,functions,cloud
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Internet
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click (>=8)
Requires-Dist: PyYAML (>=6)
Requires-Dist: scaleway (>=0.2)
Requires-Dist: setuptools (>=61)
Requires-Dist: requests (>=2)
Requires-Dist: typing-extensions ; python_version < "3.11"

# Serverless API Framework

Serverless API Framework is a tool that lets you write and deploy serverless functions in python.
It bridges your code with the deployment configuration to make it a breeze to work with serverless functions.

Starts by defining a simple Python function:

```python
from scw_serverless import Serverless

app = Serverless("hello-namespace")

@app.func(memory_limit=256)
def hello_world(event, context):
    return "Hello World!"
```

Deploy it with `scw_serverless`:

```console
scw-serverless deploy app.py
```

## Quickstart

### Install

```console
pip install scw_serverless
```

This will install `scw-serverless`:

```console
scw-serverless --help
```

### Writing and configuring functions

You can transform your python functions into serverless functions by using decorators:

```python
import os
import requests
from scw_serverless import Serverless

app = Serverless("hello-namespace")
API_URL = os.environ["API_URL"]

@app.func(memory_limit=256, env={"API_URL": API_URL})
def hello_world(event, context):
    return requests.get(API_URL)
```

The configuration is done by passing arguments to the decorator.
To view which arguments are supported, head over to this [documentation](https://serverless-apifw-docs.s3-website.fr-par.scw.cloud/configuring.html) page.

When you are ready, you can deploy your function with the `scw-serverless` CLI tool:

```console
scw-serverless deploy app.py
```

The tool will use your Scaleway credentials from your environment and config file.

## What’s Next?

To learn more about the framework, have a look at the [documentation](https://serverless-apifw-docs.s3-website.fr-par.scw.cloud/index.html).
If you want to see it in action, we provide some [examples](https://github.com/scaleway/serverless-api-project/tree/main/examples) to get you started.

## Contributing

We welcome all contributions.

This project uses [pre-commit](https://pre-commit.com/) hooks to run code quality checks locally. We recommended installing them before contributing.

```console
pre-commit install
```
