# Frantic
Firestore with Pydantic models integration.
Please note that this module is a work in progress. API may change over time. Also, the code is not tested yet
and there are no security checks run periodically.
## Installation
### Using `pip`
```console
pip install frantic
```
### Using `poetry`
```console
poetry add frantic
```
## Basic usage
If you have your service account key path set in `GOOGLE_APPLICATION_CREDENTIALS`, it's fairly easy:
```python
import asyncio
from typing import ClassVar
from frantic import Frantic, BaseModel
# Create a model the same way you would do it with Pydantic
class User(BaseModel):
# optionally, you may specify name of collection instances will be stored within:
collection: ClassVar = "my_users_collection"
# field 'id' is added automatically
name: str
async def main():
frantic = Frantic()
user = User(name="ijustfarted")
# Save user in the Firestore db
await frantic.add(user)
# user's id gets automatically populated and can be used to retrieve the user
retrieved = await frantic.get(User, user.id)
assert retrieved.name == user.name
# list all users
users = await frantic.list(User)
# delete user
await frantic.delete(user)
# or
await frantic.delete(User, user.id)
if __name__ == "__main__":
asyncio.run(main)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tomasvotava/frantic",
"name": "frantic",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Tomas Votava",
"author_email": "info@tomasvotava.eu",
"download_url": "https://files.pythonhosted.org/packages/f2/63/538e45e8958cf7d8af2a390b5416cee31cba53ad2e69d10c80706413d1c4/frantic-0.1.3.tar.gz",
"platform": null,
"description": "# Frantic\n\nFirestore with Pydantic models integration.\n\nPlease note that this module is a work in progress. API may change over time. Also, the code is not tested yet\nand there are no security checks run periodically.\n\n## Installation\n\n### Using `pip`\n\n```console\npip install frantic\n```\n\n### Using `poetry`\n\n```console\npoetry add frantic\n```\n\n## Basic usage\n\nIf you have your service account key path set in `GOOGLE_APPLICATION_CREDENTIALS`, it's fairly easy:\n\n```python\nimport asyncio\nfrom typing import ClassVar\nfrom frantic import Frantic, BaseModel\n\n\n# Create a model the same way you would do it with Pydantic\nclass User(BaseModel):\n # optionally, you may specify name of collection instances will be stored within:\n collection: ClassVar = \"my_users_collection\"\n # field 'id' is added automatically\n name: str\n\n\nasync def main():\n frantic = Frantic()\n\n user = User(name=\"ijustfarted\")\n\n # Save user in the Firestore db\n await frantic.add(user)\n\n # user's id gets automatically populated and can be used to retrieve the user\n retrieved = await frantic.get(User, user.id)\n assert retrieved.name == user.name\n\n # list all users\n users = await frantic.list(User)\n\n # delete user\n await frantic.delete(user)\n # or\n await frantic.delete(User, user.id)\n\nif __name__ == \"__main__\":\n asyncio.run(main)\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Firestore with Pydantic models integration",
"version": "0.1.3",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "662953e4df2a77534931c8f72c0c984e",
"sha256": "00dc2ce1898a146c1d2fa2c9ef0bb95816fa2897b0c1cf0844205d990fe5f871"
},
"downloads": -1,
"filename": "frantic-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "662953e4df2a77534931c8f72c0c984e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 5203,
"upload_time": "2022-12-28T00:19:45",
"upload_time_iso_8601": "2022-12-28T00:19:45.665269Z",
"url": "https://files.pythonhosted.org/packages/98/b8/6c1666269d00e8a22976b250ed4c2b368576ca270afd5512e5d44eca8198/frantic-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "813112f3a47d660bc5e7899366d3c8f2",
"sha256": "787d8a544fc28f6b80b4e55bdc8f8fe57c2ecadc0d1b9b24afa1f78bf2892d30"
},
"downloads": -1,
"filename": "frantic-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "813112f3a47d660bc5e7899366d3c8f2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 4750,
"upload_time": "2022-12-28T00:19:47",
"upload_time_iso_8601": "2022-12-28T00:19:47.428544Z",
"url": "https://files.pythonhosted.org/packages/f2/63/538e45e8958cf7d8af2a390b5416cee31cba53ad2e69d10c80706413d1c4/frantic-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-28 00:19:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "tomasvotava",
"github_project": "frantic",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "frantic"
}