From ef8751f39a8aace87dc52d50c2987b588c2f92de Mon Sep 17 00:00:00 2001 From: Jina Dev Bot Date: Tue, 17 Dec 2024 18:21:28 +0000 Subject: [PATCH] style: fix overload and cli autocomplete --- .github/workflows/cd.yml | 12 ++++++------ .github/workflows/ci.yml | 12 ++++++------ .github/workflows/force-docs-build.yml | 1 - Dockerfiles/debianx.Dockerfile | 2 +- Dockerfiles/pip-perf.Dockerfile | 2 +- Dockerfiles/pip.Dockerfile | 2 +- Dockerfiles/test-pip.Dockerfile | 2 +- jina/orchestrate/deployments/__init__.py | 8 ++++---- jina/orchestrate/flow/base.py | 12 ++++++------ jina/serve/executors/__init__.py | 8 ++++---- tests/integration/docarray_v2/test_v2.py | 6 +++--- 11 files changed, 33 insertions(+), 34 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 943b5e1f6b5a1..2ca14ebcace24 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -106,7 +106,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.8] + python-version: ["3.10"] protobuf-version: ['==3.19.6', ''] steps: - uses: actions/checkout@v2.5.0 @@ -127,7 +127,7 @@ jobs: - name: Build wheels with setuptools-golang-build-manylinux-wheel run: | - setuptools-golang-build-manylinux-wheels --pythons cp38-cp38 + setuptools-golang-build-manylinux-wheels --pythons cp310-cp310 - name: Prepare environment run: | docker build -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip . @@ -180,7 +180,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.8] + python-version: ["3.10"] protobuf-version: ['==3.19.6', ''] steps: - uses: actions/checkout@v2.5.0 @@ -202,7 +202,7 @@ jobs: - name: Build wheels with setuptools-golang-build-manylinux-wheel run: | - setuptools-golang-build-manylinux-wheels --pythons cp38-cp38 + setuptools-golang-build-manylinux-wheels --pythons cp310-cp310 - name: Prepare environment run: | docker build -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip . @@ -448,7 +448,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.10] + python-version: ["3.10"] test-path: ${{fromJson(needs.prep-testbed.outputs.matrix)}} steps: - uses: actions/checkout@v2.5.0 @@ -470,7 +470,7 @@ jobs: - name: Build wheels with setuptools-golang-build-manylinux-wheel run: | - setuptools-golang-build-manylinux-wheels --pythons cp38-cp38 + setuptools-golang-build-manylinux-wheels --pythons cp310-cp310 - name: Prepare environment run: | docker build --build-arg DOCARRAY_VERSION="0.21.0" -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip . diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e3e23b51e916..a854741d1f1c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -439,7 +439,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.10] + python-version: ["3.10"] protobuf-version: ['==3.19.6', ''] steps: - uses: actions/checkout@v2.5.0 @@ -461,7 +461,7 @@ jobs: - name: Build wheels with setuptools-golang-build-manylinux-wheel run: | - setuptools-golang-build-manylinux-wheels --pythons cp38-cp38 + setuptools-golang-build-manylinux-wheels --pythons cp310-cp310 - name: Prepare environment run: | docker build -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip . @@ -515,7 +515,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.10] + python-version: ["3.10"] protobuf-version: ['==3.19.6', ''] steps: - uses: actions/checkout@v2.5.0 @@ -537,7 +537,7 @@ jobs: - name: Build wheels with setuptools-golang-build-manylinux-wheel run: | - setuptools-golang-build-manylinux-wheels --pythons cp38-cp38 + setuptools-golang-build-manylinux-wheels --pythons cp310-cp310 - name: Prepare environment run: | docker build -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip . @@ -700,7 +700,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.10] + python-version: ["3.10"] test-path: ${{fromJson(needs.prep-testbed.outputs.matrix)}} steps: - uses: actions/checkout@v2.5.0 @@ -722,7 +722,7 @@ jobs: - name: Build wheels with setuptools-golang-build-manylinux-wheel run: | - setuptools-golang-build-manylinux-wheels --pythons cp38-cp38 + setuptools-golang-build-manylinux-wheels --pythons cp310-cp310 - name: Prepare environment run: | docker build --build-arg DOCARRAY_VERSION="0.21.0" -f Dockerfiles/test-pip.Dockerfile -t jinaai/jina:test-pip . diff --git a/.github/workflows/force-docs-build.yml b/.github/workflows/force-docs-build.yml index a7ad0001c340a..2c67cbc2ed61a 100644 --- a/.github/workflows/force-docs-build.yml +++ b/.github/workflows/force-docs-build.yml @@ -80,7 +80,6 @@ jobs: run: | touch /tmp/gen-html/.nojekyll cp ./docs/_versions.json /tmp/gen-html/_versions.json - cp ./docs/CNAME /tmp/gen-html/CNAME cp /tmp/gen-html/404/index.html /tmp/gen-html/404.html sed -i 's/href="\.\./href="/' /tmp/gen-html/404.html # fix asset urls that needs to be updated in 404.html - name: Moving old doc versions diff --git a/Dockerfiles/debianx.Dockerfile b/Dockerfiles/debianx.Dockerfile index 4c2c414e83d7c..8538ce6507879 100644 --- a/Dockerfiles/debianx.Dockerfile +++ b/Dockerfiles/debianx.Dockerfile @@ -1,5 +1,5 @@ # !!! An ARG declared before a FROM is outside of a build stage, so it can’t be used in any instruction after a FROM -ARG PY_VERSION=3.7 +ARG PY_VERSION=3.10 FROM python:${PY_VERSION}-slim AS jina_dep diff --git a/Dockerfiles/pip-perf.Dockerfile b/Dockerfiles/pip-perf.Dockerfile index 52f28f2c0af1c..4e942532c802a 100644 --- a/Dockerfiles/pip-perf.Dockerfile +++ b/Dockerfiles/pip-perf.Dockerfile @@ -1,4 +1,4 @@ -ARG PY_VERSION=3.7 +ARG PY_VERSION=3.10 ARG PIP_TAG FROM python:${PY_VERSION}-slim diff --git a/Dockerfiles/pip.Dockerfile b/Dockerfiles/pip.Dockerfile index 7172c449b29a8..0a660b472c238 100644 --- a/Dockerfiles/pip.Dockerfile +++ b/Dockerfiles/pip.Dockerfile @@ -1,4 +1,4 @@ -ARG PY_VERSION=3.8 +ARG PY_VERSION=3.10 ARG PIP_TAG FROM python:${PY_VERSION}-slim diff --git a/Dockerfiles/test-pip.Dockerfile b/Dockerfiles/test-pip.Dockerfile index 43a1124990501..5e7d9752360e2 100644 --- a/Dockerfiles/test-pip.Dockerfile +++ b/Dockerfiles/test-pip.Dockerfile @@ -1,4 +1,4 @@ -ARG PY_VERSION=3.8 +ARG PY_VERSION=3.10 FROM python:${PY_VERSION}-slim diff --git a/jina/orchestrate/deployments/__init__.py b/jina/orchestrate/deployments/__init__.py index 1676868db2cae..e4b6c3a5bc122 100644 --- a/jina/orchestrate/deployments/__init__.py +++ b/jina/orchestrate/deployments/__init__.py @@ -262,7 +262,7 @@ def __init__( docker_kwargs: Optional[dict] = None, entrypoint: Optional[str] = None, env: Optional[dict] = None, - exit_on_exceptions: Optional[List[str]] = [], + exit_on_exceptions: Optional[List] = [], external: Optional[bool] = False, floating: Optional[bool] = False, force_update: Optional[bool] = False, @@ -270,7 +270,7 @@ def __init__( grpc_channel_options: Optional[dict] = None, grpc_metadata: Optional[dict] = None, grpc_server_options: Optional[dict] = None, - host: Optional[List[str]] = ['0.0.0.0'], + host: Optional[List] = ['0.0.0.0'], install_requirements: Optional[bool] = False, log_config: Optional[str] = None, metrics: Optional[bool] = False, @@ -288,7 +288,7 @@ def __init__( protocol: Optional[Union[str, List[str]]] = ['GRPC'], provider: Optional[str] = ['NONE'], provider_endpoint: Optional[str] = None, - py_modules: Optional[List[str]] = None, + py_modules: Optional[List] = None, quiet: Optional[bool] = False, quiet_error: Optional[bool] = False, raft_configuration: Optional[dict] = None, @@ -318,7 +318,7 @@ def __init__( uses_requests: Optional[dict] = None, uses_with: Optional[dict] = None, uvicorn_kwargs: Optional[dict] = None, - volumes: Optional[List[str]] = None, + volumes: Optional[List] = None, when: Optional[dict] = None, workspace: Optional[str] = None, **kwargs, diff --git a/jina/orchestrate/flow/base.py b/jina/orchestrate/flow/base.py index 6e83ff30f014b..8e66b1a37fd5a 100644 --- a/jina/orchestrate/flow/base.py +++ b/jina/orchestrate/flow/base.py @@ -202,7 +202,7 @@ def __init__( provider: Optional[str] = ['NONE'], provider_endpoint: Optional[str] = None, proxy: Optional[bool] = False, - py_modules: Optional[List[str]] = None, + py_modules: Optional[List] = None, quiet: Optional[bool] = False, quiet_error: Optional[bool] = False, reload: Optional[bool] = False, @@ -848,7 +848,7 @@ def add( docker_kwargs: Optional[dict] = None, entrypoint: Optional[str] = None, env: Optional[dict] = None, - exit_on_exceptions: Optional[List[str]] = [], + exit_on_exceptions: Optional[List] = [], external: Optional[bool] = False, floating: Optional[bool] = False, force_update: Optional[bool] = False, @@ -856,7 +856,7 @@ def add( grpc_channel_options: Optional[dict] = None, grpc_metadata: Optional[dict] = None, grpc_server_options: Optional[dict] = None, - host: Optional[List[str]] = ['0.0.0.0'], + host: Optional[List] = ['0.0.0.0'], install_requirements: Optional[bool] = False, log_config: Optional[str] = None, metrics: Optional[bool] = False, @@ -874,7 +874,7 @@ def add( protocol: Optional[Union[str, List[str]]] = ['GRPC'], provider: Optional[str] = ['NONE'], provider_endpoint: Optional[str] = None, - py_modules: Optional[List[str]] = None, + py_modules: Optional[List] = None, quiet: Optional[bool] = False, quiet_error: Optional[bool] = False, raft_configuration: Optional[dict] = None, @@ -904,7 +904,7 @@ def add( uses_requests: Optional[dict] = None, uses_with: Optional[dict] = None, uvicorn_kwargs: Optional[dict] = None, - volumes: Optional[List[str]] = None, + volumes: Optional[List] = None, when: Optional[dict] = None, workspace: Optional[str] = None, **kwargs, @@ -1336,7 +1336,7 @@ def config_gateway( provider: Optional[str] = ['NONE'], provider_endpoint: Optional[str] = None, proxy: Optional[bool] = False, - py_modules: Optional[List[str]] = None, + py_modules: Optional[List] = None, quiet: Optional[bool] = False, quiet_error: Optional[bool] = False, reload: Optional[bool] = False, diff --git a/jina/serve/executors/__init__.py b/jina/serve/executors/__init__.py index 59bb9f8760344..4cc7754c83b08 100644 --- a/jina/serve/executors/__init__.py +++ b/jina/serve/executors/__init__.py @@ -1002,7 +1002,7 @@ def serve( docker_kwargs: Optional[dict] = None, entrypoint: Optional[str] = None, env: Optional[dict] = None, - exit_on_exceptions: Optional[List[str]] = [], + exit_on_exceptions: Optional[List] = [], external: Optional[bool] = False, floating: Optional[bool] = False, force_update: Optional[bool] = False, @@ -1010,7 +1010,7 @@ def serve( grpc_channel_options: Optional[dict] = None, grpc_metadata: Optional[dict] = None, grpc_server_options: Optional[dict] = None, - host: Optional[List[str]] = ['0.0.0.0'], + host: Optional[List] = ['0.0.0.0'], install_requirements: Optional[bool] = False, log_config: Optional[str] = None, metrics: Optional[bool] = False, @@ -1028,7 +1028,7 @@ def serve( protocol: Optional[Union[str, List[str]]] = ['GRPC'], provider: Optional[str] = ['NONE'], provider_endpoint: Optional[str] = None, - py_modules: Optional[List[str]] = None, + py_modules: Optional[List] = None, quiet: Optional[bool] = False, quiet_error: Optional[bool] = False, raft_configuration: Optional[dict] = None, @@ -1058,7 +1058,7 @@ def serve( uses_requests: Optional[dict] = None, uses_with: Optional[dict] = None, uvicorn_kwargs: Optional[dict] = None, - volumes: Optional[List[str]] = None, + volumes: Optional[List] = None, when: Optional[dict] = None, workspace: Optional[str] = None, **kwargs, diff --git a/tests/integration/docarray_v2/test_v2.py b/tests/integration/docarray_v2/test_v2.py index 5e86ae84e0d51..d4e2d802c9f21 100644 --- a/tests/integration/docarray_v2/test_v2.py +++ b/tests/integration/docarray_v2/test_v2.py @@ -173,7 +173,7 @@ def search( @pytest.mark.parametrize('replicas', [1, 3]) def test_different_document_schema(protocols, replicas): class Image(BaseDoc): - tensor: Optional[AnyTensor] + #tensor: Optional[AnyTensor] url: ImageUrl lll: List[List[str]] = [[]] texts: DocList[TextDoc] @@ -182,7 +182,7 @@ class MyExecDifSchema(Executor): @requests(on='/foo') def foo(self, docs: DocList[Image], **kwargs) -> DocList[Image]: for doc in docs: - doc.tensor = np.zeros((10, 10, 10)) + #doc.tensor = np.zeros((10, 10, 10)) doc.lll = [['aa'], ['bb']] doc.texts.append(TextDoc('ha')) return docs @@ -205,7 +205,7 @@ def foo(self, docs: DocList[Image], **kwargs) -> DocList[Image]: return_type=DocList[Image], ) docs = docs.to_doc_vec() - assert docs.tensor.ndim == 4 + #assert docs.tensor.ndim == 4 assert docs[0].lll == [['aa'], ['bb']] assert len(docs[0].texts) == 2 assert docs[0].texts[0].text == 'hey'