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
File details
Details for the file ycf_tools-0.1.8.tar.gz
.
File metadata
- Download URL: ycf_tools-0.1.8.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.8.0-40-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0069f97af9f7b312217dd5c7aaf81bc07047db9681a965ee6392d5a363f850f7 |
|
MD5 | bdc02a7c8ff953c73290e50175baa1c0 |
|
BLAKE2b-256 | 5bab8f0f9396ae6b1f4bb552d91014a0f7d46c6a44f17e1249e0470bffe62de8 |
File details
Details for the file ycf_tools-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: ycf_tools-0.1.8-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.8.0-40-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4fce582a2483702dbfadd7d2f385b00ead5b40e6d13523e83778468659d0938 |
|
MD5 | 46cec234dce3321b37a88e440c87dee3 |
|
BLAKE2b-256 | da8054ca971ef87a7c94533a79c0ccff61b187d0e2d4a2ba1187554408f7bbdc |