Skip to content

Commit 646d88a

Browse files
committed
fix: add typing module for python 3.13
1 parent ce3ab1b commit 646d88a

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

.github/workflows/tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
Python310,
4141
Python311,
4242
Python312,
43+
Python313,
4344
Ruby27,
4445
Ruby30,
4546
Ruby31,

src/SDK/Language/Python.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ public function getTypeName(array $parameter, array $spec = []): string
243243
return 'str';
244244
case self::TYPE_ARRAY:
245245
if (!empty(($parameter['array'] ?? [])['type']) && !\is_array($parameter['array']['type'])) {
246-
return 'list[' . $this->getTypeName($parameter['array']) . ']';
246+
return 'List[' . $this->getTypeName($parameter['array']) . ']';
247247
}
248-
return 'list[str]';
248+
return 'List[str]';
249249
case self::TYPE_OBJECT:
250250
return 'dict';
251251
default:

templates/python/package/services/service.py.twig

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from ..service import Service
2+
from typing import List
23
from ..exception import AppwriteException
34
{% set added = [] %}
45
{% for method in service.methods %}

tests/Python313Test.php

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Tests;
4+
5+
class Python313Test extends Base
6+
{
7+
protected string $sdkName = 'python';
8+
protected string $sdkPlatform = 'server';
9+
protected string $sdkLanguage = 'python';
10+
protected string $version = '0.0.1';
11+
12+
protected string $language = 'python';
13+
protected string $class = 'Appwrite\SDK\Language\Python';
14+
protected array $build = [
15+
'cp tests/languages/python/tests.py tests/sdks/python/test.py',
16+
'echo "" > tests/sdks/python/__init__.py',
17+
'docker run --rm -v $(pwd):/app -w /app --env PIP_TARGET=tests/sdks/python/vendor python:3.13-alpine pip install -r tests/sdks/python/requirements.txt --upgrade',
18+
];
19+
protected string $command =
20+
'docker run --network="mockapi" --rm -v $(pwd):/app -w /app --env PIP_TARGET=tests/sdks/python/vendor --env PYTHONPATH=tests/sdks/python/vendor python:3.13-alpine python tests/sdks/python/test.py';
21+
22+
protected array $expectedOutput = [
23+
...Base::FOO_RESPONSES,
24+
...Base::BAR_RESPONSES,
25+
...Base::GENERAL_RESPONSES,
26+
...Base::UPLOAD_RESPONSES,
27+
...Base::ENUM_RESPONSES,
28+
...Base::EXCEPTION_RESPONSES,
29+
...Base::OAUTH_RESPONSES,
30+
...Base::QUERY_HELPER_RESPONSES,
31+
...Base::PERMISSION_HELPER_RESPONSES,
32+
...Base::ID_HELPER_RESPONSES
33+
];
34+
}

0 commit comments

Comments
 (0)