Skip to content

Commit c7bee98

Browse files
committed
Update dependencies
* No longer depending on asyncpg by default * Removed mysqlclient dependency * Upgraded black and reformatted code Closes: #740
1 parent 7d36860 commit c7bee98

File tree

13 files changed

+111
-56
lines changed

13 files changed

+111
-56
lines changed

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
pip install pip==20.3.1 setuptools==50.3.2
3636
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
3737
source $HOME/.poetry/env
38-
poetry install --no-interaction
38+
poetry install --no-interaction -E pg -E mysql
3939
4040
- name: Log currently installed packages and versions
4141
run: pip list

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
pip install pip==20.3.1 setuptools==50.3.2
4343
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
4444
source $HOME/.poetry/env
45-
poetry install --no-interaction
45+
poetry install --no-interaction -E pg -E mysql
4646
4747
- name: Log currently installed packages and versions
4848
run: pip list

HISTORY.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ GINO 1.1
1111
* Added baked query feature (#478 #659 #667)
1212
* Added ``Query.gino.execution_options`` shortcut (#659)
1313
* Added ``@db.declared_attr(with_table=True)`` (#659)
14-
* [Breaking] empty object instead of ``None`` being returned for objects with values of all selected columns are None (#729)
14+
* [Breaking] Empty object instead of ``None`` being returned for objects with values of all selected columns are None (#729)
15+
* Added MySQL support (#381 #685)
16+
* [Breaking] asyncpg is no longer installed as a dependency by default, install ``gino[pg]`` for the old behavior
1517

1618

1719
GINO 1.0

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ dist: clean ## builds source and wheel package
6464
ls -l dist
6565

6666
install: clean ## install the package to the active Python's site-packages
67-
poetry install
67+
poetry install -E pg -E mysql

docs/tutorials/fastapi.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension for Starlette <https://github.com/python-gino/gino-starlette>`_. Simpl
4545

4646
.. code-block:: console
4747
48-
$ poetry add gino[starlette]
48+
$ poetry add gino[pg,starlette]
4949
5050
Then let's add FastAPI_, together with the lightning-fast ASGI_ server Uvicorn_, and
5151
Gunicorn_ as a production application server:
@@ -87,7 +87,7 @@ That's all, this is my ``pyproject.toml`` created by Poetry_, yours should look
8787
8888
[tool.poetry.dependencies]
8989
python = "^3.8"
90-
gino = {version = "^1.0", extras = ["starlette"]}
90+
gino = {version = "^1.0", extras = ["pg", "starlette"]}
9191
fastapi = "^0.54.1"
9292
uvicorn = "^0.11.3"
9393
gunicorn = "^20.0.4"

mysql_tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313

1414
@pytest.fixture(scope="module")
1515
def sa_engine():
16-
rv = sqlalchemy.create_engine(MYSQL_URL, echo=ECHO)
16+
rv = sqlalchemy.create_engine(
17+
MYSQL_URL.replace("mysql://", "mysql+pymysql://"), echo=ECHO
18+
)
1719
db.create_all(rv)
1820
yield rv
1921
db.drop_all(rv)

poetry.lock

Lines changed: 35 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,35 @@ classifiers = [
2020
"Programming Language :: Python :: 3.6",
2121
"Programming Language :: Python :: 3.7",
2222
"Programming Language :: Python :: 3.8",
23+
"Programming Language :: Python :: 3.9",
2324
]
2425

2526
[tool.poetry.dependencies]
2627
python = "^3.5"
27-
asyncpg = ">=0.18,<1.0"
2828
SQLAlchemy = ">=1.3,<1.4"
29-
mysqlclient = "^1.4"
29+
30+
# drivers
31+
asyncpg = { version = ">=0.18,<1.0", optional = true }
32+
aiomysql = { version = "^0.0.21", optional = true }
3033

3134
# compatibility
3235
contextvars = { version = "^2.4", python = "<3.7" }
33-
importlib_metadata = { version = "^1.3.0", python = "<3.8" }
36+
importlib_metadata = { version = "^2.0.0", python = "<3.8" }
3437

3538
# extensions
3639
gino-starlette = { version = "^0.1.1", optional = true, python = "^3.6" }
3740
gino-aiohttp = {version = "^0.2.0", optional = true, python = "^3.6"}
3841
gino-tornado = { version = "^0.1.0", optional = true, python = "^3.5.2" }
3942
gino-sanic = { version = "^0.1.0", optional = true, python = "^3.6" }
4043
gino-quart = { version = "^0.1.0", optional = true, python = "^3.7" }
41-
aiomysql = "^0.0.21"
4244

4345
[tool.poetry.extras]
46+
postgresql = ["asyncpg"]
47+
postgres = ["asyncpg"]
48+
pg = ["asyncpg"]
49+
asyncpg = ["asyncpg"]
50+
mysql = ["aiomysql"]
51+
aiomysql = ["aiomysql"]
4452
starlette = ["gino-starlette"]
4553
aiohttp = ["gino-aiohttp"]
4654
tornado = ["gino-tornado"]
@@ -57,7 +65,7 @@ pytest = "^5.4.1"
5765
pytest-asyncio = "^0.10.0"
5866
pytest-mock = "^3.0.0"
5967
pytest-cov = "^2.8.1"
60-
black = { version = "^19.10b0", python = ">=3.6" }
68+
black = { version = "^20.8b1", python = ">=3.6" }
6169
mypy = "^0.790"
6270

6371
# docs

src/gino/crud.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,12 @@ async def apply(self, bind=None, timeout=DEFAULT):
166166
opts["timeout"] = timeout
167167
clause = (
168168
type(self._instance)
169-
.update.where(self._locator,)
170-
.values(**self._instance._get_sa_values(values),)
169+
.update.where(
170+
self._locator,
171+
)
172+
.values(
173+
**self._instance._get_sa_values(values),
174+
)
171175
.execution_options(**opts)
172176
)
173177
await _query_and_update(

src/gino/declarative.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,9 @@ def _init_table(cls, sub_cls):
372372
raise AttributeError(
373373
'{} "{}" requires a JSON[B] column "{}" '
374374
"which is not found or has a wrong type.".format(
375-
type(v).__name__, v.name, v.prop_name,
375+
type(v).__name__,
376+
v.name,
377+
v.prop_name,
376378
)
377379
)
378380
sub_cls.__json_prop_names__ = json_prop_names

0 commit comments

Comments
 (0)