# Yandex Cloud Functions Tools for Python
Tools for developing Yandex cloud functions in Python
[![PyPI](https://img.shields.io/pypi/v/ycf-tools)](https://pypi.org/project/ycf-tools/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ycf-tools)](https://pypi.org/project/ycf-tools/)
[![GitLab last commit](https://img.shields.io/gitlab/last-commit/rocshers/python/ycf-tools)](https://gitlab.com/rocshers/python/ycf-tools)
[![Docs](https://img.shields.io/badge/docs-exist-blue)](https://projects.rocshers.com/open-source/ycf-tools)
[![Test coverage](https://codecov.io/gitlab/rocshers:python/ycf-tools/graph/badge.svg)](https://codecov.io/gitlab/rocshers:python/ycf-tools)
[![Downloads](https://static.pepy.tech/badge/ycf-tools)](https://pepy.tech/project/ycf-tools)
[![GitLab stars](https://img.shields.io/gitlab/stars/rocshers/python/ycf-tools)](https://gitlab.com/rocshers/python/ycf-tools)
## 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
```python
# 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`](https://pypi.org/project/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`](https://yandex.cloud/docs/iam/concepts/authorization/key)
### Step №1
```bash
poetry self add poetry-ycf-plugin
```
### Step №2
Configure your deployment through `pyproject.toml`, `.env` or `environment variables`. List of variables in [documentation](https://projects.rocshers.com/poetry-ycf-plugin/configure)
### Step №3
```bash
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.
```python
# 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:
```bash
make install-dev
```
After changes:
```bash
make format test
```
Raw data
{
"_id": null,
"home_page": "https://projects.rocshers.com/open-source/ycf-tools",
"name": "ycf-tools",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.12",
"maintainer_email": null,
"keywords": null,
"author": "Aleksei Marusich",
"author_email": "aleksei.marusich@rocshers.com",
"download_url": "https://files.pythonhosted.org/packages/5b/ab/8f0f9396ae6b1f4bb552d91014a0f7d46c6a44f17e1249e0470bffe62de8/ycf_tools-0.1.8.tar.gz",
"platform": null,
"description": "# Yandex Cloud Functions Tools for Python\n\nTools for developing Yandex cloud functions in Python\n\n[![PyPI](https://img.shields.io/pypi/v/ycf-tools)](https://pypi.org/project/ycf-tools/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ycf-tools)](https://pypi.org/project/ycf-tools/)\n[![GitLab last commit](https://img.shields.io/gitlab/last-commit/rocshers/python/ycf-tools)](https://gitlab.com/rocshers/python/ycf-tools)\n[![Docs](https://img.shields.io/badge/docs-exist-blue)](https://projects.rocshers.com/open-source/ycf-tools)\n\n[![Test coverage](https://codecov.io/gitlab/rocshers:python/ycf-tools/graph/badge.svg)](https://codecov.io/gitlab/rocshers:python/ycf-tools)\n[![Downloads](https://static.pepy.tech/badge/ycf-tools)](https://pepy.tech/project/ycf-tools)\n[![GitLab stars](https://img.shields.io/gitlab/stars/rocshers/python/ycf-tools)](https://gitlab.com/rocshers/python/ycf-tools)\n\n## Functionality\n\n- Support for type hints\n- Wrapper for convenient request `handling`\n- Sentry integration\n\n## Installation\n\n`pip install ycf-tools`\n\nor add `ycf-tools` in `requirements.txt`\n\n## Quick start\n\n```python\n# module.py\n\nfrom ycf import YcfServer, Context, HttpRequest\n\nclass Server(YcfServer):\n async def http_request_handler(self, context: Context, request: HttpRequest):\n return 'OK'\n \n\nserver = Server()\n\n# entrypoint -> module.server\n```\n\n## Deployment\n\nIf you are using Python to work with Yandex Cloud Functions, we recommend using the [`poetry-ycf-plugin`](https://pypi.org/project/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.\n\n### Step \u21160\n\nInstall `poetry` and get [`authorized_key.json`](https://yandex.cloud/docs/iam/concepts/authorization/key)\n\n### Step \u21161\n\n```bash\npoetry self add poetry-ycf-plugin\n```\n\n### Step \u21162\n\nConfigure your deployment through `pyproject.toml`, `.env` or `environment variables`. List of variables in [documentation](https://projects.rocshers.com/poetry-ycf-plugin/configure)\n\n### Step \u21163\n\n```bash\npoetry ycf-deploy\n```\n\n## Integrations\n\n### Sentry\n\n`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.\n\n```python\n# pip install sentry-sdk\nimport sentry_sdk\n\nfrom ycf import YcfServer, Context, HttpRequest\n\nclass Server(YcfServer):\n async def http_request_handler(self, context: Context, request: HttpRequest):\n return 'OK'\n\nserver = Server()\n\nsentry_sdk.init(\n dsn=...,\n traces_sample_rate=1.0,\n)\n```\n\n## Contribute\n\nIssue Tracker: <https://gitlab.com/rocshers/python/ycf-tools/-/issues> \nSource Code: <https://gitlab.com/rocshers/python/ycf-tools>\n\nBefore adding changes:\n\n```bash\nmake install-dev\n```\n\nAfter changes:\n\n```bash\nmake format test\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Tools for developing Yandex Cloud Functions in Python",
"version": "0.1.8",
"project_urls": {
"Homepage": "https://projects.rocshers.com/open-source/ycf-tools",
"Repository": "https://gitlab.com/rocshers/python/ycf-tools"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "da8054ca971ef87a7c94533a79c0ccff61b187d0e2d4a2ba1187554408f7bbdc",
"md5": "46cec234dce3321b37a88e440c87dee3",
"sha256": "b4fce582a2483702dbfadd7d2f385b00ead5b40e6d13523e83778468659d0938"
},
"downloads": -1,
"filename": "ycf_tools-0.1.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "46cec234dce3321b37a88e440c87dee3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.12",
"size": 6462,
"upload_time": "2024-09-28T13:44:57",
"upload_time_iso_8601": "2024-09-28T13:44:57.934099Z",
"url": "https://files.pythonhosted.org/packages/da/80/54ca971ef87a7c94533a79c0ccff61b187d0e2d4a2ba1187554408f7bbdc/ycf_tools-0.1.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5bab8f0f9396ae6b1f4bb552d91014a0f7d46c6a44f17e1249e0470bffe62de8",
"md5": "bdc02a7c8ff953c73290e50175baa1c0",
"sha256": "0069f97af9f7b312217dd5c7aaf81bc07047db9681a965ee6392d5a363f850f7"
},
"downloads": -1,
"filename": "ycf_tools-0.1.8.tar.gz",
"has_sig": false,
"md5_digest": "bdc02a7c8ff953c73290e50175baa1c0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.12",
"size": 5978,
"upload_time": "2024-09-28T13:44:58",
"upload_time_iso_8601": "2024-09-28T13:44:58.995924Z",
"url": "https://files.pythonhosted.org/packages/5b/ab/8f0f9396ae6b1f4bb552d91014a0f7d46c6a44f17e1249e0470bffe62de8/ycf_tools-0.1.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-28 13:44:58",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "rocshers",
"gitlab_project": "python",
"lcname": "ycf-tools"
}