Skip to content

Commit

Permalink
feat: implement sync/async support with httppx and unasync
Browse files Browse the repository at this point in the history
The "_sync" folder is generated automatically with the
"make build_sync" command.

All scripts in the "_async" folder will be translated into their
synchronous form using "unasync" behind the scenes.
  • Loading branch information
leynier committed Oct 17, 2021
1 parent 2ac3930 commit da10e87
Show file tree
Hide file tree
Showing 18 changed files with 1,376 additions and 57 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build_sync:
if [ -d "build" ]; then rm -r "build"; fi
python build_sync.py build
if [ -d "gotrue/_sync" ]; then rm -r "gotrue/_sync"; fi
cp -r "build/lib/gotrue/_sync" "gotrue/_sync"
rm -r "build"
8 changes: 8 additions & 0 deletions build_sync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from setuptools import find_packages, setup
from unasync import cmdclass_build_py

setup(
packages=find_packages(exclude=["tests"]),
# package_dir={"": "gotrue"},
cmdclass={"build_py": cmdclass_build_py()}, # type: ignore
)
14 changes: 10 additions & 4 deletions gotrue/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
__version__ = "0.2.0"

from . import api # noqa: F401
from . import client # noqa: F401
from .client import Client, GoTrueClient # noqa: F401
from .lib.types import * # noqa: F401, F403
from ._async.api import AsyncGoTrueApi # noqa: F401
from ._async.client import AsyncGoTrueClient # noqa: F401
from ._async.storage import AsyncMemoryStorage, AsyncSupportedStorage # noqa: F401
from ._sync.api import SyncGoTrueApi # noqa: F401
from ._sync.client import SyncGoTrueClient # noqa: F401
from ._sync.storage import SyncMemoryStorage, SyncSupportedStorage # noqa: F401
from .common.types import * # noqa: F401, F403

Client = SyncGoTrueClient
GoTrueApi = SyncGoTrueApi
File renamed without changes.

0 comments on commit da10e87

Please sign in to comment.