Skip to main content

Tools for developing Yandex Cloud Functions in Python

Project description

Yandex Cloud Functions Tools for Python

Tools for developing Yandex cloud functions in Python

PyPI PyPI - Python Version GitLab last commit Docs

Test coverage Downloads GitLab stars

Functionality

  • Support for type hints
  • Wrapper for convenient request handling
  • Sentry integration

Installation

pip install ycf-tools

or add ycf-tools in requirements.txt

Quick start

# module.py

from ycf import YcfServer, Context, HttpRequest

class Server(YcfServer):
    async def http_request_handler(self, context: Context, request: HttpRequest):
        return 'OK'
    

server = Server()

# entrypoint -> module.server

Deployment

If you are using Python to work with Yandex Cloud Functions, we recommend using the poetry-ycf-plugin, which allows you to deploy a new version of your function with a single command. It also offers easy integration with CI/CD systems.

Step №0

Install poetry and get authorized_key.json

Step №1

poetry self add poetry-ycf-plugin

Step №2

Configure your deployment through pyproject.toml, .env or environment variables. List of variables in documentation

Step №3

poetry ycf-deploy

Integrations

Sentry

ycf-tools is ready to send errors and traces to your Sentry. To do this, you need to install the sentry-sdk and initialize it.

# pip install sentry-sdk
import sentry_sdk

from ycf import YcfServer, Context, HttpRequest

class Server(YcfServer):
    async def http_request_handler(self, context: Context, request: HttpRequest):
        return 'OK'

server = Server()

sentry_sdk.init(
    dsn=...,
    traces_sample_rate=1.0,
)

Contribute

Issue Tracker: https://gitlab.com/rocshers/python/ycf-tools/-/issues
Source Code: https://gitlab.com/rocshers/python/ycf-tools

Before adding changes:

make install-dev

After changes:

make format test

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ycf_tools-0.1.8.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

ycf_tools-0.1.8-py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page