summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-peewee-aio.spec573
-rw-r--r--sources1
3 files changed, 575 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..03a4837 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/peewee_aio-1.5.3.tar.gz
diff --git a/python-peewee-aio.spec b/python-peewee-aio.spec
new file mode 100644
index 0000000..c9aeb52
--- /dev/null
+++ b/python-peewee-aio.spec
@@ -0,0 +1,573 @@
+%global _empty_manifest_terminate_build 0
+Name: python-peewee-aio
+Version: 1.5.3
+Release: 1
+Summary: Async support for Peewee ORM
+License: MIT
+URL: https://github.com/klen/peewee-aio
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f4/85/a6677e00fa1f8f01a9db2d804b7dfd8e9077bc780f7cb3359d766b8175e0/peewee_aio-1.5.3.tar.gz
+BuildArch: noarch
+
+Requires: python3-peewee
+Requires: python3-aio-databases
+Requires: python3-typing-extensions
+Requires: python3-asyncpg
+Requires: python3-aiopg
+Requires: python3-aiomysql
+Requires: python3-aiosqlite
+Requires: python3-triopg
+Requires: python3-trio_mysql
+
+%description
+# Peewee-AIO
+
+Async support for [Peewee ORM](https://github.com/coleifer/peewee)
+
+[![Tests Status](https://github.com/klen/peewee-aio/workflows/tests/badge.svg)](https://github.com/klen/peewee-aio/actions)
+[![PYPI Version](https://img.shields.io/pypi/v/peewee-aio)](https://pypi.org/project/peewee-aio/)
+[![Python Versions](https://img.shields.io/pypi/pyversions/peewee-aio)](https://pypi.org/project/peewee-aio/)
+
+## Features
+
+* Make [Peewee ORM](https://github.com/coleifer/peewee) to work async
+* Supports PostgresQL, MySQL, SQLite
+* Supports [asyncio](https://docs.python.org/3/library/asyncio.html) and
+ [trio](https://github.com/python-trio/trio)
+* Contains types as well
+* Drivers supported:
+ - [aiosqlite](https://github.com/omnilib/aiosqlite)
+ - [aiomysql](https://github.com/aio-libs/aiomysql)
+ - [aiopg](https://github.com/aio-libs/aiopg)
+ - [asyncpg](https://github.com/MagicStack/asyncpg)
+ - [triopg](https://github.com/python-trio/triopg)
+ - [trio_mysql](https://github.com/python-trio/trio-mysql)
+
+
+## Requirements
+
+* python >= 3.8
+
+## Installation
+
+**peewee-aio** should be installed using pip:
+
+```shell
+$ pip install peewee-aio
+```
+
+You can install optional database drivers with:
+
+```shell
+$ pip install peewee-aio[aiosqlite] # for SQLite (asyncio)
+$ pip install peewee-aio[aiomysql] # for MySQL (asyncio)
+$ pip install peewee-aio[aiopg] # for Postgresql (asyncio)
+$ pip install peewee-aio[asyncpg] # for Postgresql (asyncio)
+$ pip install peewee-aio[trio_mysql] # for MySQL (trio)
+$ pip install peewee-aio[triopg] # for PostgresQL (trio)
+```
+
+### Quickstart
+
+```python
+ import peewee
+ from peewee_aio import Manager, AIOModel, fields
+
+ manager = Manager('aiosqlite:///:memory:')
+
+ @manager.register
+ class Role(AIOModel):
+ # Pay attention that we are using fields from Peewee-AIO for better typing support
+ id = fields.AutoField()
+ name = fields.CharField()
+
+ @manager.register
+ class User(AIOModel):
+
+ # Pay attention that we are using fields from Peewee-AIO for better typing support
+ id = fields.AutoField()
+ name = fields.CharField()
+ role = fields.ForeignKeyField(Role)
+
+ async def handler():
+
+ # Initialize the database's pool (optional)
+ async with manager:
+
+ # Acquire a connection
+ async with manager.connection():
+
+ # Create the tables in database
+ await Role.create_table()
+ await User.create_table()
+
+ # Create a record
+ role = await Role.create(name='user')
+ assert role
+ assert role.id # role.id contains correct string type
+ user = await User.create(name="Andrey", role=role)
+ assert user
+ assert user.id
+ role = await user.role # Load role from DB using the foreign key
+ assert role # role has a correct Role Type
+
+ # Iterate through records
+ async for user in User.select(User, Role).join(Role):
+ assert user # user has a corrent User Type
+ assert user.id
+ role = await user.role # No DB query here, because the fk is preloaded
+
+ # Change records
+ user.name = "Dmitry"
+ await user.save()
+
+ # Update records
+ await User.update({"name": "Anonimous"}).where(User.id == user.id)
+
+ # Delete records
+ await User.delete().where(User.id == user.id)
+
+ # Drop the tables in database
+ await User.drop_table()
+ await Role.drop_table()
+
+ # Run the handler with your async library
+ import asyncio
+
+ asyncio.run(handler())
+```
+
+## Usage
+
+TODO
+
+### Sync usage
+
+The library still supports sync mode (use `manager.allow_sync`):
+
+```python
+
+class Test(peewee.Model):
+ data = peewee.CharField()
+
+with manager.allow_sync():
+ Test.create_table()
+ Test.create(data='test')
+ assert Test.select().count()
+ Test.update(data='new-test').execute()
+
+```
+
+
+### Get prefetched relations
+
+TODO
+
+```python
+# We prefetched roles here
+async for user in User.select(User, Role).join(Role):
+ role = user.fetch(User.role) # get role from user relations cache
+
+```
+
+## Bug tracker
+
+If you have any suggestions, bug reports or annoyances please report them to
+the issue tracker at https://github.com/klen/peewee-aio/issues
+
+
+## Contributing
+
+Development of the project happens at: https://github.com/klen/peewee-aio
+
+
+## License
+
+Licensed under a [MIT License](http://opensource.org/licenses/MIT)
+
+
+%package -n python3-peewee-aio
+Summary: Async support for Peewee ORM
+Provides: python-peewee-aio
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-peewee-aio
+# Peewee-AIO
+
+Async support for [Peewee ORM](https://github.com/coleifer/peewee)
+
+[![Tests Status](https://github.com/klen/peewee-aio/workflows/tests/badge.svg)](https://github.com/klen/peewee-aio/actions)
+[![PYPI Version](https://img.shields.io/pypi/v/peewee-aio)](https://pypi.org/project/peewee-aio/)
+[![Python Versions](https://img.shields.io/pypi/pyversions/peewee-aio)](https://pypi.org/project/peewee-aio/)
+
+## Features
+
+* Make [Peewee ORM](https://github.com/coleifer/peewee) to work async
+* Supports PostgresQL, MySQL, SQLite
+* Supports [asyncio](https://docs.python.org/3/library/asyncio.html) and
+ [trio](https://github.com/python-trio/trio)
+* Contains types as well
+* Drivers supported:
+ - [aiosqlite](https://github.com/omnilib/aiosqlite)
+ - [aiomysql](https://github.com/aio-libs/aiomysql)
+ - [aiopg](https://github.com/aio-libs/aiopg)
+ - [asyncpg](https://github.com/MagicStack/asyncpg)
+ - [triopg](https://github.com/python-trio/triopg)
+ - [trio_mysql](https://github.com/python-trio/trio-mysql)
+
+
+## Requirements
+
+* python >= 3.8
+
+## Installation
+
+**peewee-aio** should be installed using pip:
+
+```shell
+$ pip install peewee-aio
+```
+
+You can install optional database drivers with:
+
+```shell
+$ pip install peewee-aio[aiosqlite] # for SQLite (asyncio)
+$ pip install peewee-aio[aiomysql] # for MySQL (asyncio)
+$ pip install peewee-aio[aiopg] # for Postgresql (asyncio)
+$ pip install peewee-aio[asyncpg] # for Postgresql (asyncio)
+$ pip install peewee-aio[trio_mysql] # for MySQL (trio)
+$ pip install peewee-aio[triopg] # for PostgresQL (trio)
+```
+
+### Quickstart
+
+```python
+ import peewee
+ from peewee_aio import Manager, AIOModel, fields
+
+ manager = Manager('aiosqlite:///:memory:')
+
+ @manager.register
+ class Role(AIOModel):
+ # Pay attention that we are using fields from Peewee-AIO for better typing support
+ id = fields.AutoField()
+ name = fields.CharField()
+
+ @manager.register
+ class User(AIOModel):
+
+ # Pay attention that we are using fields from Peewee-AIO for better typing support
+ id = fields.AutoField()
+ name = fields.CharField()
+ role = fields.ForeignKeyField(Role)
+
+ async def handler():
+
+ # Initialize the database's pool (optional)
+ async with manager:
+
+ # Acquire a connection
+ async with manager.connection():
+
+ # Create the tables in database
+ await Role.create_table()
+ await User.create_table()
+
+ # Create a record
+ role = await Role.create(name='user')
+ assert role
+ assert role.id # role.id contains correct string type
+ user = await User.create(name="Andrey", role=role)
+ assert user
+ assert user.id
+ role = await user.role # Load role from DB using the foreign key
+ assert role # role has a correct Role Type
+
+ # Iterate through records
+ async for user in User.select(User, Role).join(Role):
+ assert user # user has a corrent User Type
+ assert user.id
+ role = await user.role # No DB query here, because the fk is preloaded
+
+ # Change records
+ user.name = "Dmitry"
+ await user.save()
+
+ # Update records
+ await User.update({"name": "Anonimous"}).where(User.id == user.id)
+
+ # Delete records
+ await User.delete().where(User.id == user.id)
+
+ # Drop the tables in database
+ await User.drop_table()
+ await Role.drop_table()
+
+ # Run the handler with your async library
+ import asyncio
+
+ asyncio.run(handler())
+```
+
+## Usage
+
+TODO
+
+### Sync usage
+
+The library still supports sync mode (use `manager.allow_sync`):
+
+```python
+
+class Test(peewee.Model):
+ data = peewee.CharField()
+
+with manager.allow_sync():
+ Test.create_table()
+ Test.create(data='test')
+ assert Test.select().count()
+ Test.update(data='new-test').execute()
+
+```
+
+
+### Get prefetched relations
+
+TODO
+
+```python
+# We prefetched roles here
+async for user in User.select(User, Role).join(Role):
+ role = user.fetch(User.role) # get role from user relations cache
+
+```
+
+## Bug tracker
+
+If you have any suggestions, bug reports or annoyances please report them to
+the issue tracker at https://github.com/klen/peewee-aio/issues
+
+
+## Contributing
+
+Development of the project happens at: https://github.com/klen/peewee-aio
+
+
+## License
+
+Licensed under a [MIT License](http://opensource.org/licenses/MIT)
+
+
+%package help
+Summary: Development documents and examples for peewee-aio
+Provides: python3-peewee-aio-doc
+%description help
+# Peewee-AIO
+
+Async support for [Peewee ORM](https://github.com/coleifer/peewee)
+
+[![Tests Status](https://github.com/klen/peewee-aio/workflows/tests/badge.svg)](https://github.com/klen/peewee-aio/actions)
+[![PYPI Version](https://img.shields.io/pypi/v/peewee-aio)](https://pypi.org/project/peewee-aio/)
+[![Python Versions](https://img.shields.io/pypi/pyversions/peewee-aio)](https://pypi.org/project/peewee-aio/)
+
+## Features
+
+* Make [Peewee ORM](https://github.com/coleifer/peewee) to work async
+* Supports PostgresQL, MySQL, SQLite
+* Supports [asyncio](https://docs.python.org/3/library/asyncio.html) and
+ [trio](https://github.com/python-trio/trio)
+* Contains types as well
+* Drivers supported:
+ - [aiosqlite](https://github.com/omnilib/aiosqlite)
+ - [aiomysql](https://github.com/aio-libs/aiomysql)
+ - [aiopg](https://github.com/aio-libs/aiopg)
+ - [asyncpg](https://github.com/MagicStack/asyncpg)
+ - [triopg](https://github.com/python-trio/triopg)
+ - [trio_mysql](https://github.com/python-trio/trio-mysql)
+
+
+## Requirements
+
+* python >= 3.8
+
+## Installation
+
+**peewee-aio** should be installed using pip:
+
+```shell
+$ pip install peewee-aio
+```
+
+You can install optional database drivers with:
+
+```shell
+$ pip install peewee-aio[aiosqlite] # for SQLite (asyncio)
+$ pip install peewee-aio[aiomysql] # for MySQL (asyncio)
+$ pip install peewee-aio[aiopg] # for Postgresql (asyncio)
+$ pip install peewee-aio[asyncpg] # for Postgresql (asyncio)
+$ pip install peewee-aio[trio_mysql] # for MySQL (trio)
+$ pip install peewee-aio[triopg] # for PostgresQL (trio)
+```
+
+### Quickstart
+
+```python
+ import peewee
+ from peewee_aio import Manager, AIOModel, fields
+
+ manager = Manager('aiosqlite:///:memory:')
+
+ @manager.register
+ class Role(AIOModel):
+ # Pay attention that we are using fields from Peewee-AIO for better typing support
+ id = fields.AutoField()
+ name = fields.CharField()
+
+ @manager.register
+ class User(AIOModel):
+
+ # Pay attention that we are using fields from Peewee-AIO for better typing support
+ id = fields.AutoField()
+ name = fields.CharField()
+ role = fields.ForeignKeyField(Role)
+
+ async def handler():
+
+ # Initialize the database's pool (optional)
+ async with manager:
+
+ # Acquire a connection
+ async with manager.connection():
+
+ # Create the tables in database
+ await Role.create_table()
+ await User.create_table()
+
+ # Create a record
+ role = await Role.create(name='user')
+ assert role
+ assert role.id # role.id contains correct string type
+ user = await User.create(name="Andrey", role=role)
+ assert user
+ assert user.id
+ role = await user.role # Load role from DB using the foreign key
+ assert role # role has a correct Role Type
+
+ # Iterate through records
+ async for user in User.select(User, Role).join(Role):
+ assert user # user has a corrent User Type
+ assert user.id
+ role = await user.role # No DB query here, because the fk is preloaded
+
+ # Change records
+ user.name = "Dmitry"
+ await user.save()
+
+ # Update records
+ await User.update({"name": "Anonimous"}).where(User.id == user.id)
+
+ # Delete records
+ await User.delete().where(User.id == user.id)
+
+ # Drop the tables in database
+ await User.drop_table()
+ await Role.drop_table()
+
+ # Run the handler with your async library
+ import asyncio
+
+ asyncio.run(handler())
+```
+
+## Usage
+
+TODO
+
+### Sync usage
+
+The library still supports sync mode (use `manager.allow_sync`):
+
+```python
+
+class Test(peewee.Model):
+ data = peewee.CharField()
+
+with manager.allow_sync():
+ Test.create_table()
+ Test.create(data='test')
+ assert Test.select().count()
+ Test.update(data='new-test').execute()
+
+```
+
+
+### Get prefetched relations
+
+TODO
+
+```python
+# We prefetched roles here
+async for user in User.select(User, Role).join(Role):
+ role = user.fetch(User.role) # get role from user relations cache
+
+```
+
+## Bug tracker
+
+If you have any suggestions, bug reports or annoyances please report them to
+the issue tracker at https://github.com/klen/peewee-aio/issues
+
+
+## Contributing
+
+Development of the project happens at: https://github.com/klen/peewee-aio
+
+
+## License
+
+Licensed under a [MIT License](http://opensource.org/licenses/MIT)
+
+
+%prep
+%autosetup -n peewee-aio-1.5.3
+
+%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-peewee-aio -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 1.5.3-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..d173b65
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+ad35ffd985d7607b4ab0c225911ee42a peewee_aio-1.5.3.tar.gz