Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pyproject.toml #40

Merged
merged 5 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*.pyc
*.py[co]
__pycache__
py3k
dist
Expand Down
32 changes: 20 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,40 @@ This package contains a python MySQL client library.

It is a fork project from PyMySQL https://pymysql.readthedocs.io/en/latest/.

CyMySQL accerarates by Cython, and support not only python 2 but also python 3.
It still can work without Cython as a pure python driver.
CyMySQL is accerarated by Cython and supports Python versions 2 and 3.

Documentation on the MySQL client/server protocol can be found here:
http://dev.mysql.com/doc/internals/en/client-server-protocol.html

Requirements
-------------

- Python 2.7, 3.8+
- MySQL 5.7 or higher
- Python 2.7, 3.5+
- MySQL 5.7 or higher, MariaDB

Installation
--------------

Install cython (optional)
++++++++++++++++++++++++++++++
Install Cython (optional)
+++++++++++++++++++++++++

::
Installation of Cython is optional.
CyMySQL will run faster if installed, but will also run without it.

# pip install cython
Since the bottleneck is often in MySQL queries, installing Cython may not be effective in many cases.

Installation of cython is optional.
CyMySQL will run faster if installed, but will also run without it.
For most versions of pip and setuptools installation of Cython is not
required as it's listed in pyproject.tompl as a required build-time
dependency and will be installed automatically in the isolated build
environemnt. This means it's not possible to install CyMySQL in
pure-Python mode without cythonized extensions.

For older versions of pip and setuptools that don't obey pyproject.tompl
install Cython yourself:

Since the bottleneck is often in MySQL queries, installing cython may not be effective in many cases.
::

# pip install cython

Install cymysql
++++++++++++++++++++++++++++++
Expand Down
5 changes: 2 additions & 3 deletions cymysql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
if sys.version_info[0] > 2:
from cymysql import aio

VERSION = (1, 0, 2)
from .__version__ import VERSION, __version__

threadsafety = 1
apilevel = "2.0"
paramstyle = "format"
Expand Down Expand Up @@ -91,8 +92,6 @@ def connect(*args, **kwargs):

NULL = "NULL"

__version__ = '%s.%s.%s' % VERSION

__all__ = [
'BINARY', 'Binary', 'Connection', 'DATE', 'Date',
'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 'TimestampFromTicks',
Expand Down
2 changes: 2 additions & 0 deletions cymysql/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VERSION = (1, 0, 2)
__version__ = '%s.%s.%s' % VERSION
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "Cython"]
build-backend = "setuptools.build_meta"
18 changes: 17 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
from os.path import abspath, dirname, join
import sys

from setuptools import setup, Command, Extension

versionpath = join(abspath(dirname(__file__)), 'cymysql', '__version__.py')
cymysql_version = {}

if sys.version_info[:2] == (2, 7):
execfile(versionpath, cymysql_version) # noqa: F821 'execfile' Py3

elif sys.version_info >= (3, 5):
exec(open(versionpath, 'r').read(), cymysql_version)

else:
raise ImportError("CyMySQL requires Python 2.7 or 3.5+")

try:
from Cython.Build import cythonize
ext_modules = cythonize([
Expand Down Expand Up @@ -40,7 +54,7 @@ def run(self):

cmdclass = {'test': TestCommand}

version_tuple = __import__('cymysql').VERSION
version_tuple = cymysql_version['VERSION']

if version_tuple[2] is not None:
version = "%d.%d.%s" % version_tuple
Expand All @@ -55,6 +69,8 @@ def run(self):
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Database',
'Topic :: Database :: Front-Ends',
'Topic :: Software Development :: Libraries :: Python Modules',
]

setup(
Expand Down