diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-31 04:42:24 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-31 04:42:24 +0000 |
commit | f7322a23b987712015a0be6f2c52321439311f10 (patch) | |
tree | 8a43db706d1ad8434efa6bf1d25b31c62e0a915a /python-firestore-collections.spec | |
parent | f4b97c828d6a63cc57fa3e8c39c579fcc910a712 (diff) |
automatic import of python-firestore-collections
Diffstat (limited to 'python-firestore-collections.spec')
-rw-r--r-- | python-firestore-collections.spec | 285 |
1 files changed, 285 insertions, 0 deletions
diff --git a/python-firestore-collections.spec b/python-firestore-collections.spec new file mode 100644 index 0000000..fd646f0 --- /dev/null +++ b/python-firestore-collections.spec @@ -0,0 +1,285 @@ +%global _empty_manifest_terminate_build 0 +Name: python-firestore-collections +Version: 0.5.2 +Release: 1 +Summary: Simple Firestore collection definitions and queries using pydantic schemas and Firestore query API. +License: MIT License +URL: https://github.com/LasseRegin/firestore-collections +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/85/f8/17421287902f20112fc17d3ba7d8c0bea984f9d70f2ff0493ce8abe7a4b3/firestore-collections-0.5.2.tar.gz +BuildArch: noarch + + +%description +# Firestore Collections + +Simple Firestore collection definitions and queries using pydantic schemas and Firestore query API. + +A quick and easy way to make use of the NoSQL document database solution [Firestore](https://cloud.google.com/firestore) available in Google Cloud Platform (GCP). + +## Requirements + +* Python 3.6+ +* GCP project with Firestore enabled + +## Features + +* **Schema definition and validation**: Define collection schemas using `pydantic` and built-in type hinting (`typing`). +* **Automatic IDs**: Automatic ID generation using 12-byte hexadecimal (`bson.ObjectId`). +* **Simple queries**: Query collections using a simple interface. +* **Auxiliary timestamps**: Automatically added timestamps to objects like `created_at` and `updated_at`. + +## Example + +Define _users_ collection and perform different queries: +```python +from typing import Optional + +from pydantic import EmailStr, SecretStr +from firestore_collections import Collection, Schema + + +class User(Schema): + __collection_name__ = 'users' + __unique_keys__ = ['email'] + + email: EmailStr + full_name: str = None + password: Optional[SecretStr] + + +# Initialize firestore collection +collection = Collection(schema=User) + +# Initialize user object +user = User( + email='john@doe.com', + full_name='John') + +# Insert +user = collection.insert(user) + +# Get object from db +user = collection.get(user.id) + +# Update +user.full_name = 'John Doe' +collection.update(user) + +# Get by attribute +user = collection.get_by_attribute('email', 'john@doe.com') + +# Get all objects +users = collection.get_all() + +# Delete object +collection.delete(id=user.id) +``` + +## GCP credentials + +**NOTE**: The package assumes a valid GCP credentials file is available and its path defined in the environment variable `GOOGLE_APPLICATION_CREDENTIALS`. + +## License + +This project is licensed under the terms of the MIT license. + +%package -n python3-firestore-collections +Summary: Simple Firestore collection definitions and queries using pydantic schemas and Firestore query API. +Provides: python-firestore-collections +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-firestore-collections +# Firestore Collections + +Simple Firestore collection definitions and queries using pydantic schemas and Firestore query API. + +A quick and easy way to make use of the NoSQL document database solution [Firestore](https://cloud.google.com/firestore) available in Google Cloud Platform (GCP). + +## Requirements + +* Python 3.6+ +* GCP project with Firestore enabled + +## Features + +* **Schema definition and validation**: Define collection schemas using `pydantic` and built-in type hinting (`typing`). +* **Automatic IDs**: Automatic ID generation using 12-byte hexadecimal (`bson.ObjectId`). +* **Simple queries**: Query collections using a simple interface. +* **Auxiliary timestamps**: Automatically added timestamps to objects like `created_at` and `updated_at`. + +## Example + +Define _users_ collection and perform different queries: +```python +from typing import Optional + +from pydantic import EmailStr, SecretStr +from firestore_collections import Collection, Schema + + +class User(Schema): + __collection_name__ = 'users' + __unique_keys__ = ['email'] + + email: EmailStr + full_name: str = None + password: Optional[SecretStr] + + +# Initialize firestore collection +collection = Collection(schema=User) + +# Initialize user object +user = User( + email='john@doe.com', + full_name='John') + +# Insert +user = collection.insert(user) + +# Get object from db +user = collection.get(user.id) + +# Update +user.full_name = 'John Doe' +collection.update(user) + +# Get by attribute +user = collection.get_by_attribute('email', 'john@doe.com') + +# Get all objects +users = collection.get_all() + +# Delete object +collection.delete(id=user.id) +``` + +## GCP credentials + +**NOTE**: The package assumes a valid GCP credentials file is available and its path defined in the environment variable `GOOGLE_APPLICATION_CREDENTIALS`. + +## License + +This project is licensed under the terms of the MIT license. + +%package help +Summary: Development documents and examples for firestore-collections +Provides: python3-firestore-collections-doc +%description help +# Firestore Collections + +Simple Firestore collection definitions and queries using pydantic schemas and Firestore query API. + +A quick and easy way to make use of the NoSQL document database solution [Firestore](https://cloud.google.com/firestore) available in Google Cloud Platform (GCP). + +## Requirements + +* Python 3.6+ +* GCP project with Firestore enabled + +## Features + +* **Schema definition and validation**: Define collection schemas using `pydantic` and built-in type hinting (`typing`). +* **Automatic IDs**: Automatic ID generation using 12-byte hexadecimal (`bson.ObjectId`). +* **Simple queries**: Query collections using a simple interface. +* **Auxiliary timestamps**: Automatically added timestamps to objects like `created_at` and `updated_at`. + +## Example + +Define _users_ collection and perform different queries: +```python +from typing import Optional + +from pydantic import EmailStr, SecretStr +from firestore_collections import Collection, Schema + + +class User(Schema): + __collection_name__ = 'users' + __unique_keys__ = ['email'] + + email: EmailStr + full_name: str = None + password: Optional[SecretStr] + + +# Initialize firestore collection +collection = Collection(schema=User) + +# Initialize user object +user = User( + email='john@doe.com', + full_name='John') + +# Insert +user = collection.insert(user) + +# Get object from db +user = collection.get(user.id) + +# Update +user.full_name = 'John Doe' +collection.update(user) + +# Get by attribute +user = collection.get_by_attribute('email', 'john@doe.com') + +# Get all objects +users = collection.get_all() + +# Delete object +collection.delete(id=user.id) +``` + +## GCP credentials + +**NOTE**: The package assumes a valid GCP credentials file is available and its path defined in the environment variable `GOOGLE_APPLICATION_CREDENTIALS`. + +## License + +This project is licensed under the terms of the MIT license. + +%prep +%autosetup -n firestore-collections-0.5.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-firestore-collections -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.2-1 +- Package Spec generated |