From d3ff8f7bbf456fdb12e67bd523d6ec5d40a72ecf Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Fri, 5 May 2023 03:42:07 +0000 Subject: automatic import of python-asyncmy --- .gitignore | 1 + python-asyncmy.spec | 575 ++++++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 577 insertions(+) create mode 100644 python-asyncmy.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..d7f3b7a 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/asyncmy-0.2.7.tar.gz diff --git a/python-asyncmy.spec b/python-asyncmy.spec new file mode 100644 index 0000000..cebe1dd --- /dev/null +++ b/python-asyncmy.spec @@ -0,0 +1,575 @@ +%global _empty_manifest_terminate_build 0 +Name: python-asyncmy +Version: 0.2.7 +Release: 1 +Summary: A fast asyncio MySQL driver +License: Apache-2.0 +URL: https://github.com/long2ice/asyncmy +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/5c/eb/c28cab409d4e7fa7bc7fa98904834dbbba3ee0215ebb2d3223e0626d04b7/asyncmy-0.2.7.tar.gz + + +%description +# asyncmy - A fast asyncio MySQL/MariaDB driver + +[![image](https://img.shields.io/pypi/v/asyncmy.svg?style=flat)](https://pypi.python.org/pypi/asyncmy) +[![image](https://img.shields.io/github/license/long2ice/asyncmy)](https://github.com/long2ice/asyncmy) +[![pypi](https://github.com/long2ice/asyncmy/actions/workflows/pypi.yml/badge.svg)](https://github.com/long2ice/asyncmy/actions/workflows/pypi.yml) +[![ci](https://github.com/long2ice/asyncmy/actions/workflows/ci.yml/badge.svg)](https://github.com/long2ice/asyncmy/actions/workflows/ci.yml) + +## Introduction + +`asyncmy` is a fast asyncio MySQL/MariaDB driver, which reuse most of [pymysql](https://github.com/PyMySQL/PyMySQL) +and [aiomysql](https://github.com/aio-libs/aiomysql) but rewrite core protocol with [cython](https://cython.org/) to +speedup. + +## Features + +- API compatible with [aiomysql](https://github.com/aio-libs/aiomysql). +- Faster by [cython](https://cython.org/). +- MySQL replication protocol support with `asyncio`. +- Tested both MySQL and MariaDB in [CI](https://github.com/long2ice/asyncmy/blob/dev/.github/workflows/ci.yml). + +## Benchmark + +The result comes from [benchmark](./benchmark). + +> The device is iMac Pro(2017) i9 3.6GHz 48G and MySQL version is 8.0.26. + +![benchmark](./images/benchmark.png) + +### Conclusion + +- There is no doubt that `mysqlclient` is the fastest MySQL driver. +- All kinds of drivers have a small gap except `select`. +- `asyncio` could enhance `insert`. +- `asyncmy` performs remarkable when compared to other drivers. + +## Install + +```shell +pip install asyncmy +``` + +### Installing on Windows + +To install asyncmy on Windows, you need to install the tools needed to build it. + +1. Download *Microsoft C++ Build Tools* from https://visualstudio.microsoft.com/visual-cpp-build-tools/ +2. Run CMD as Admin (not required but recommended) and navigate to the folder when your installer is downloaded +3. Installer executable should look like this `vs_buildtools__XXXXXXXXX.XXXXXXXXXX.exe`, it will be easier if you rename + it to just `vs_buildtools.exe` +4. Run this command (Make sure you have about 5-6GB of free storage) + +```shell +vs_buildtools.exe --norestart --passive --downloadThenInstall --includeRecommended --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.MSBuildTools +``` + +5. Wait until the installation is finished +6. After installation will finish, restart your computer +7. Install asyncmy via PIP + +```shell +pip install asyncmy +``` + +Now you can uninstall previously installed tools. + +## Usage + +### Use `connect` + +`asyncmy` provides a way to connect to MySQL database with simple factory function `asyncmy.connnect()`. Use this +function if you want just one connection to the database, consider connection pool for multiple connections. + +```py +from asyncmy import connect +from asyncmy.cursors import DictCursor +import asyncio + + +async def run(): + conn = await connect() + async with conn.cursor(cursor=DictCursor) as cursor: + await cursor.execute("create database if not exists test") + await cursor.execute( + """CREATE TABLE if not exists test.asyncmy + ( + `id` int primary key auto_increment, + `decimal` decimal(10, 2), + `date` date, + `datetime` datetime, + `float` float, + `string` varchar(200), + `tinyint` tinyint + )""" + ) + + +if __name__ == '__main__': + asyncio.run(run()) +``` + +### Use `pool` + +`asyncmy` provides connection pool as well as plain Connection objects. + +```py +import asyncmy +import asyncio + + +async def run(): + pool = await asyncmy.create_pool() + async with pool.acquire() as conn: + async with conn.cursor() as cursor: + await cursor.execute("SELECT 1") + ret = await cursor.fetchone() + assert ret == (1,) + + +if __name__ == '__main__': + asyncio.run(run()) +``` + +## Replication + +`asyncmy` supports MySQL replication protocol +like [python-mysql-replication](https://github.com/noplay/python-mysql-replication), but powered by `asyncio`. + +```py +from asyncmy import connect +from asyncmy.replication import BinLogStream +import asyncio + + +async def run(): + conn = await connect() + ctl_conn = await connect() + + stream = BinLogStream( + conn, + ctl_conn, + 1, + master_log_file="binlog.000172", + master_log_position=2235312, + resume_stream=True, + blocking=True, + ) + async for event in stream: + print(event) + + +if __name__ == '__main__': + asyncio.run(run()) +``` + +## ThanksTo + +> asyncmy is build on top of these awesome projects. + +- [pymysql](https://github/pymysql/PyMySQL), a pure python MySQL client. +- [aiomysql](https://github.com/aio-libs/aiomysql), a library for accessing a MySQL database from the asyncio. +- [python-mysql-replication](https://github.com/noplay/python-mysql-replication), pure Python Implementation of MySQL + replication protocol build on top of PyMYSQL. + +## License + +This project is licensed under the [Apache-2.0](./LICENSE) License. + + + +%package -n python3-asyncmy +Summary: A fast asyncio MySQL driver +Provides: python-asyncmy +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +BuildRequires: python3-cffi +BuildRequires: gcc +BuildRequires: gdb +%description -n python3-asyncmy +# asyncmy - A fast asyncio MySQL/MariaDB driver + +[![image](https://img.shields.io/pypi/v/asyncmy.svg?style=flat)](https://pypi.python.org/pypi/asyncmy) +[![image](https://img.shields.io/github/license/long2ice/asyncmy)](https://github.com/long2ice/asyncmy) +[![pypi](https://github.com/long2ice/asyncmy/actions/workflows/pypi.yml/badge.svg)](https://github.com/long2ice/asyncmy/actions/workflows/pypi.yml) +[![ci](https://github.com/long2ice/asyncmy/actions/workflows/ci.yml/badge.svg)](https://github.com/long2ice/asyncmy/actions/workflows/ci.yml) + +## Introduction + +`asyncmy` is a fast asyncio MySQL/MariaDB driver, which reuse most of [pymysql](https://github.com/PyMySQL/PyMySQL) +and [aiomysql](https://github.com/aio-libs/aiomysql) but rewrite core protocol with [cython](https://cython.org/) to +speedup. + +## Features + +- API compatible with [aiomysql](https://github.com/aio-libs/aiomysql). +- Faster by [cython](https://cython.org/). +- MySQL replication protocol support with `asyncio`. +- Tested both MySQL and MariaDB in [CI](https://github.com/long2ice/asyncmy/blob/dev/.github/workflows/ci.yml). + +## Benchmark + +The result comes from [benchmark](./benchmark). + +> The device is iMac Pro(2017) i9 3.6GHz 48G and MySQL version is 8.0.26. + +![benchmark](./images/benchmark.png) + +### Conclusion + +- There is no doubt that `mysqlclient` is the fastest MySQL driver. +- All kinds of drivers have a small gap except `select`. +- `asyncio` could enhance `insert`. +- `asyncmy` performs remarkable when compared to other drivers. + +## Install + +```shell +pip install asyncmy +``` + +### Installing on Windows + +To install asyncmy on Windows, you need to install the tools needed to build it. + +1. Download *Microsoft C++ Build Tools* from https://visualstudio.microsoft.com/visual-cpp-build-tools/ +2. Run CMD as Admin (not required but recommended) and navigate to the folder when your installer is downloaded +3. Installer executable should look like this `vs_buildtools__XXXXXXXXX.XXXXXXXXXX.exe`, it will be easier if you rename + it to just `vs_buildtools.exe` +4. Run this command (Make sure you have about 5-6GB of free storage) + +```shell +vs_buildtools.exe --norestart --passive --downloadThenInstall --includeRecommended --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.MSBuildTools +``` + +5. Wait until the installation is finished +6. After installation will finish, restart your computer +7. Install asyncmy via PIP + +```shell +pip install asyncmy +``` + +Now you can uninstall previously installed tools. + +## Usage + +### Use `connect` + +`asyncmy` provides a way to connect to MySQL database with simple factory function `asyncmy.connnect()`. Use this +function if you want just one connection to the database, consider connection pool for multiple connections. + +```py +from asyncmy import connect +from asyncmy.cursors import DictCursor +import asyncio + + +async def run(): + conn = await connect() + async with conn.cursor(cursor=DictCursor) as cursor: + await cursor.execute("create database if not exists test") + await cursor.execute( + """CREATE TABLE if not exists test.asyncmy + ( + `id` int primary key auto_increment, + `decimal` decimal(10, 2), + `date` date, + `datetime` datetime, + `float` float, + `string` varchar(200), + `tinyint` tinyint + )""" + ) + + +if __name__ == '__main__': + asyncio.run(run()) +``` + +### Use `pool` + +`asyncmy` provides connection pool as well as plain Connection objects. + +```py +import asyncmy +import asyncio + + +async def run(): + pool = await asyncmy.create_pool() + async with pool.acquire() as conn: + async with conn.cursor() as cursor: + await cursor.execute("SELECT 1") + ret = await cursor.fetchone() + assert ret == (1,) + + +if __name__ == '__main__': + asyncio.run(run()) +``` + +## Replication + +`asyncmy` supports MySQL replication protocol +like [python-mysql-replication](https://github.com/noplay/python-mysql-replication), but powered by `asyncio`. + +```py +from asyncmy import connect +from asyncmy.replication import BinLogStream +import asyncio + + +async def run(): + conn = await connect() + ctl_conn = await connect() + + stream = BinLogStream( + conn, + ctl_conn, + 1, + master_log_file="binlog.000172", + master_log_position=2235312, + resume_stream=True, + blocking=True, + ) + async for event in stream: + print(event) + + +if __name__ == '__main__': + asyncio.run(run()) +``` + +## ThanksTo + +> asyncmy is build on top of these awesome projects. + +- [pymysql](https://github/pymysql/PyMySQL), a pure python MySQL client. +- [aiomysql](https://github.com/aio-libs/aiomysql), a library for accessing a MySQL database from the asyncio. +- [python-mysql-replication](https://github.com/noplay/python-mysql-replication), pure Python Implementation of MySQL + replication protocol build on top of PyMYSQL. + +## License + +This project is licensed under the [Apache-2.0](./LICENSE) License. + + + +%package help +Summary: Development documents and examples for asyncmy +Provides: python3-asyncmy-doc +%description help +# asyncmy - A fast asyncio MySQL/MariaDB driver + +[![image](https://img.shields.io/pypi/v/asyncmy.svg?style=flat)](https://pypi.python.org/pypi/asyncmy) +[![image](https://img.shields.io/github/license/long2ice/asyncmy)](https://github.com/long2ice/asyncmy) +[![pypi](https://github.com/long2ice/asyncmy/actions/workflows/pypi.yml/badge.svg)](https://github.com/long2ice/asyncmy/actions/workflows/pypi.yml) +[![ci](https://github.com/long2ice/asyncmy/actions/workflows/ci.yml/badge.svg)](https://github.com/long2ice/asyncmy/actions/workflows/ci.yml) + +## Introduction + +`asyncmy` is a fast asyncio MySQL/MariaDB driver, which reuse most of [pymysql](https://github.com/PyMySQL/PyMySQL) +and [aiomysql](https://github.com/aio-libs/aiomysql) but rewrite core protocol with [cython](https://cython.org/) to +speedup. + +## Features + +- API compatible with [aiomysql](https://github.com/aio-libs/aiomysql). +- Faster by [cython](https://cython.org/). +- MySQL replication protocol support with `asyncio`. +- Tested both MySQL and MariaDB in [CI](https://github.com/long2ice/asyncmy/blob/dev/.github/workflows/ci.yml). + +## Benchmark + +The result comes from [benchmark](./benchmark). + +> The device is iMac Pro(2017) i9 3.6GHz 48G and MySQL version is 8.0.26. + +![benchmark](./images/benchmark.png) + +### Conclusion + +- There is no doubt that `mysqlclient` is the fastest MySQL driver. +- All kinds of drivers have a small gap except `select`. +- `asyncio` could enhance `insert`. +- `asyncmy` performs remarkable when compared to other drivers. + +## Install + +```shell +pip install asyncmy +``` + +### Installing on Windows + +To install asyncmy on Windows, you need to install the tools needed to build it. + +1. Download *Microsoft C++ Build Tools* from https://visualstudio.microsoft.com/visual-cpp-build-tools/ +2. Run CMD as Admin (not required but recommended) and navigate to the folder when your installer is downloaded +3. Installer executable should look like this `vs_buildtools__XXXXXXXXX.XXXXXXXXXX.exe`, it will be easier if you rename + it to just `vs_buildtools.exe` +4. Run this command (Make sure you have about 5-6GB of free storage) + +```shell +vs_buildtools.exe --norestart --passive --downloadThenInstall --includeRecommended --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.MSBuildTools +``` + +5. Wait until the installation is finished +6. After installation will finish, restart your computer +7. Install asyncmy via PIP + +```shell +pip install asyncmy +``` + +Now you can uninstall previously installed tools. + +## Usage + +### Use `connect` + +`asyncmy` provides a way to connect to MySQL database with simple factory function `asyncmy.connnect()`. Use this +function if you want just one connection to the database, consider connection pool for multiple connections. + +```py +from asyncmy import connect +from asyncmy.cursors import DictCursor +import asyncio + + +async def run(): + conn = await connect() + async with conn.cursor(cursor=DictCursor) as cursor: + await cursor.execute("create database if not exists test") + await cursor.execute( + """CREATE TABLE if not exists test.asyncmy + ( + `id` int primary key auto_increment, + `decimal` decimal(10, 2), + `date` date, + `datetime` datetime, + `float` float, + `string` varchar(200), + `tinyint` tinyint + )""" + ) + + +if __name__ == '__main__': + asyncio.run(run()) +``` + +### Use `pool` + +`asyncmy` provides connection pool as well as plain Connection objects. + +```py +import asyncmy +import asyncio + + +async def run(): + pool = await asyncmy.create_pool() + async with pool.acquire() as conn: + async with conn.cursor() as cursor: + await cursor.execute("SELECT 1") + ret = await cursor.fetchone() + assert ret == (1,) + + +if __name__ == '__main__': + asyncio.run(run()) +``` + +## Replication + +`asyncmy` supports MySQL replication protocol +like [python-mysql-replication](https://github.com/noplay/python-mysql-replication), but powered by `asyncio`. + +```py +from asyncmy import connect +from asyncmy.replication import BinLogStream +import asyncio + + +async def run(): + conn = await connect() + ctl_conn = await connect() + + stream = BinLogStream( + conn, + ctl_conn, + 1, + master_log_file="binlog.000172", + master_log_position=2235312, + resume_stream=True, + blocking=True, + ) + async for event in stream: + print(event) + + +if __name__ == '__main__': + asyncio.run(run()) +``` + +## ThanksTo + +> asyncmy is build on top of these awesome projects. + +- [pymysql](https://github/pymysql/PyMySQL), a pure python MySQL client. +- [aiomysql](https://github.com/aio-libs/aiomysql), a library for accessing a MySQL database from the asyncio. +- [python-mysql-replication](https://github.com/noplay/python-mysql-replication), pure Python Implementation of MySQL + replication protocol build on top of PyMYSQL. + +## License + +This project is licensed under the [Apache-2.0](./LICENSE) License. + + + +%prep +%autosetup -n asyncmy-0.2.7 + +%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-asyncmy -f filelist.lst +%dir %{python3_sitearch}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot - 0.2.7-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..fe348fc --- /dev/null +++ b/sources @@ -0,0 +1 @@ +f489e69fac71a1734f92e85dab7c171f asyncmy-0.2.7.tar.gz -- cgit v1.2.3