Skip to content

Commit 2150678

Browse files
authored
Merge pull request #40 from phdru/master
Add `pyproject.toml`
2 parents ac71e02 + 2c678c0 commit 2150678

File tree

6 files changed

+45
-17
lines changed

6 files changed

+45
-17
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*.pyc
1+
*.py[co]
22
__pycache__
33
py3k
44
dist

README.rst

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,40 @@ This package contains a python MySQL client library.
99

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

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

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

1817
Requirements
1918
-------------
2019

21-
- Python 2.7, 3.8+
22-
- MySQL 5.7 or higher
23-
20+
- Python 2.7, 3.5+
21+
- MySQL 5.7 or higher, MariaDB
22+
2423
Installation
2524
--------------
2625

27-
Install cython (optional)
28-
++++++++++++++++++++++++++++++
26+
Install Cython (optional)
27+
+++++++++++++++++++++++++
2928

30-
::
29+
Installation of Cython is optional.
30+
CyMySQL will run faster if installed, but will also run without it.
3131

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

34-
Installation of cython is optional.
35-
CyMySQL will run faster if installed, but will also run without it.
34+
For most versions of pip and setuptools installation of Cython is not
35+
required as it's listed in pyproject.tompl as a required build-time
36+
dependency and will be installed automatically in the isolated build
37+
environemnt. This means it's not possible to install CyMySQL in
38+
pure-Python mode without cythonized extensions.
39+
40+
For older versions of pip and setuptools that don't obey pyproject.tompl
41+
install Cython yourself:
3642

37-
Since the bottleneck is often in MySQL queries, installing cython may not be effective in many cases.
43+
::
44+
45+
# pip install cython
3846

3947
Install cymysql
4048
++++++++++++++++++++++++++++++

cymysql/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
if sys.version_info[0] > 2:
3939
from cymysql import aio
4040

41-
VERSION = (1, 0, 2)
41+
from .__version__ import VERSION, __version__
42+
4243
threadsafety = 1
4344
apilevel = "2.0"
4445
paramstyle = "format"
@@ -91,8 +92,6 @@ def connect(*args, **kwargs):
9192

9293
NULL = "NULL"
9394

94-
__version__ = '%s.%s.%s' % VERSION
95-
9695
__all__ = [
9796
'BINARY', 'Binary', 'Connection', 'DATE', 'Date',
9897
'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 'TimestampFromTicks',

cymysql/__version__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
VERSION = (1, 0, 2)
2+
__version__ = '%s.%s.%s' % VERSION

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools", "Cython"]
3+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
from os.path import abspath, dirname, join
12
import sys
3+
24
from setuptools import setup, Command, Extension
35

6+
versionpath = join(abspath(dirname(__file__)), 'cymysql', '__version__.py')
7+
cymysql_version = {}
8+
9+
if sys.version_info[:2] == (2, 7):
10+
execfile(versionpath, cymysql_version) # noqa: F821 'execfile' Py3
11+
12+
elif sys.version_info >= (3, 5):
13+
exec(open(versionpath, 'r').read(), cymysql_version)
14+
15+
else:
16+
raise ImportError("CyMySQL requires Python 2.7 or 3.5+")
17+
418
try:
519
from Cython.Build import cythonize
620
ext_modules = cythonize([
@@ -40,7 +54,7 @@ def run(self):
4054

4155
cmdclass = {'test': TestCommand}
4256

43-
version_tuple = __import__('cymysql').VERSION
57+
version_tuple = cymysql_version['VERSION']
4458

4559
if version_tuple[2] is not None:
4660
version = "%d.%d.%s" % version_tuple
@@ -55,6 +69,8 @@ def run(self):
5569
'Programming Language :: Python :: 2',
5670
'Programming Language :: Python :: 3',
5771
'Topic :: Database',
72+
'Topic :: Database :: Front-Ends',
73+
'Topic :: Software Development :: Libraries :: Python Modules',
5874
]
5975

6076
setup(

0 commit comments

Comments
 (0)