From cd7d37934b85a6e3b96c1a1ba1d761eed65b52d5 Mon Sep 17 00:00:00 2001 From: Ezeudoh Tochukwu Date: Mon, 26 Feb 2024 23:40:21 +0100 Subject: [PATCH 01/10] Sample COde updates --- docs/models/index.md | 8 ++++---- docs/overview/index.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/models/index.md b/docs/models/index.md index 1ef7553..9ef1f6a 100644 --- a/docs/models/index.md +++ b/docs/models/index.md @@ -262,13 +262,13 @@ import ellar.common as ecm from ellar_sql import get_or_404, one_or_404, model @ecm.get("/user-by-id/{user_id:int}") -def user_by_id(user_id: int): - user = get_or_404(User, user_id) +async def user_by_id(user_id: int): + user = await get_or_404(User, user_id) return user.dict() @ecm.get("/user-by-name/{name:str}") -def user_by_username(name: str): - user = one_or_404(model.select(User).filter_by(name=name), error_message=f"No user named '{name}'.") +async def user_by_username(name: str): + user = await one_or_404(model.select(User).filter_by(name=name), error_message=f"No user named '{name}'.") return user.dict() ``` diff --git a/docs/overview/index.md b/docs/overview/index.md index 6c4465c..d05b42e 100644 --- a/docs/overview/index.md +++ b/docs/overview/index.md @@ -82,7 +82,7 @@ class UsersController(ecm.ControllerBase): @ecm.get("/users/{user_id:int}") def user_by_id(self, user_id: int): - user = get_or_404(User, user_id) + user = await get_or_404(User, user_id) return user.dict() @ecm.get("/") @@ -93,7 +93,7 @@ class UsersController(ecm.ControllerBase): @ecm.get("/{user_id:int}") async def user_delete(self, user_id: int, session: ecm.Inject[model.Session]): - user = get_or_404(User, user_id) + user = await get_or_404(User, user_id) session.delete(user) return {'detail': f'User id={user_id} Deleted successfully'} ``` From 8d01e03ebb55efc26c047b84fa9245838ad4154f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 22:03:53 +0000 Subject: [PATCH 02/10] Bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.12 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.11 to 1.8.12. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.11...v1.8.12) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 29d2de6..74dcfd5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,6 +23,6 @@ jobs: - name: Build distribution run: python -m build - name: Publish - uses: pypa/gh-action-pypi-publish@v1.8.11 + uses: pypa/gh-action-pypi-publish@v1.8.12 with: password: ${{ secrets.PYPI_API_TOKEN }} From 3587f4ea60bc338a9a92948ba26f72b41c23fe93 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 22:03:57 +0000 Subject: [PATCH 03/10] Bump codecov/codecov-action from 4.0.1 to 4.1.0 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.0.1 to 4.1.0. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4.0.1...v4.1.0) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 443ce32..68a48c4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,4 +22,4 @@ jobs: - name: Test run: make test-cov - name: Coverage - uses: codecov/codecov-action@v4.0.1 + uses: codecov/codecov-action@v4.1.0 From 766de82b8e1c3289bd7158c2249f134cc2204046 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 22:48:35 +0000 Subject: [PATCH 04/10] Bump ruff from 0.1.15 to 0.3.0 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.15 to 0.3.0. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.1.15...v0.3.0) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3949ae4..11539fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,7 @@ test = [ "pytest-asyncio", "aiosqlite", "anyio[trio] >= 3.2.1", - "ruff ==0.1.15", + "ruff ==0.3.0", "mypy == 1.8.0", "autoflake", "ellar-cli >= 0.3.3", From 31adab1a494655d77c0845f0ca323558eee28da4 Mon Sep 17 00:00:00 2001 From: Ezeudoh Tochukwu Date: Sat, 2 Mar 2024 23:28:15 +0100 Subject: [PATCH 05/10] rearrangement lib dependencies --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 2 +- .github/workflows/test_full.yml | 4 ++-- Makefile | 3 ++- pyproject.toml | 28 ---------------------------- requirements-docs.txt | 8 ++++++++ requirements-tests.txt | 10 ++++++++++ requirements.txt | 10 ++++++++++ 8 files changed, 34 insertions(+), 33 deletions(-) create mode 100644 requirements-docs.txt create mode 100644 requirements-tests.txt create mode 100644 requirements.txt diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 74dcfd5..1216ae4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,7 +17,7 @@ jobs: - name: Install Flit run: pip install flit - name: Install Dependencies - run: flit install --symlink + run: make install - name: Install build dependencies run: pip install build - name: Build distribution diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 68a48c4..6dc6f9a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: - name: Install Flit run: pip install flit - name: Install Dependencies - run: flit install --symlink + run: make install - name: Test run: make test-cov - name: Coverage diff --git a/.github/workflows/test_full.yml b/.github/workflows/test_full.yml index 21b9463..fb64362 100644 --- a/.github/workflows/test_full.yml +++ b/.github/workflows/test_full.yml @@ -21,7 +21,7 @@ jobs: - name: Install Flit run: pip install flit - name: Install Dependencies - run: flit install --symlink + run: make install - name: Test run: pytest tests @@ -36,7 +36,7 @@ jobs: - name: Install Flit run: pip install flit - name: Install Dependencies - run: flit install --symlink + run: make install - name: Linting check run: ruff check ellar_sql tests - name: mypy diff --git a/Makefile b/Makefile index cd3a058..ddcf5e7 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,8 @@ clean: ## Removing cached python compiled files find . -name .ruff_cache | xargs rm -rfv install: ## Install dependencies - flit install --deps develop --symlink + pip install -r requirements.txt + flit install --symlink install-full: ## Install dependencies make install diff --git a/pyproject.toml b/pyproject.toml index 11539fe..81f5994 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,40 +37,12 @@ dependencies = [ "alembic >= 1.10.0" ] -dev = [ - "pre-commit" -] -doc = [ - "mkdocs >=1.1.2,<2.0.0", - "mkdocs-material >=7.1.9,<10.0.0", - "mdx-include >=1.4.1,<2.0.0", - "mkdocs-markdownextradata-plugin >=0.1.7,<0.3.0", - "markdown-include", - "mkdocstrings", - "mkdocs-minify-plugin", - "mkdocs-git-revision-date-localized-plugin" -] - [project.urls] Documentation = "https://github.com/python-ellar/ellar-sql" Source = "https://github.com/python-ellar/ellar-sql" Homepage = "https://python-ellar.github.io/ellar-sql/" "Bug Tracker" = "https://github.com/python-ellar/ellar-sql/issues" -[project.optional-dependencies] -test = [ - "pytest >= 7.1.3,< 9.0.0", - "pytest-cov >= 2.12.0,<5.0.0", - "pytest-asyncio", - "aiosqlite", - "anyio[trio] >= 3.2.1", - "ruff ==0.3.0", - "mypy == 1.8.0", - "autoflake", - "ellar-cli >= 0.3.3", - "factory-boy >= 3.3.0" -] - [tool.ruff] select = [ "E", # pycodestyle errors diff --git a/requirements-docs.txt b/requirements-docs.txt new file mode 100644 index 0000000..bc4600a --- /dev/null +++ b/requirements-docs.txt @@ -0,0 +1,8 @@ +markdown-include +mdx-include >=1.4.1,<2.0.0 +mkdocs >=1.1.2,<2.0.0 +mkdocs-git-revision-date-localized-plugin +mkdocs-markdownextradata-plugin >=0.1.7,<0.3.0 +mkdocs-material >=7.1.9,<10.0.0 +mkdocs-minify-plugin +mkdocstrings[python] >=0.19.0, <0.25.0 diff --git a/requirements-tests.txt b/requirements-tests.txt new file mode 100644 index 0000000..ea6dcc4 --- /dev/null +++ b/requirements-tests.txt @@ -0,0 +1,10 @@ +aiosqlite +anyio[trio] >= 3.2.1 +autoflake +ellar-cli >= 0.3.7 +factory-boy >= 3.3.0 +mypy == 1.8.0 +pytest >= 7.1.3,< 9.0.0 +pytest-asyncio +pytest-cov >= 2.12.0,<5.0.0 +ruff ==0.3.0 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..20e7d58 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,10 @@ +-e .[all] +-r requirements-docs.txt +-r requirements-tests.txt + +aiomcache + +pre-commit >=2.17.0,<4.0.0 +pylibmc +pymemcache +redis From 45751812f69684bc524eb526c6fc3968dbad87ae Mon Sep 17 00:00:00 2001 From: Ezeudoh Tochukwu Date: Sat, 2 Mar 2024 23:36:32 +0100 Subject: [PATCH 06/10] fixed failing test --- Makefile | 4 ++-- ellar_sql/model/base.py | 9 +++------ ellar_sql/model/table.py | 9 +++------ ellar_sql/pagination/view.py | 3 +-- requirements.txt | 7 +------ {examples => samples}/db-learning/README.md | 0 .../db-learning/db_learning/__init__.py | 0 {examples => samples}/db-learning/db_learning/command.py | 0 {examples => samples}/db-learning/db_learning/config.py | 6 +++--- .../db-learning/db_learning/controller.py | 0 .../db-learning/db_learning/migrations/README | 0 .../db-learning/db_learning/migrations/alembic.ini | 0 .../db-learning/db_learning/migrations/env.py | 0 .../db-learning/db_learning/migrations/script.py.mako | 0 .../2024_01_27_1031-aa924ee1b88a_initial_migration.py | 1 + {examples => samples}/db-learning/db_learning/models.py | 0 .../db-learning/db_learning/pagination/__init__.py | 0 .../db-learning/db_learning/pagination/api.py | 0 .../db-learning/db_learning/pagination/template.py | 0 .../db-learning/db_learning/root_module.py | 0 {examples => samples}/db-learning/db_learning/server.py | 0 .../db-learning/db_learning/templates/list.html | 0 {examples => samples}/db-learning/manage.py | 0 {examples => samples}/db-learning/requirements.txt | 0 {examples => samples}/db-learning/tests/__init__.py | 0 {examples => samples}/db-learning/tests/common.py | 0 {examples => samples}/db-learning/tests/conftest.py | 0 {examples => samples}/db-learning/tests/factories.py | 0 .../db-learning/tests/test_user_model.py | 0 {examples => samples}/index-script/main.py | 0 {examples => samples}/single-db/README.md | 2 +- {examples => samples}/single-db/db/__init__.py | 0 {examples => samples}/single-db/db/controllers.py | 0 {examples => samples}/single-db/db/migrations/README | 0 .../single-db/db/migrations/alembic.ini | 0 {examples => samples}/single-db/db/migrations/env.py | 0 .../single-db/db/migrations/script.py.mako | 0 .../migrations/versions/2024_01_01_1016-cce418606c45_.py | 1 + {examples => samples}/single-db/db/models/__init__.py | 0 {examples => samples}/single-db/db/models/base.py | 0 {examples => samples}/single-db/db/models/users.py | 0 {examples => samples}/single-db/db/module.py | 1 + {examples => samples}/single-db/db/tests/__init__.py | 0 .../single-db/db/tests/test_controllers.py | 0 {examples => samples}/single-db/db/tests/test_routers.py | 0 .../single-db/db/tests/test_services.py | 0 {examples => samples}/single-db/pyproject.toml | 0 {examples => samples}/single-db/single_db/__init__.py | 0 {examples => samples}/single-db/single_db/config.py | 6 +++--- {examples => samples}/single-db/single_db/root_module.py | 0 {examples => samples}/single-db/single_db/server.py | 0 {examples => samples}/single-db/tests/conftest.py | 0 52 files changed, 20 insertions(+), 29 deletions(-) rename {examples => samples}/db-learning/README.md (100%) rename {examples => samples}/db-learning/db_learning/__init__.py (100%) rename {examples => samples}/db-learning/db_learning/command.py (100%) rename {examples => samples}/db-learning/db_learning/config.py (96%) rename {examples => samples}/db-learning/db_learning/controller.py (100%) rename {examples => samples}/db-learning/db_learning/migrations/README (100%) rename {examples => samples}/db-learning/db_learning/migrations/alembic.ini (100%) rename {examples => samples}/db-learning/db_learning/migrations/env.py (100%) rename {examples => samples}/db-learning/db_learning/migrations/script.py.mako (100%) rename {examples => samples}/db-learning/db_learning/migrations/versions/2024_01_27_1031-aa924ee1b88a_initial_migration.py (99%) rename {examples => samples}/db-learning/db_learning/models.py (100%) rename {examples => samples}/db-learning/db_learning/pagination/__init__.py (100%) rename {examples => samples}/db-learning/db_learning/pagination/api.py (100%) rename {examples => samples}/db-learning/db_learning/pagination/template.py (100%) rename {examples => samples}/db-learning/db_learning/root_module.py (100%) rename {examples => samples}/db-learning/db_learning/server.py (100%) rename {examples => samples}/db-learning/db_learning/templates/list.html (100%) rename {examples => samples}/db-learning/manage.py (100%) rename {examples => samples}/db-learning/requirements.txt (100%) rename {examples => samples}/db-learning/tests/__init__.py (100%) rename {examples => samples}/db-learning/tests/common.py (100%) rename {examples => samples}/db-learning/tests/conftest.py (100%) rename {examples => samples}/db-learning/tests/factories.py (100%) rename {examples => samples}/db-learning/tests/test_user_model.py (100%) rename {examples => samples}/index-script/main.py (100%) rename {examples => samples}/single-db/README.md (98%) rename {examples => samples}/single-db/db/__init__.py (100%) rename {examples => samples}/single-db/db/controllers.py (100%) rename {examples => samples}/single-db/db/migrations/README (100%) rename {examples => samples}/single-db/db/migrations/alembic.ini (100%) rename {examples => samples}/single-db/db/migrations/env.py (100%) rename {examples => samples}/single-db/db/migrations/script.py.mako (100%) rename {examples => samples}/single-db/db/migrations/versions/2024_01_01_1016-cce418606c45_.py (99%) rename {examples => samples}/single-db/db/models/__init__.py (100%) rename {examples => samples}/single-db/db/models/base.py (100%) rename {examples => samples}/single-db/db/models/users.py (100%) rename {examples => samples}/single-db/db/module.py (99%) rename {examples => samples}/single-db/db/tests/__init__.py (100%) rename {examples => samples}/single-db/db/tests/test_controllers.py (100%) rename {examples => samples}/single-db/db/tests/test_routers.py (100%) rename {examples => samples}/single-db/db/tests/test_services.py (100%) rename {examples => samples}/single-db/pyproject.toml (100%) rename {examples => samples}/single-db/single_db/__init__.py (100%) rename {examples => samples}/single-db/single_db/config.py (96%) rename {examples => samples}/single-db/single_db/root_module.py (100%) rename {examples => samples}/single-db/single_db/server.py (100%) rename {examples => samples}/single-db/tests/conftest.py (100%) diff --git a/Makefile b/Makefile index ddcf5e7..86d9962 100644 --- a/Makefile +++ b/Makefile @@ -25,8 +25,8 @@ lint:fmt ## Run code linters mypy ellar_sql fmt format:clean ## Run code formatters - ruff format ellar_sql tests examples - ruff check --fix ellar_sql tests examples + ruff format ellar_sql tests samples + ruff check --fix ellar_sql tests samples test:clean ## Run tests pytest diff --git a/ellar_sql/model/base.py b/ellar_sql/model/base.py index 4bb5d9f..6ac41a4 100644 --- a/ellar_sql/model/base.py +++ b/ellar_sql/model/base.py @@ -157,14 +157,11 @@ class ModelBase(ModelDataExportMixin): __table_args__: t.Any - def __init__(self, **kwargs: t.Any) -> None: - ... + def __init__(self, **kwargs: t.Any) -> None: ... - def _sa_inspect_type(self) -> sa.Mapper["ModelBase"]: - ... + def _sa_inspect_type(self) -> sa.Mapper["ModelBase"]: ... - def _sa_inspect_instance(self) -> sa.InstanceState["ModelBase"]: - ... + def _sa_inspect_instance(self) -> sa.InstanceState["ModelBase"]: ... @classmethod def get_db_session( diff --git a/ellar_sql/model/table.py b/ellar_sql/model/table.py index e1166cf..9c06b4c 100644 --- a/ellar_sql/model/table.py +++ b/ellar_sql/model/table.py @@ -30,8 +30,7 @@ def __init__( *args: sa_sql_schema.SchemaItem, __database__: t.Optional[str] = None, **kwargs: t.Any, - ) -> None: - ... + ) -> None: ... @t.overload def __init__( @@ -40,14 +39,12 @@ def __init__( metadata: sa.MetaData, *args: sa_sql_schema.SchemaItem, **kwargs: t.Any, - ) -> None: - ... + ) -> None: ... @t.overload def __init__( self, name: str, *args: sa_sql_schema.SchemaItem, **kwargs: t.Any - ) -> None: - ... + ) -> None: ... def __init__( self, name: str, *args: sa_sql_schema.SchemaItem, **kwargs: t.Any diff --git a/ellar_sql/pagination/view.py b/ellar_sql/pagination/view.py index 3dbf250..4304268 100644 --- a/ellar_sql/pagination/view.py +++ b/ellar_sql/pagination/view.py @@ -65,8 +65,7 @@ def pagination_context( if t.TYPE_CHECKING: - def __init__(self, **kwargs: t.Any) -> None: - ... + def __init__(self, **kwargs: t.Any) -> None: ... class PageNumberPagination(PaginationBase): diff --git a/requirements.txt b/requirements.txt index 20e7d58..b058b1c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,5 @@ --e .[all] + -r requirements-docs.txt -r requirements-tests.txt -aiomcache - pre-commit >=2.17.0,<4.0.0 -pylibmc -pymemcache -redis diff --git a/examples/db-learning/README.md b/samples/db-learning/README.md similarity index 100% rename from examples/db-learning/README.md rename to samples/db-learning/README.md diff --git a/examples/db-learning/db_learning/__init__.py b/samples/db-learning/db_learning/__init__.py similarity index 100% rename from examples/db-learning/db_learning/__init__.py rename to samples/db-learning/db_learning/__init__.py diff --git a/examples/db-learning/db_learning/command.py b/samples/db-learning/db_learning/command.py similarity index 100% rename from examples/db-learning/db_learning/command.py rename to samples/db-learning/db_learning/command.py diff --git a/examples/db-learning/db_learning/config.py b/samples/db-learning/db_learning/config.py similarity index 96% rename from examples/db-learning/db_learning/config.py rename to samples/db-learning/db_learning/config.py index 716ab46..f453d54 100644 --- a/examples/db-learning/db_learning/config.py +++ b/samples/db-learning/db_learning/config.py @@ -61,9 +61,9 @@ class BaseConfig(ConfigDefaultTypesMixin): EXCEPTION_HANDLERS: t.List[IExceptionHandler] = [] # Object Serializer custom encoders - SERIALIZER_CUSTOM_ENCODER: t.Dict[ - t.Any, t.Callable[[t.Any], t.Any] - ] = encoders_by_type + SERIALIZER_CUSTOM_ENCODER: t.Dict[t.Any, t.Callable[[t.Any], t.Any]] = ( + encoders_by_type + ) class DevelopmentConfig(BaseConfig): diff --git a/examples/db-learning/db_learning/controller.py b/samples/db-learning/db_learning/controller.py similarity index 100% rename from examples/db-learning/db_learning/controller.py rename to samples/db-learning/db_learning/controller.py diff --git a/examples/db-learning/db_learning/migrations/README b/samples/db-learning/db_learning/migrations/README similarity index 100% rename from examples/db-learning/db_learning/migrations/README rename to samples/db-learning/db_learning/migrations/README diff --git a/examples/db-learning/db_learning/migrations/alembic.ini b/samples/db-learning/db_learning/migrations/alembic.ini similarity index 100% rename from examples/db-learning/db_learning/migrations/alembic.ini rename to samples/db-learning/db_learning/migrations/alembic.ini diff --git a/examples/db-learning/db_learning/migrations/env.py b/samples/db-learning/db_learning/migrations/env.py similarity index 100% rename from examples/db-learning/db_learning/migrations/env.py rename to samples/db-learning/db_learning/migrations/env.py diff --git a/examples/db-learning/db_learning/migrations/script.py.mako b/samples/db-learning/db_learning/migrations/script.py.mako similarity index 100% rename from examples/db-learning/db_learning/migrations/script.py.mako rename to samples/db-learning/db_learning/migrations/script.py.mako diff --git a/examples/db-learning/db_learning/migrations/versions/2024_01_27_1031-aa924ee1b88a_initial_migration.py b/samples/db-learning/db_learning/migrations/versions/2024_01_27_1031-aa924ee1b88a_initial_migration.py similarity index 99% rename from examples/db-learning/db_learning/migrations/versions/2024_01_27_1031-aa924ee1b88a_initial_migration.py rename to samples/db-learning/db_learning/migrations/versions/2024_01_27_1031-aa924ee1b88a_initial_migration.py index 5da3b82..718fa2d 100644 --- a/examples/db-learning/db_learning/migrations/versions/2024_01_27_1031-aa924ee1b88a_initial_migration.py +++ b/samples/db-learning/db_learning/migrations/versions/2024_01_27_1031-aa924ee1b88a_initial_migration.py @@ -5,6 +5,7 @@ Create Date: 2024-01-27 10:31:22.187308 """ + import sqlalchemy as sa from alembic import op diff --git a/examples/db-learning/db_learning/models.py b/samples/db-learning/db_learning/models.py similarity index 100% rename from examples/db-learning/db_learning/models.py rename to samples/db-learning/db_learning/models.py diff --git a/examples/db-learning/db_learning/pagination/__init__.py b/samples/db-learning/db_learning/pagination/__init__.py similarity index 100% rename from examples/db-learning/db_learning/pagination/__init__.py rename to samples/db-learning/db_learning/pagination/__init__.py diff --git a/examples/db-learning/db_learning/pagination/api.py b/samples/db-learning/db_learning/pagination/api.py similarity index 100% rename from examples/db-learning/db_learning/pagination/api.py rename to samples/db-learning/db_learning/pagination/api.py diff --git a/examples/db-learning/db_learning/pagination/template.py b/samples/db-learning/db_learning/pagination/template.py similarity index 100% rename from examples/db-learning/db_learning/pagination/template.py rename to samples/db-learning/db_learning/pagination/template.py diff --git a/examples/db-learning/db_learning/root_module.py b/samples/db-learning/db_learning/root_module.py similarity index 100% rename from examples/db-learning/db_learning/root_module.py rename to samples/db-learning/db_learning/root_module.py diff --git a/examples/db-learning/db_learning/server.py b/samples/db-learning/db_learning/server.py similarity index 100% rename from examples/db-learning/db_learning/server.py rename to samples/db-learning/db_learning/server.py diff --git a/examples/db-learning/db_learning/templates/list.html b/samples/db-learning/db_learning/templates/list.html similarity index 100% rename from examples/db-learning/db_learning/templates/list.html rename to samples/db-learning/db_learning/templates/list.html diff --git a/examples/db-learning/manage.py b/samples/db-learning/manage.py similarity index 100% rename from examples/db-learning/manage.py rename to samples/db-learning/manage.py diff --git a/examples/db-learning/requirements.txt b/samples/db-learning/requirements.txt similarity index 100% rename from examples/db-learning/requirements.txt rename to samples/db-learning/requirements.txt diff --git a/examples/db-learning/tests/__init__.py b/samples/db-learning/tests/__init__.py similarity index 100% rename from examples/db-learning/tests/__init__.py rename to samples/db-learning/tests/__init__.py diff --git a/examples/db-learning/tests/common.py b/samples/db-learning/tests/common.py similarity index 100% rename from examples/db-learning/tests/common.py rename to samples/db-learning/tests/common.py diff --git a/examples/db-learning/tests/conftest.py b/samples/db-learning/tests/conftest.py similarity index 100% rename from examples/db-learning/tests/conftest.py rename to samples/db-learning/tests/conftest.py diff --git a/examples/db-learning/tests/factories.py b/samples/db-learning/tests/factories.py similarity index 100% rename from examples/db-learning/tests/factories.py rename to samples/db-learning/tests/factories.py diff --git a/examples/db-learning/tests/test_user_model.py b/samples/db-learning/tests/test_user_model.py similarity index 100% rename from examples/db-learning/tests/test_user_model.py rename to samples/db-learning/tests/test_user_model.py diff --git a/examples/index-script/main.py b/samples/index-script/main.py similarity index 100% rename from examples/index-script/main.py rename to samples/index-script/main.py diff --git a/examples/single-db/README.md b/samples/single-db/README.md similarity index 98% rename from examples/single-db/README.md rename to samples/single-db/README.md index 4e9d856..eb6eb8b 100644 --- a/examples/single-db/README.md +++ b/samples/single-db/README.md @@ -23,4 +23,4 @@ ellar db upgrade ```shell ellar runserver --reload ``` -then, visit [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs) \ No newline at end of file +then, visit [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs) diff --git a/examples/single-db/db/__init__.py b/samples/single-db/db/__init__.py similarity index 100% rename from examples/single-db/db/__init__.py rename to samples/single-db/db/__init__.py diff --git a/examples/single-db/db/controllers.py b/samples/single-db/db/controllers.py similarity index 100% rename from examples/single-db/db/controllers.py rename to samples/single-db/db/controllers.py diff --git a/examples/single-db/db/migrations/README b/samples/single-db/db/migrations/README similarity index 100% rename from examples/single-db/db/migrations/README rename to samples/single-db/db/migrations/README diff --git a/examples/single-db/db/migrations/alembic.ini b/samples/single-db/db/migrations/alembic.ini similarity index 100% rename from examples/single-db/db/migrations/alembic.ini rename to samples/single-db/db/migrations/alembic.ini diff --git a/examples/single-db/db/migrations/env.py b/samples/single-db/db/migrations/env.py similarity index 100% rename from examples/single-db/db/migrations/env.py rename to samples/single-db/db/migrations/env.py diff --git a/examples/single-db/db/migrations/script.py.mako b/samples/single-db/db/migrations/script.py.mako similarity index 100% rename from examples/single-db/db/migrations/script.py.mako rename to samples/single-db/db/migrations/script.py.mako diff --git a/examples/single-db/db/migrations/versions/2024_01_01_1016-cce418606c45_.py b/samples/single-db/db/migrations/versions/2024_01_01_1016-cce418606c45_.py similarity index 99% rename from examples/single-db/db/migrations/versions/2024_01_01_1016-cce418606c45_.py rename to samples/single-db/db/migrations/versions/2024_01_01_1016-cce418606c45_.py index 2c7151c..9d891d6 100644 --- a/examples/single-db/db/migrations/versions/2024_01_01_1016-cce418606c45_.py +++ b/samples/single-db/db/migrations/versions/2024_01_01_1016-cce418606c45_.py @@ -5,6 +5,7 @@ Create Date: 2024-01-01 10:16:49.511421 """ + import sqlalchemy as sa from alembic import op diff --git a/examples/single-db/db/models/__init__.py b/samples/single-db/db/models/__init__.py similarity index 100% rename from examples/single-db/db/models/__init__.py rename to samples/single-db/db/models/__init__.py diff --git a/examples/single-db/db/models/base.py b/samples/single-db/db/models/base.py similarity index 100% rename from examples/single-db/db/models/base.py rename to samples/single-db/db/models/base.py diff --git a/examples/single-db/db/models/users.py b/samples/single-db/db/models/users.py similarity index 100% rename from examples/single-db/db/models/users.py rename to samples/single-db/db/models/users.py diff --git a/examples/single-db/db/module.py b/samples/single-db/db/module.py similarity index 99% rename from examples/single-db/db/module.py rename to samples/single-db/db/module.py index 0dfb75a..07b1275 100644 --- a/examples/single-db/db/module.py +++ b/samples/single-db/db/module.py @@ -17,6 +17,7 @@ def register_providers(self, container: Container) -> None: pass """ + from ellar.app import App from ellar.common import IApplicationStartup, Module from ellar.core import ModuleBase diff --git a/examples/single-db/db/tests/__init__.py b/samples/single-db/db/tests/__init__.py similarity index 100% rename from examples/single-db/db/tests/__init__.py rename to samples/single-db/db/tests/__init__.py diff --git a/examples/single-db/db/tests/test_controllers.py b/samples/single-db/db/tests/test_controllers.py similarity index 100% rename from examples/single-db/db/tests/test_controllers.py rename to samples/single-db/db/tests/test_controllers.py diff --git a/examples/single-db/db/tests/test_routers.py b/samples/single-db/db/tests/test_routers.py similarity index 100% rename from examples/single-db/db/tests/test_routers.py rename to samples/single-db/db/tests/test_routers.py diff --git a/examples/single-db/db/tests/test_services.py b/samples/single-db/db/tests/test_services.py similarity index 100% rename from examples/single-db/db/tests/test_services.py rename to samples/single-db/db/tests/test_services.py diff --git a/examples/single-db/pyproject.toml b/samples/single-db/pyproject.toml similarity index 100% rename from examples/single-db/pyproject.toml rename to samples/single-db/pyproject.toml diff --git a/examples/single-db/single_db/__init__.py b/samples/single-db/single_db/__init__.py similarity index 100% rename from examples/single-db/single_db/__init__.py rename to samples/single-db/single_db/__init__.py diff --git a/examples/single-db/single_db/config.py b/samples/single-db/single_db/config.py similarity index 96% rename from examples/single-db/single_db/config.py rename to samples/single-db/single_db/config.py index 95ea24d..c9805cd 100644 --- a/examples/single-db/single_db/config.py +++ b/samples/single-db/single_db/config.py @@ -61,9 +61,9 @@ class BaseConfig(ConfigDefaultTypesMixin): EXCEPTION_HANDLERS: t.List[IExceptionHandler] = [] # Object Serializer custom encoders - SERIALIZER_CUSTOM_ENCODER: t.Dict[ - t.Any, t.Callable[[t.Any], t.Any] - ] = encoders_by_type + SERIALIZER_CUSTOM_ENCODER: t.Dict[t.Any, t.Callable[[t.Any], t.Any]] = ( + encoders_by_type + ) class DevelopmentConfig(BaseConfig): diff --git a/examples/single-db/single_db/root_module.py b/samples/single-db/single_db/root_module.py similarity index 100% rename from examples/single-db/single_db/root_module.py rename to samples/single-db/single_db/root_module.py diff --git a/examples/single-db/single_db/server.py b/samples/single-db/single_db/server.py similarity index 100% rename from examples/single-db/single_db/server.py rename to samples/single-db/single_db/server.py diff --git a/examples/single-db/tests/conftest.py b/samples/single-db/tests/conftest.py similarity index 100% rename from examples/single-db/tests/conftest.py rename to samples/single-db/tests/conftest.py From 4e7e84cf60b3785752c33b9c7e25b198c80cf980 Mon Sep 17 00:00:00 2001 From: Ezeudoh Tochukwu Date: Sat, 2 Mar 2024 23:38:52 +0100 Subject: [PATCH 07/10] fixed failing test --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b058b1c..8abc45a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ - +-e . -r requirements-docs.txt -r requirements-tests.txt From 0f513f0782a84ecffa4a431022e0981b9d9744bf Mon Sep 17 00:00:00 2001 From: Ezeudoh Tochukwu Date: Sat, 2 Mar 2024 23:40:54 +0100 Subject: [PATCH 08/10] fixed error due to example rename --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index b1f9d2f..d41bf17 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,7 +2,7 @@ addopts = --strict-config --strict-markers xfail_strict = true junit_family = "xunit2" -norecursedirs = examples/* +norecursedirs = samples/* [pytest-watch] runner= pytest --failed-first --maxfail=1 --no-success-flaky-report From 332877a47beea56935c7cef5ee43e368d35a9aa3 Mon Sep 17 00:00:00 2001 From: Ezeudoh Tochukwu Date: Mon, 4 Mar 2024 11:36:56 +0100 Subject: [PATCH 09/10] fixed ellar-cli dependency --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 81f5994..4c50a6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ classifiers = [ ] dependencies = [ - "ellar >= 0.7.0", + "ellar-cli >= 0.3.7", "sqlalchemy >= 2.0.23", "alembic >= 1.10.0" ] From d5a4ffdcf2af7dfcbaa71f8a55f7e777c95aadce Mon Sep 17 00:00:00 2001 From: Tochukwu Date: Mon, 4 Mar 2024 11:43:59 +0100 Subject: [PATCH 10/10] 0.0.4 --- ellar_sql/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ellar_sql/__init__.py b/ellar_sql/__init__.py index 200fb86..04c3003 100644 --- a/ellar_sql/__init__.py +++ b/ellar_sql/__init__.py @@ -1,6 +1,6 @@ """EllarSQL Module adds support for SQLAlchemy and Alembic package to your Ellar application""" -__version__ = "0.0.2" +__version__ = "0.0.4" from .model.database_binds import get_all_metadata, get_metadata from .module import EllarSQLModule pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy