Tools for developing Yandex Cloud Functions in Python
Project description
Yandex Cloud Functions Tools for Python
Tools for developing Yandex cloud functions in Python
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ycf_tools-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4fce582a2483702dbfadd7d2f385b00ead5b40e6d13523e83778468659d0938 |
|
MD5 | 46cec234dce3321b37a88e440c87dee3 |
|
BLAKE2b-256 | da8054ca971ef87a7c94533a79c0ccff61b187d0e2d4a2ba1187554408f7bbdc |