diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index f4cb31f62f..49521dcc8d 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -9,6 +9,9 @@ inputs: language: description: the language for which to install deps required: false + version: + description: the version of the language to setup + required: false runs: using: composite @@ -48,19 +51,6 @@ runs: shell: bash run: yarn workspace scripts build:cli - - name: Get all languages versions - id: versions - shell: bash - run: | - # remove patch from php version - echo "CSHARP_VERSION=$(cat config/.csharp-version)" >> $GITHUB_OUTPUT - echo "DART_VERSION=$(cat config/.dart-version)" >> $GITHUB_OUTPUT - echo "GO_VERSION=$(cat config/.go-version)" >> $GITHUB_OUTPUT - echo "PHP_VERSION=$(cat config/.php-version | cut -d '.' -f 1,2)" >> $GITHUB_OUTPUT - echo "PYTHON_VERSION=$(cat config/.python-version)" >> $GITHUB_OUTPUT - echo "RUBY_VERSION=$(cat config/.ruby-version)" >> $GITHUB_OUTPUT - echo "SWIFT_VERSION=$(cat config/.swift-version)" >> $GITHUB_OUTPUT - # JavaScript client deps - name: Get yarn js-client cache directory path if: ${{ inputs.language == 'javascript' }} @@ -92,7 +82,7 @@ runs: if: ${{ inputs.language == 'php' }} uses: shivammathur/setup-php@v2 with: - php-version: ${{ steps.versions.outputs.PHP_VERSION }} + php-version: ${{ inputs.version }} tools: composer - name: Run composer install @@ -108,7 +98,7 @@ runs: uses: actions/setup-go@v5 with: cache-dependency-path: clients/algoliasearch-client-go/go.sum - go-version: ${{ steps.versions.outputs.GO_VERSION }} + go-version: ${{ inputs.version }} - name: Install golangci-lint if: ${{ inputs.language == 'go' }} @@ -123,7 +113,7 @@ runs: uses: actions/cache@v4 with: path: ~/.cache/golangci-lint - key: golangci-lint-${{ steps.versions.outputs.GO_VERSION }}-${{ hashFiles('clients/algoliasearch-client-go/go.sum') }} + key: golangci-lint-${{ inputs.version }}-${{ hashFiles('clients/algoliasearch-client-go/go.sum') }} # Kotlin - name: Cache spotless @@ -138,7 +128,7 @@ runs: if: ${{ inputs.language == 'dart' }} uses: dart-lang/setup-dart@v1 with: - sdk: ${{ steps.versions.outputs.DART_VERSION }} + sdk: ${{ inputs.version }} - name: Setup dart tools if: ${{ inputs.language == 'dart' }} @@ -154,7 +144,7 @@ runs: - uses: actions/setup-python@v5 if: ${{ inputs.language == 'python' }} with: - python-version: ${{ steps.versions.outputs.PYTHON_VERSION }} + python-version: ${{ inputs.version }} cache: 'poetry' - run: poetry install @@ -167,7 +157,7 @@ runs: if: ${{ inputs.language == 'ruby' }} uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ steps.versions.outputs.RUBY_VERSION }} + ruby-version: ${{ inputs.version }} bundler-cache: true - name: Install Ruby formatter @@ -184,7 +174,7 @@ runs: if: ${{ inputs.language == 'csharp' }} uses: actions/setup-dotnet@v4 with: - dotnet-version: ${{ steps.versions.outputs.CSHARP_VERSION }} + dotnet-version: ${{ inputs.version }} # Swift deps - name: Install swift @@ -195,7 +185,7 @@ runs: # uses: swift-actions/setup-swift@v2 uses: redsun82/setup-swift@b2b6f77ab14f6a9b136b520dc53ec8eca27d2b99 with: - swift-version: ${{ steps.versions.outputs.SWIFT_VERSION }} + swift-version: ${{ inputs.version }} - name: Cache the build folder id: cache-swift-build @@ -205,7 +195,7 @@ runs: path: | clients/algoliasearch-client-swift/.build tests/output/swift/.build - key: swift-build-${{ steps.versions.outputs.SWIFT_VERSION }}-${{ runner.os }} + key: swift-build-${{ inputs.version }}-${{ runner.os }} - name: Set swiftformat version if: ${{ inputs.language == 'swift' }} diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b475a108f9..29042c67be 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -118,6 +118,7 @@ jobs: SWIFT_DATA: ${{ steps.gen-matrix.outputs.SWIFT_DATA }} RUN_MACOS_SWIFT_CTS: ${{ steps.gen-matrix.outputs.RUN_MACOS_SWIFT_CTS }} + KOTLIN_DATA: ${{ steps.gen-matrix.outputs.KOTLIN_DATA }} RUN_MACOS_KOTLIN_BUILD: ${{ steps.gen-matrix.outputs.RUN_MACOS_KOTLIN_BUILD }} scripts: @@ -183,6 +184,7 @@ jobs: ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }} ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }} MONITORING_API_KEY: ${{ secrets.MONITORING_API_KEY }} + name: client javascript@${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).version }} steps: - uses: actions/checkout@v4 @@ -203,6 +205,7 @@ jobs: uses: ./.github/actions/setup with: language: javascript + version: ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).version }} - name: Generate clients run: yarn cli generate javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} @@ -295,6 +298,7 @@ jobs: ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }} ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }} MONITORING_API_KEY: ${{ secrets.MONITORING_API_KEY }} + name: client ${{ matrix.client.language }}@${{ matrix.client.version }} steps: - uses: actions/checkout@v4 @@ -307,16 +311,17 @@ jobs: uses: ./.github/actions/setup with: language: ${{ matrix.client.language }} + version: ${{ matrix.client.version }} - name: Generate clients run: yarn cli generate ${{ matrix.client.language }} ${{ matrix.client.toRun }} - name: Update composer.lock - if: ${{ matrix.client.language == 'php' && startsWith(env.head_ref, 'chore/renovateBaseBranch') }} + if: ${{ matrix.client.language == 'php' && startsWith(env.head_ref, 'chore/renovateBaseBranch') && matrix.client.isMainVersion }} run: cd ${{ matrix.client.path }} && composer update - name: Check for file duplicates in Swift - if: ${{ matrix.client.language == 'swift' }} + if: ${{ matrix.client.language == 'swift' && matrix.client.isMainVersion }} run: | set -eo pipefail cd clients/algoliasearch-client-swift @@ -330,7 +335,7 @@ jobs: run: yarn cli build playground ${{ matrix.client.language }} - name: Run Java 'algoliasearch' public API validation - if: ${{ matrix.client.language == 'java' && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-bc]') }} + if: ${{ matrix.client.language == 'java' && matrix.client.isMainVersion && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-bc]') }} run: | cd ${{ matrix.client.path }} exit_code=0 @@ -364,6 +369,7 @@ jobs: run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests - name: Run benchmarks + if: ${{ matrix.client.isMainVersion }} run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --benchmark --no-client --no-requests --no-e2e - name: Generate code snippets for documentation @@ -373,9 +379,11 @@ jobs: run: yarn cli build snippets ${{ matrix.client.language }} - name: Zip artifact before storing + if: ${{ matrix.client.isMainVersion }} run: zip -r -y clients-${{ matrix.client.language }}.zip ${{ matrix.client.path }} ${{ matrix.client.testsToStore }} ${{ matrix.client.snippetsToStore }} -x "**/node_modules**" "**/__pycache__/**" "**/.yarn/cache/**" "**/build/**" "**/.build/**" "**/dist/**" "**/.gradle/**" "**/bin/**" "**/vendor/**" "**/target/**" "**/.dart_tool/**" - name: Store ${{ matrix.client.language }} clients + if: ${{ matrix.client.isMainVersion }} uses: actions/upload-artifact@v4 with: if-no-files-found: error @@ -396,6 +404,7 @@ jobs: !contains(needs.*.result, 'failure') outputs: success: ${{ steps.setoutput.outputs.success }} + name: client kotlin@${{ fromJSON(needs.setup.outputs.KOTLIN_DATA).version }} macos steps: - uses: actions/checkout@v4 @@ -436,6 +445,7 @@ jobs: MONITORING_API_KEY: ${{ secrets.MONITORING_API_KEY }} outputs: success: ${{ steps.setoutput.outputs.success }} + name: client swift@${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }} macos steps: - uses: actions/checkout@v4 @@ -451,6 +461,7 @@ jobs: with: type: minimal language: swift + version: ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }} - run: yarn cli cts run swift ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).toRun }} -v ${{ !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') && '--no-e2e' || '' }} diff --git a/clients/algoliasearch-client-python/algoliasearch/http/helpers.py b/clients/algoliasearch-client-python/algoliasearch/http/helpers.py index c6ec476498..cb78b33a2c 100644 --- a/clients/algoliasearch-client-python/algoliasearch/http/helpers.py +++ b/clients/algoliasearch-client-python/algoliasearch/http/helpers.py @@ -1,12 +1,12 @@ # coding: utf-8 from asyncio import sleep -from typing import Callable, Protocol, TypeVar +from typing import Callable, TypeVar T = TypeVar("T") -class Timeout(Protocol): +class Timeout: def __call__(self) -> int: return 0 @@ -16,10 +16,7 @@ def __init__(self) -> None: class RetryTimeout(Timeout): def __call__(self, retry_count: int) -> int: - return min(retry_count * 0.2, 5) - - def __init__(self) -> None: - pass + return int(min(retry_count * 0.2, 5)) async def create_iterable( diff --git a/clients/algoliasearch-client-python/algoliasearch/http/request_options.py b/clients/algoliasearch-client-python/algoliasearch/http/request_options.py index 95a4055fda..cd88c25bd3 100644 --- a/clients/algoliasearch-client-python/algoliasearch/http/request_options.py +++ b/clients/algoliasearch-client-python/algoliasearch/http/request_options.py @@ -1,13 +1,14 @@ from copy import deepcopy +from sys import version_info from typing import Any, Dict, List, Optional, Tuple, Union from urllib.parse import quote from algoliasearch.http.base_config import BaseConfig from algoliasearch.http.serializer import QueryParametersSerializer -try: +if version_info >= (3, 11): from typing import Self -except ImportError: +else: from typing_extensions import Self diff --git a/clients/algoliasearch-client-python/algoliasearch/http/user_agent.py b/clients/algoliasearch-client-python/algoliasearch/http/user_agent.py index 8e2a15a106..63545e0e06 100644 --- a/clients/algoliasearch-client-python/algoliasearch/http/user_agent.py +++ b/clients/algoliasearch-client-python/algoliasearch/http/user_agent.py @@ -1,5 +1,11 @@ from platform import python_version -from typing import Optional, Self +from sys import version_info +from typing import Optional + +if version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self from algoliasearch import __version__ diff --git a/clients/algoliasearch-client-python/setup.cfg b/clients/algoliasearch-client-python/setup.cfg index ea052a41d2..e37afe435b 100644 --- a/clients/algoliasearch-client-python/setup.cfg +++ b/clients/algoliasearch-client-python/setup.cfg @@ -40,4 +40,4 @@ install_requires = python-dateutil>=2.8.2,<3.0 pydantic>=2,3.0 typing-extensions>=4.7.1,<5.0 -python_requires = >= 3.8 +python_requires = >=3.8 diff --git a/config/clients.config.json b/config/clients.config.json index 101de45eb1..dc4f9cf141 100644 --- a/config/clients.config.json +++ b/config/clients.config.json @@ -261,7 +261,14 @@ "snippets": { "extension": ".py", "outputFolder": "" - } + }, + "supportedVersions": [ + "3.8", + "3.9", + "3.10", + "3.11", + "3.12" + ] }, "ruby": { "clients": [ diff --git a/playground/python/poetry.lock b/playground/python/poetry.lock index 789e96e1cb..6997a7153b 100644 --- a/playground/python/poetry.lock +++ b/playground/python/poetry.lock @@ -674,5 +674,5 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" -python-versions = "3.11.6" +python-versions = "^3.8.1" content-hash = "a9305fcc66e5ce65a4f735fba1ad6bc5281b82533d873d344e5f17df4c0d6c78" diff --git a/playground/python/pyproject.toml b/playground/python/pyproject.toml index 4570b61f7f..48f2b5b445 100644 --- a/playground/python/pyproject.toml +++ b/playground/python/pyproject.toml @@ -9,7 +9,7 @@ homepage = "https://www.algolia.com" repository = "https://github.com/algolia/api-clients-automation" [tool.poetry.dependencies] -python = "3.11.6" +python = "^3.8.1" algoliasearch = { path = "../../clients/algoliasearch-client-python", develop = true } ruff = "0.4.9" python-dotenv = "1.0.0" diff --git a/scripts/ci/githubActions/createMatrix.ts b/scripts/ci/githubActions/createMatrix.ts index 70b4bc203c..edeaf8fe7b 100644 --- a/scripts/ci/githubActions/createMatrix.ts +++ b/scripts/ci/githubActions/createMatrix.ts @@ -1,8 +1,10 @@ /* eslint-disable no-case-declarations */ +import fsp from 'fs/promises'; + import { setOutput } from '@actions/core'; -import { CLIENTS, createClientName, GENERATORS, LANGUAGES } from '../../common.js'; -import { getLanguageFolder, getTestExtension, getTestOutputFolder } from '../../config.js'; +import { CLIENTS, createClientName, exists, GENERATORS, LANGUAGES, toAbsolutePath } from '../../common.js'; +import { getLanguageFolder, getTestExtension, getTestOutputFolder, getClientsConfigField } from '../../config.js'; import type { ClientMatrix, CreateMatrix, ToRunMatrix } from './types.js'; import { COMMON_DEPENDENCIES, DEPENDENCIES, isBaseChanged } from './utils.js'; @@ -67,38 +69,48 @@ async function createClientMatrix(baseBranch: string): Promise { const testsRootFolder = `tests/output/${language}`; const testsOutputBase = `${testsRootFolder}/${getTestOutputFolder(language)}`; - // We delete tests to ensure the CI only run tests against what changed. - let testsToDelete = `${testsOutputBase}/client ${testsOutputBase}/requests ${testsOutputBase}/e2e`; - if (language !== 'swift') { - // Swift requires the benchmark folder to have files in it - testsToDelete += ` ${testsOutputBase}/benchmark`; - } - - // We only store tests of clients that ran during this job, the rest stay as is - let testsToStore = matrix[language].toRun - .map((client) => { - const clientName = createClientName(client, language); - const extension = getTestExtension(language); - - return `${testsOutputBase}/client/${clientName}${extension} ${testsOutputBase}/requests/${clientName}${extension} ${testsOutputBase}/e2e/${clientName}${extension} ${testsOutputBase}/benchmark/${clientName}${extension} ${testsRootFolder}/benchmarkResult.json`; - }) - .join(' '); - - const snippetsToStore = `snippets/${language}`; - const toRun = matrix[language].toRun.join(' '); - let buildCommand = `yarn cli build clients ${language} ${toRun}`; + const versionFile = toAbsolutePath( + language === 'javascript' + ? '.nvmrc' + : `config/.${language === 'kotlin' || language === 'scala' ? 'java' : language}-version`, + ); + let version: string | undefined = undefined; + if (await exists(versionFile)) { + version = (await fsp.readFile(versionFile)).toString(); + } - // some clients have specific files required for testing + const languageMatrix = { + language, + path: matrix[language].path, + toRun, + buildCommand: `yarn cli build clients ${language} ${toRun}`, + testsRootFolder, + // We delete tests to ensure the CI only run tests against what changed. + testsToDelete: `${testsOutputBase}/client ${testsOutputBase}/requests ${testsOutputBase}/e2e ${testsOutputBase}/benchmark`, + testsToStore: matrix[language].toRun + .map((client) => { + const clientName = createClientName(client, language); + const extension = getTestExtension(language); + + return `${testsOutputBase}/client/${clientName}${extension} ${testsOutputBase}/requests/${clientName}${extension} ${testsOutputBase}/e2e/${clientName}${extension} ${testsOutputBase}/benchmark/${clientName}${extension} ${testsRootFolder}/benchmarkResult.json`; + }) + .join(' '), + snippetsToStore: `snippets/${language}`, + version, + isMainVersion: true, + }; + + // language specific options switch (language) { case 'csharp': - testsToStore = `${testsToStore} ${testsRootFolder}/global.json`; + languageMatrix.testsToStore = `${languageMatrix.testsToStore} ${testsRootFolder}/global.json`; break; case 'go': - testsToStore = `${testsToStore} ${testsOutputBase}/echo.go ${testsRootFolder}/go.sum ${testsRootFolder}/go.mod`; + languageMatrix.testsToStore = `${languageMatrix.testsToStore} ${testsOutputBase}/echo.go ${testsRootFolder}/go.sum ${testsRootFolder}/go.mod`; break; case 'java': - testsToStore = `${testsToStore} ${testsRootFolder}/build.gradle`; + languageMatrix.testsToStore = `${languageMatrix.testsToStore} ${testsRootFolder}/build.gradle`; break; case 'javascript': const packageNames = matrix[language].toRun.map((client) => { @@ -108,53 +120,52 @@ async function createClientMatrix(baseBranch: string): Promise { return client === 'algoliasearch' ? packageName : `@algolia/${packageName}`; }); - buildCommand = `cd ${matrix[language].path} && yarn build:many '{${packageNames.join(',')},}'`; + languageMatrix.buildCommand = `cd ${matrix[language].path} && yarn build:many '{${packageNames.join(',')},}'`; + languageMatrix.testsToStore = `${languageMatrix.testsToStore} ${testsRootFolder}/package.json`; - testsToStore = `${testsToStore} ${testsRootFolder}/package.json`; + setOutput('JAVASCRIPT_DATA', JSON.stringify(languageMatrix)); + setOutput('RUN_GEN_JAVASCRIPT', true); + + // we don't store js in the clientMatrix, it's an other ci job + continue; + case 'kotlin': + setOutput('KOTLIN_DATA', JSON.stringify(languageMatrix)); + setOutput('RUN_MACOS_KOTLIN_BUILD', true); + break; + case 'php': + if (languageMatrix.version) { + languageMatrix.version = languageMatrix.version.split('.').slice(0, -1).join('.'); + } break; case 'python': - testsToStore = `${testsToStore} ${testsRootFolder}/poetry.lock ${testsRootFolder}/requirements.txt`; + languageMatrix.testsToStore = `${languageMatrix.testsToStore} ${testsRootFolder}/poetry.lock ${testsRootFolder}/requirements.txt`; break; case 'ruby': - testsToStore = `${testsToStore} ${testsRootFolder}/Gemfile.lock`; + languageMatrix.testsToStore = `${languageMatrix.testsToStore} ${testsRootFolder}/Gemfile.lock`; break; case 'swift': - testsToStore = `${testsToStore} ${testsRootFolder}/Package.swift`; + // Swift requires the benchmark folder to have files in it + languageMatrix.testsToDelete = `${testsOutputBase}/client ${testsOutputBase}/requests ${testsOutputBase}/e2e`; + languageMatrix.testsToStore = `${languageMatrix.testsToStore} ${testsRootFolder}/Package.swift`; + setOutput('SWIFT_DATA', JSON.stringify(languageMatrix)); + setOutput('RUN_MACOS_SWIFT_CTS', true); break; default: break; } - clientMatrix.client.push({ - language, - path: matrix[language].path, - toRun, - buildCommand, - testsRootFolder, - testsToDelete, - testsToStore, - snippetsToStore, - }); - } - - // If there are updates for the Swift client, we allow ourselves to run the CTS on macOS - const swiftData = clientMatrix.client.find((c) => c.language === 'swift'); - if (swiftData) { - setOutput('SWIFT_DATA', JSON.stringify(swiftData)); - setOutput('RUN_MACOS_SWIFT_CTS', true); - } - - // If there are updates for the Kotlin client, we allow ourselves to run the build step on macOS - const runKotlin = clientMatrix.client.find((c) => c.language === 'kotlin'); - if (runKotlin) { - setOutput('RUN_MACOS_KOTLIN_BUILD', true); - } - - const javascriptData = clientMatrix.client.find((c) => c.language === 'javascript'); - if (javascriptData) { - setOutput('JAVASCRIPT_DATA', JSON.stringify(javascriptData)); - setOutput('RUN_GEN_JAVASCRIPT', true); - clientMatrix.client = clientMatrix.client.filter((c) => c.language !== 'javascript'); + const supportedVersions: string[] = getClientsConfigField(language, 'supportedVersions', false); + if (supportedVersions && supportedVersions.length > 0) { + supportedVersions.forEach((supportedVersion, idx) => { + clientMatrix.client.push({ + ...languageMatrix, + version: supportedVersion, + isMainVersion: idx === supportedVersions.length - 1, + }); + }); + } else { + clientMatrix.client.push(languageMatrix); + } } const shouldRun = clientMatrix.client.length > 0; diff --git a/scripts/ci/githubActions/types.ts b/scripts/ci/githubActions/types.ts index 3fc5772db9..afefa594d2 100644 --- a/scripts/ci/githubActions/types.ts +++ b/scripts/ci/githubActions/types.ts @@ -43,6 +43,14 @@ export type ClientMatrix = { * The snippets output path to store in the artifact. */ snippetsToStore: string; + /** + * The version of the language to run, used for the setup step. + */ + version?: string; + /** + * Whether the current matrix version is the main version, this allows us to skip CI steps that should run only once (e.g. Store artifact). + */ + isMainVersion: boolean; }>; }; diff --git a/scripts/config.ts b/scripts/config.ts index 4d6fe91c5c..f3c814d04c 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -3,13 +3,17 @@ import clientsConfig from '../config/clients.config.json' assert { type: 'json' import { CI } from './common'; import type { Language, LanguageConfig } from './types.js'; -export function getClientsConfigField(language: Language, pathToField: string[] | string): any { +export function getClientsConfigField( + language: Language, + pathToField: string[] | string, + required: boolean = true, +): any { const config: LanguageConfig = clientsConfig[language]; const path = Array.isArray(pathToField) ? pathToField : [pathToField]; return path.reduce((current, key) => { const field = current?.[key]; - if (field !== '' && !field) { + if (field !== '' && !field && required) { throw new Error(`Unable to find '${pathToField}' for '${language}'`); } diff --git a/snippets/python/pyproject.toml b/snippets/python/pyproject.toml index c619d2f8dc..6b5ff492e5 100644 --- a/snippets/python/pyproject.toml +++ b/snippets/python/pyproject.toml @@ -8,6 +8,6 @@ homepage = "https://www.algolia.com" repository = "https://github.com/algolia/api-clients-automation" [tool.poetry.dependencies] -python = "3.11.6" +python = "^3.8.1" algoliasearch = { path = "../../clients/algoliasearch-client-python", develop = true } ruff = "0.4.9" diff --git a/templates/python/imports.mustache b/templates/python/imports.mustache index 2a3b8faea4..148c231e21 100644 --- a/templates/python/imports.mustache +++ b/templates/python/imports.mustache @@ -3,6 +3,7 @@ from __future__ import annotations import base64 import hashlib import hmac +from sys import version_info from warnings import warn from random import randint from time import time @@ -26,7 +27,6 @@ from pydantic import ( model_serializer, ) from typing import ( - Annotated, Any, Callable, ClassVar, @@ -35,11 +35,15 @@ from typing import ( List, Literal, Optional, - Self, Tuple, Union, ) +if version_info >= (3, 11): + from typing import Self, Annotated +else: + from typing_extensions import Self, Annotated + from algoliasearch.http.helpers import create_iterable, RetryTimeout from algoliasearch.http.serializer import bodySerializer, QueryParametersSerializer from algoliasearch.http.api_response import ApiResponse diff --git a/tests/output/python/pyproject.toml b/tests/output/python/pyproject.toml index 5c5cfb3983..23b892daf1 100644 --- a/tests/output/python/pyproject.toml +++ b/tests/output/python/pyproject.toml @@ -8,7 +8,7 @@ homepage = "https://www.algolia.com" repository = "https://github.com/algolia/api-clients-automation" [tool.poetry.dependencies] -python = "3.11.6" +python = "^3.8.1" algoliasearch = { path = "../../../clients/algoliasearch-client-python", develop = true } ruff = "0.4.9" pytest = "7.4.3"