| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,12 @@ on: | |||
| 3 | 3 | push: | |
| 4 | 4 | pull_request: | |
| 5 | 5 | types: [opened, synchronize] | |
| 6 | + workflow_dispatch: | ||
| 7 | + inputs: | ||
| 8 | + debug_enabled: | ||
| 9 | + description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | ||
| 10 | + required: false | ||
| 11 | + default: false | ||
| 6 | 12 | jobs: | |
| 7 | 13 | build-docs: | |
| 8 | 14 | runs-on: ubuntu-20.04 | |
@@ -16,32 +22,39 @@ jobs: | |||
| 16 | 22 | uses: actions/setup-python@v2 | |
| 17 | 23 | with: | |
| 18 | 24 | python-version: "3.7" | |
| 25 | + # Allow debugging with tmate | ||
| 26 | + - name: Setup tmate session | ||
| 27 | + uses: mxschmitt/action-tmate@v3 | ||
| 28 | + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }} | ||
| 29 | + with: | ||
| 30 | + limit-access-to-actor: true | ||
| 19 | 31 | - uses: actions/cache@v2 | |
| 20 | 32 | id: cache | |
| 21 | 33 | with: | |
| 22 | 34 | path: ${{ env.pythonLocation }} | |
| 23 | - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-docs | ||
| 35 | + key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root-docs | ||
| 24 | 36 | - name: Install poetry | |
| 25 | 37 | if: steps.cache.outputs.cache-hit != 'true' | |
| 38 | + # TODO: remove python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2 | ||
| 39 | + # once there's a release of Poetry 1.2.x including poetry-core > 1.1.0a6 | ||
| 40 | + # Ref: https://github.com/python-poetry/poetry-core/pull/188 | ||
| 26 | 41 | run: | | |
| 27 | 42 | python -m pip install --upgrade pip | |
| 28 | - python -m pip install "poetry>=1.2.0a1" | ||
| 29 | - python -m poetry plugin add poetry-version-plugin | ||
| 43 | + python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2 | ||
| 44 | + python -m pip install "poetry==1.2.0a2" | ||
| 45 | + python -m poetry plugin add poetry-version-plugin | ||
| 30 | 46 | - name: Configure poetry | |
| 31 | - run: python -m poetry config virtualenvs.in-project true | ||
| 32 | - - name: Ensure cache is healthy | ||
| 33 | - if: steps.cache.outputs.cache-hit == 'true' | ||
| 34 | - run: python -m poetry run pip --version >/dev/null 2>&1 || rm -rf .venv | ||
| 47 | + run: python -m poetry config virtualenvs.create false | ||
| 35 | 48 | - name: Install Dependencies | |
| 36 | 49 | if: steps.cache.outputs.cache-hit != 'true' | |
| 37 | 50 | run: python -m poetry install | |
| 38 | 51 | - name: Install Material for MkDocs Insiders | |
| 39 | 52 | if: github.event.pull_request.head.repo.fork == false && steps.cache.outputs.cache-hit != 'true' | |
| 40 | - run: pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git | ||
| 53 | + run: python -m poetry run pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git | ||
| 41 | 54 | - name: Build Docs | |
| 42 | - run: python3.7 -m mkdocs build | ||
| 55 | + run: python -m poetry run mkdocs build | ||
| 43 | 56 | - name: Zip docs | |
| 44 | - run: bash ./scripts/zip-docs.sh | ||
| 57 | + run: python -m poetry run bash ./scripts/zip-docs.sh | ||
| 45 | 58 | - uses: actions/upload-artifact@v2 | |
| 46 | 59 | with: | |
| 47 | 60 | name: docs-zip | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,12 @@ on: | |||
| 4 | 4 | release: | |
| 5 | 5 | types: | |
| 6 | 6 | - created | |
| 7 | + workflow_dispatch: | ||
| 8 | + inputs: | ||
| 9 | + debug_enabled: | ||
| 10 | + description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | ||
| 11 | + required: false | ||
| 12 | + default: false | ||
| 7 | 13 | ||
| 8 | 14 | jobs: | |
| 9 | 15 | publish: | |
@@ -14,22 +20,29 @@ jobs: | |||
| 14 | 20 | uses: actions/setup-python@v2 | |
| 15 | 21 | with: | |
| 16 | 22 | python-version: "3.7" | |
| 23 | + # Allow debugging with tmate | ||
| 24 | + - name: Setup tmate session | ||
| 25 | + uses: mxschmitt/action-tmate@v3 | ||
| 26 | + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }} | ||
| 27 | + with: | ||
| 28 | + limit-access-to-actor: true | ||
| 17 | 29 | - uses: actions/cache@v2 | |
| 18 | 30 | id: cache | |
| 19 | 31 | with: | |
| 20 | 32 | path: ${{ env.pythonLocation }} | |
| 21 | - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test | ||
| 33 | + key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root | ||
| 22 | 34 | - name: Install poetry | |
| 23 | 35 | if: steps.cache.outputs.cache-hit != 'true' | |
| 36 | + # TODO: remove python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2 | ||
| 37 | + # once there's a release of Poetry 1.2.x including poetry-core > 1.1.0a6 | ||
| 38 | + # Ref: https://github.com/python-poetry/poetry-core/pull/188 | ||
| 24 | 39 | run: | | |
| 25 | 40 | python -m pip install --upgrade pip | |
| 26 | - python -m pip install "poetry>=1.2.0a1" | ||
| 27 | - python -m poetry plugin add poetry-version-plugin | ||
| 41 | + python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2 | ||
| 42 | + python -m pip install "poetry==1.2.0a2" | ||
| 43 | + python -m poetry plugin add poetry-version-plugin | ||
| 28 | 44 | - name: Configure poetry | |
| 29 | - run: python -m poetry config virtualenvs.in-project true | ||
| 30 | - - name: Ensure cache is healthy | ||
| 31 | - if: steps.cache.outputs.cache-hit == 'true' | ||
| 32 | - run: python -m poetry run pip --version >/dev/null 2>&1 || rm -rf .venv | ||
| 45 | + run: python -m poetry config virtualenvs.create false | ||
| 33 | 46 | - name: Install Dependencies | |
| 34 | 47 | if: steps.cache.outputs.cache-hit != 'true' | |
| 35 | 48 | run: python -m poetry install | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,12 @@ on: | |||
| 4 | 4 | push: | |
| 5 | 5 | pull_request: | |
| 6 | 6 | types: [opened, synchronize] | |
| 7 | + workflow_dispatch: | ||
| 8 | + inputs: | ||
| 9 | + debug_enabled: | ||
| 10 | + description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | ||
| 11 | + required: false | ||
| 12 | + default: false | ||
| 7 | 13 | ||
| 8 | 14 | jobs: | |
| 9 | 15 | test: | |
@@ -19,26 +25,36 @@ jobs: | |||
| 19 | 25 | uses: actions/setup-python@v2 | |
| 20 | 26 | with: | |
| 21 | 27 | python-version: ${{ matrix.python-version }} | |
| 28 | + # Allow debugging with tmate | ||
| 29 | + - name: Setup tmate session | ||
| 30 | + uses: mxschmitt/action-tmate@v3 | ||
| 31 | + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }} | ||
| 32 | + with: | ||
| 33 | + limit-access-to-actor: true | ||
| 22 | 34 | - uses: actions/cache@v2 | |
| 23 | 35 | id: cache | |
| 24 | 36 | with: | |
| 25 | 37 | path: ${{ env.pythonLocation }} | |
| 26 | - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test | ||
| 38 | + key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root | ||
| 27 | 39 | - name: Install poetry | |
| 28 | 40 | if: steps.cache.outputs.cache-hit != 'true' | |
| 41 | + # TODO: remove python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2 | ||
| 42 | + # once there's a release of Poetry 1.2.x including poetry-core > 1.1.0a6 | ||
| 43 | + # Ref: https://github.com/python-poetry/poetry-core/pull/188 | ||
| 29 | 44 | run: | | |
| 30 | 45 | python -m pip install --upgrade pip | |
| 31 | - python -m pip install "poetry>=1.2.0a1" | ||
| 32 | - python -m poetry plugin add poetry-version-plugin | ||
| 46 | + python -m pip install --force git+https://github.com/python-poetry/poetry-core.git@ad33bc2 | ||
| 47 | + python -m pip install "poetry==1.2.0a2" | ||
| 48 | + python -m poetry plugin add poetry-version-plugin | ||
| 33 | 49 | - name: Configure poetry | |
| 34 | - run: python -m poetry config virtualenvs.in-project true | ||
| 35 | - - name: Ensure cache is healthy | ||
| 36 | - if: steps.cache.outputs.cache-hit == 'true' | ||
| 37 | - run: python -m poetry run pip --version >/dev/null 2>&1 || rm -rf .venv | ||
| 50 | + run: python -m poetry config virtualenvs.create false | ||
| 38 | 51 | - name: Install Dependencies | |
| 39 | 52 | if: steps.cache.outputs.cache-hit != 'true' | |
| 40 | 53 | run: python -m poetry install | |
| 54 | + - name: Lint | ||
| 55 | + if: ${{ matrix.python-version != '3.6' }} | ||
| 56 | + run: python -m poetry run bash scripts/lint.sh | ||
| 41 | 57 | - name: Test | |
| 42 | - run: bash scripts/test.sh | ||
| 58 | + run: python -m poetry run bash scripts/test.sh | ||
| 43 | 59 | - name: Upload coverage | |
| 44 | 60 | uses: codecov/codecov-action@v1 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,6 +47,9 @@ coverage = {extras = ["toml"], version = "^5.5"} | |||
| 47 | 47 | fastapi = "^0.68.0" | |
| 48 | 48 | requests = "^2.26.0" | |
| 49 | 49 | autoflake = "^1.4" | |
| 50 | + isort = "^5.9.3" | ||
| 51 | + async_generator = {version = "*", python = "~3.6"} | ||
| 52 | + async-exit-stack = {version = "*", python = "~3.6"} | ||
| 50 | 53 | ||
| 51 | 54 | [build-system] | |
| 52 | 55 | requires = ["poetry-core"] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,3 +6,4 @@ set -x | |||
| 6 | 6 | coverage run -m pytest tests | |
| 7 | 7 | coverage combine | |
| 8 | 8 | coverage report --show-missing | |
| 9 | + coverage xml | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,9 @@ | |||
| 1 | + #! /usr/bin/env bash | ||
| 2 | + | ||
| 3 | + set -x | ||
| 4 | + set -e | ||
| 5 | + | ||
| 6 | + if [ -f docs.zip ]; then | ||
| 7 | + rm -rf docs.zip | ||
| 8 | + fi | ||
| 9 | + zip -r docs.zip ./site | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,6 @@ | |||
| 12 | 12 | Callable, | |
| 13 | 13 | ClassVar, | |
| 14 | 14 | Dict, | |
| 15 | - ForwardRef, | ||
| 16 | 15 | List, | |
| 17 | 16 | Mapping, | |
| 18 | 17 | Optional, | |
@@ -30,7 +29,7 @@ | |||
| 30 | 29 | from pydantic.fields import FieldInfo as PydanticFieldInfo | |
| 31 | 30 | from pydantic.fields import ModelField, Undefined, UndefinedType | |
| 32 | 31 | from pydantic.main import BaseConfig, ModelMetaclass, validate_model | |
| 33 | - from pydantic.typing import NoArgAnyCallable, resolve_annotations | ||
| 32 | + from pydantic.typing import ForwardRef, NoArgAnyCallable, resolve_annotations | ||
| 34 | 33 | from pydantic.utils import ROOT_KEY, Representation | |
| 35 | 34 | from sqlalchemy import ( | |
| 36 | 35 | Boolean, | |
@@ -343,7 +342,7 @@ def __init__( | |||
| 343 | 342 | ) | |
| 344 | 343 | relationship_to = temp_field.type_ | |
| 345 | 344 | if isinstance(temp_field.type_, ForwardRef): | |
| 346 | - relationship_to = temp_field.type_.__forward_arg__ | ||
| 345 | + relationship_to = temp_field.type_.__forward_arg__ # type: ignore | ||
| 347 | 346 | rel_kwargs: Dict[str, Any] = {} | |
| 348 | 347 | if rel_info.back_populates: | |
| 349 | 348 | rel_kwargs["back_populates"] = rel_info.back_populates | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - from typing import Any, Mapping, Optional, Sequence, TypeVar, Union, overload | ||
| 1 | + from typing import Any, Mapping, Optional, Sequence, Type, TypeVar, Union, overload | ||
| 2 | 2 | ||
| 3 | 3 | from sqlalchemy import util | |
| 4 | 4 | from sqlalchemy.orm import Query as _Query | |
@@ -118,13 +118,13 @@ def query(self, *entities: Any, **kwargs: Any) -> "_Query[Any]": | |||
| 118 | 118 | ||
| 119 | 119 | def get( | |
| 120 | 120 | self, | |
| 121 | - entity: _T, | ||
| 121 | + entity: Type[_T], | ||
| 122 | 122 | ident: Any, | |
| 123 | 123 | options: Optional[Sequence[Any]] = None, | |
| 124 | 124 | populate_existing: bool = False, | |
| 125 | 125 | with_for_update: Optional[Union[Literal[True], Mapping[str, Any]]] = None, | |
| 126 | 126 | identity_token: Optional[Any] = None, | |
| 127 | - ) -> _T: | ||
| 127 | + ) -> Optional[_T]: | ||
| 128 | 128 | return super().get( | |
| 129 | 129 | entity, | |
| 130 | 130 | ident, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,10 +45,10 @@ class SelectOfScalar(_Select, Generic[_TSelect]): | |||
| 45 | 45 | class GenericSelectMeta(GenericMeta, _Select.__class__): # type: ignore | |
| 46 | 46 | pass | |
| 47 | 47 | ||
| 48 | - class _Py36Select(_Select, Generic[_TSelect], metaclass=GenericSelectMeta): | ||
| 48 | + class _Py36Select(_Select, Generic[_TSelect], metaclass=GenericSelectMeta): # type: ignore | ||
| 49 | 49 | pass | |
| 50 | 50 | ||
| 51 | - class _Py36SelectOfScalar(_Select, Generic[_TSelect], metaclass=GenericSelectMeta): | ||
| 51 | + class _Py36SelectOfScalar(_Select, Generic[_TSelect], metaclass=GenericSelectMeta): # type: ignore | ||
| 52 | 52 | pass | |
| 53 | 53 | ||
| 54 | 54 | # Cast them for editors to work correctly, from several tricks tried, this works | |
| Back | FazBrowse Home | New Git URL |
0 commit comments