diff --git a/.github/workflows/test-transpiler.yml b/.github/workflows/test-transpiler.yml index 9245012345b1f..e8b82e2d5b4fb 100644 --- a/.github/workflows/test-transpiler.yml +++ b/.github/workflows/test-transpiler.yml @@ -10,6 +10,9 @@ on: jobs: transformations: + strategy: + matrix: + python-version: ["3.10", "3.12"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -18,7 +21,7 @@ jobs: persist-credentials: false - uses: actions/setup-python@v3 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} - name: Run Transformations Tests id: tests run: | @@ -26,6 +29,9 @@ jobs: docker run --rm -v "$(pwd)":/ivy ivyllc/ivy:latest scripts/shell/run_transpiler_tests.sh transformations translations: + strategy: + matrix: + python-version: ["3.10", "3.12"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -34,7 +40,7 @@ jobs: persist-credentials: false - uses: actions/setup-python@v3 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} - name: Run Translations Tests id: tests run: | @@ -42,6 +48,9 @@ jobs: docker run --rm -v "$(pwd)":/ivy ivyllc/ivy:latest scripts/shell/run_transpiler_tests.sh translations module: + strategy: + matrix: + python-version: ["3.10", "3.12"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -50,8 +59,7 @@ jobs: persist-credentials: false - uses: actions/setup-python@v3 with: - python-version: "3.10" - + python-version: ${{ matrix.python-version }} - name: Run Module Tests id: tests run: | @@ -59,6 +67,9 @@ jobs: docker run --rm -v "$(pwd)":/ivy ivyllc/ivy:latest scripts/shell/run_transpiler_tests.sh module sourcegen: + strategy: + matrix: + python-version: ["3.10", "3.12"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -67,7 +78,7 @@ jobs: persist-credentials: false - uses: actions/setup-python@v3 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} - name: Run SourceGen Tests id: tests run: | @@ -75,6 +86,9 @@ jobs: docker run --rm -v "$(pwd)":/ivy ivyllc/ivy:latest scripts/shell/run_transpiler_tests.sh sourcegen hf: + strategy: + matrix: + python-version: ["3.10", "3.12"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -83,7 +97,7 @@ jobs: persist-credentials: false - uses: actions/setup-python@v3 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} - name: Run HuggingFace Tests id: tests run: | @@ -91,6 +105,9 @@ jobs: docker run --rm -v "$(pwd)":/ivy ivyllc/ivy:latest scripts/shell/run_transpiler_tests.sh hf kornia: + strategy: + matrix: + python-version: ["3.10", "3.12"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -99,7 +116,7 @@ jobs: persist-credentials: false - uses: actions/setup-python@v3 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} - name: Run Kornia Tests id: tests run: | diff --git a/ivy/transpiler/transformations/transformers/inject_transformer/base_transformer.py b/ivy/transpiler/transformations/transformers/inject_transformer/base_transformer.py index f5ee4192d7961..188a3fb696d37 100644 --- a/ivy/transpiler/transformations/transformers/inject_transformer/base_transformer.py +++ b/ivy/transpiler/transformations/transformers/inject_transformer/base_transformer.py @@ -1,5 +1,4 @@ # global -from ast import FunctionDef import gast import inspect import textwrap @@ -10,7 +9,6 @@ ) from ...transformer import Transformer from ....utils import pickling_utils -from ....utils.api_utils import is_frontend_stateful_api from ....utils.ast_utils import ( ast_to_source_code, is_super_call_node, @@ -115,6 +113,7 @@ def visit_ClassDef(self, node): decorator_list=method_node.decorator_list, returns=method_node.returns, type_comment=method_node.type_comment, + type_params=method_node.type_params if hasattr(method_node, "type_params") else [], ) new_method_node = gast.copy_location(new_method_node, method_node) BaseRenameTransformer(new_method_node).rename( @@ -161,6 +160,7 @@ def visit_Module(self, node): keywords=cls_node.keywords, body=[*cls_node.body, *method_nodes_to_add], decorator_list=cls_node.decorator_list, + type_params=cls_node.type_params if hasattr(cls_node, "type_params") else [], ) new_node = gast.copy_location(new_node, cls_node) # attach origin info to the new node @@ -224,6 +224,7 @@ def remove_explicit_self_from_super_init(node): decorator_list=method_node.decorator_list, returns=method_node.returns, type_comment=method_node.type_comment, + type_params=method_node.type_params if hasattr(method_node, "type_params") else [], ) new_method_node = gast.copy_location(new_method_node, method_node) self._method_nodes_to_add.append(new_method_node) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 8a9e63186aff6..7431c36e8ae8d 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -2,7 +2,7 @@ astor cryptography>=40.0.0 dill einops -gast<=0.5.4 +gast networkx numpy packaging