Skip to content

Commit afd9dd3

Browse files
committed
fix test_engine
1 parent 57c4778 commit afd9dd3

16 files changed

+1239
-2706
lines changed

poetry.lock

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

pyproject.toml

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "gino"
3-
version = "1.1.0-beta.1"
3+
version = "2.0.0-alpha.1"
44
description = "GINO Is Not ORM - a Python asyncio ORM on SQLAlchemy core."
55
license = "BSD-3-Clause"
66
authors = ["Fantix King <[email protected]>"]
@@ -16,27 +16,25 @@ classifiers = [
1616
"License :: OSI Approved :: BSD License",
1717
"Natural Language :: English",
1818
"Programming Language :: Python :: 3",
19-
"Programming Language :: Python :: 3.5",
20-
"Programming Language :: Python :: 3.6",
2119
"Programming Language :: Python :: 3.7",
2220
"Programming Language :: Python :: 3.8",
2321
]
2422

2523
[tool.poetry.dependencies]
26-
python = "^3.5"
27-
asyncpg = ">=0.18,<1.0"
28-
SQLAlchemy = ">=1.3,<1.4"
24+
python = "^3.7"
25+
asyncpg = "^0.21.0,<1.0"
26+
sqlalchemy = {path = "../sqlalchemy"}
27+
#SQLAlchemy = {git = "https://github.com/sqlalchemy/sqlalchemy.git"}
2928

3029
# compatibility
31-
contextvars = { version = "^2.4", python = "<3.7" }
32-
importlib_metadata = { version = "^1.3.0", python = "<3.8" }
30+
importlib_metadata = {version = "^1.7.0", python = "<3.8"}
3331

3432
# extensions
35-
gino-starlette = { version = "^0.1.1", optional = true, python = "^3.6" }
36-
gino-aiohttp = { version = "^0.1.0", optional = true, python = "^3.5.3" }
37-
gino-tornado = { version = "^0.1.0", optional = true, python = "^3.5.2" }
38-
gino-sanic = { version = "^0.1.0", optional = true, python = "^3.6" }
39-
gino-quart = { version = "^0.1.0", optional = true, python = "^3.7" }
33+
gino-starlette = { version = "^0.1.1", optional = true }
34+
gino-aiohttp = { version = "^0.1.0", optional = true }
35+
gino-tornado = { version = "^0.1.0", optional = true }
36+
gino-sanic = { version = "^0.1.0", optional = true }
37+
gino-quart = { version = "^0.1.0", optional = true }
4038

4139
[tool.poetry.extras]
4240
starlette = ["gino-starlette"]
@@ -47,27 +45,22 @@ quart = ["gino-quart"]
4745

4846
[tool.poetry.dev-dependencies]
4947
psycopg2-binary = "^2.8.5"
50-
async_generator = "^1.10"
51-
click = "^7.1"
48+
click = "^7.1.2"
5249

5350
# tests
54-
pytest = "^5.4.1"
55-
pytest-asyncio = "^0.10.0"
56-
pytest-mock = "^3.0.0"
57-
pytest-cov = "^2.8.1"
58-
black = { version = "^19.10b0", python = ">=3.6" }
59-
mypy = "^0.770"
51+
pytest = "^6.0.1"
52+
pytest-asyncio = "^0.14.0"
53+
pytest-mock = "^3.3.0"
54+
pytest-cov = "^2.10.1"
55+
black = "^19.10b0"
56+
mypy = "^0.782"
6057

6158
# docs
62-
sphinx = "^3.0.3"
63-
sphinx-rtd-theme = "^0.4.3"
59+
sphinx = "^3.2.1"
60+
sphinx-rtd-theme = "^0.5.0"
6461
sphinxcontrib-apidoc = "^0.3.0"
6562
sphinx-autobuild = "^0.7.1"
66-
sphinx-intl = {extras = ["transifex"], version = "^2.0.1"}
67-
68-
[tool.poetry.plugins."sqlalchemy.dialects"]
69-
"postgresql.asyncpg" = "gino.dialects.asyncpg:AsyncpgDialect"
70-
"asyncpg" = "gino.dialects.asyncpg:AsyncpgDialect"
63+
sphinx-intl = {version = "^2.0.1", extras = ["transifex"]}
7164

7265
[build-system]
7366
requires = ["poetry>=1.0"]

src/gino/__init__.py

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,16 @@
11
from .api import Gino # NOQA
22
from .bakery import Bakery
3-
from .engine import GinoEngine, GinoConnection # NOQA
43
from .exceptions import * # NOQA
5-
from .strategies import GinoStrategy # NOQA
6-
7-
8-
def create_engine(*args, **kwargs):
9-
"""
10-
Shortcut for :func:`sqlalchemy.create_engine` with ``strategy="gino"``.
11-
12-
.. versionchanged:: 1.1
13-
Added the ``bakery`` keyword argument, please see :class:`~.bakery.Bakery`.
14-
15-
.. versionchanged:: 1.1
16-
Added the ``prebake`` keyword argument to choose when to create the prepared
17-
statements for the queries in the bakery:
18-
19-
* **Pre-bake** immediately when connected to the database (default).
20-
* No **pre-bake** but create prepared statements lazily when needed for the first
21-
time.
22-
"""
23-
24-
from sqlalchemy import create_engine
25-
26-
kwargs.setdefault("strategy", "gino")
27-
return create_engine(*args, **kwargs)
4+
from .engine import GinoEngine, GinoConnection, create_engine # NOQA
285

296

307
def get_version():
318
"""Get current GINO version."""
329

3310
try:
34-
from importlib.metadata import version
35-
except ImportError:
3611
from importlib_metadata import version
12+
except ImportError:
13+
from importlib.metadata import version
3714
return version("gino")
3815

3916

src/gino/aiocontextvars.py

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/gino/api.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
import sqlalchemy as sa
44
from sqlalchemy.engine.url import make_url, URL
55
from sqlalchemy.sql.base import Executable
6-
from sqlalchemy.sql.schema import SchemaItem
76

87
from . import json_support
8+
from .engine import create_engine
99
from .crud import CRUDModel
1010
from .declarative import declarative_base, declared_attr
1111
from .exceptions import UninitializedError
12-
from .schema import GinoSchemaVisitor, patch_schema
1312

1413

1514
class GinoExecutor:
@@ -302,7 +301,7 @@ class Gino(sa.MetaData):
302301
303302
"""
304303

305-
schema_visitor = GinoSchemaVisitor
304+
# schema_visitor = GinoSchemaVisitor
306305
"""
307306
The overridable ``gino`` extension class on
308307
:class:`~sqlalchemy.schema.SchemaItem`.
@@ -321,6 +320,11 @@ class Gino(sa.MetaData):
321320
322321
"""
323322

323+
Column = sa.Column
324+
Integer = sa.Integer
325+
String = sa.String
326+
DateTime = sa.DateTime
327+
324328
def __init__(
325329
self,
326330
bind=None,
@@ -371,9 +375,9 @@ def __init__(
371375
if ext:
372376
if query_ext:
373377
Executable.gino = property(self.query_executor)
374-
if schema_ext:
375-
SchemaItem.gino = property(self.schema_visitor)
376-
patch_schema(self)
378+
# if schema_ext:
379+
# SchemaItem.gino = property(self.schema_visitor)
380+
# patch_schema(self)
377381

378382
# noinspection PyPep8Naming
379383
@property
@@ -422,9 +426,7 @@ async def set_bind(self, bind, loop=None, **kwargs):
422426
if isinstance(bind, str):
423427
bind = make_url(bind)
424428
if isinstance(bind, URL):
425-
from . import create_engine
426-
427-
bind = await create_engine(bind, loop=loop, bakery=self._bakery, **kwargs)
429+
bind = await create_engine(bind, **kwargs)
428430
self.bind = bind
429431
return bind
430432

0 commit comments

Comments
 (0)