diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4de0c51..9b1a683 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,7 @@ // README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile { "name": "dev", - "image": "ghcr.io/ten-framework/ten_agent_build:0.3.6", + "image": "ghcr.io/ten-framework/ten_agent_build:0.4.2", "customizations": { "vscode": { "extensions": [ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48255ba..250139f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: ci: runs-on: ubuntu-latest container: - image: ghcr.io/ten-framework/ten_agent_build:0.3.6 + image: ghcr.io/ten-framework/ten_agent_build:0.4.2 steps: - uses: actions/checkout@v4 with: diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..d01d50c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python Debugger: Python File", + "type": "debugpy", + "request": "launch", + "program": "${workspaceFolder}/tests/test_basic.py", + "env": { + "PYTHONMALLOC": "malloc", + "PYTHONPATH": "${workspaceFolder}/.ten/app:${workspaceFolder}/.ten/app/ten_packages/system/ten_runtime_python/lib:${workspaceFolder}/.ten/app/ten_packages/system/ten_runtime_python/interface" + } + } + ] +} \ No newline at end of file diff --git a/Taskfile.yml b/Taskfile.yml index 06496b8..3b4d90b 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -15,7 +15,7 @@ tasks: install: desc: install dependencies cmds: - - tman install + - tman install --standalone - pip install -r requirements.txt - pip install -r tests/requirements.txt diff --git a/manifest.json b/manifest.json index 4f85813..5e8eef5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,12 +1,12 @@ { "type": "extension", "name": "http_server_python", - "version": "0.9.0", + "version": "0.10.0", "dependencies": [ { "type": "system", "name": "ten_runtime_python", - "version": "0.6" + "version": "0.8" } ], "package": { @@ -28,4 +28,4 @@ } } } -} +} \ No newline at end of file diff --git a/tests/bin/start b/tests/bin/start index fbdc895..eb7c1a5 100755 --- a/tests/bin/start +++ b/tests/bin/start @@ -4,7 +4,7 @@ set -e cd "$(dirname "${BASH_SOURCE[0]}")/../.." -export PYTHONPATH=.ten/app/ten_packages/system/ten_runtime_python/lib:.ten/app/ten_packages/system/ten_runtime_python/interface +export PYTHONPATH=.ten/app:.ten/app/ten_packages/system/ten_runtime_python/lib:.ten/app/ten_packages/system/ten_runtime_python/interface # If the Python app imports some modules that are compiled with a different # version of libstdc++ (ex: PyTorch), the Python app may encounter confusing diff --git a/tests/test_4xx.py b/tests/test_4xx.py index b543858..2ed9aeb 100644 --- a/tests/test_4xx.py +++ b/tests/test_4xx.py @@ -47,18 +47,13 @@ def on_start(self, ten_env: TenEnvTester) -> None: def test_4xx(): tester_404_1 = ExtensionTester404NotFound1() - tester_404_1.add_addon_base_dir( - str(Path(__file__).resolve().parent.parent)) tester_404_1.set_test_mode_single("http_server_python") tester_404_1.run() tester_404_2 = ExtensionTester404NotFound2() - tester_404_2.add_addon_base_dir( - str(Path(__file__).resolve().parent.parent)) tester_404_2.set_test_mode_single("http_server_python") tester_404_2.run() tester_400 = ExtensionTester400BadRequest() - tester_400.add_addon_base_dir(str(Path(__file__).resolve().parent.parent)) tester_400.set_test_mode_single("http_server_python") tester_400.run() diff --git a/tests/test_5xx.py b/tests/test_5xx.py index 3db8558..32b5309 100644 --- a/tests/test_5xx.py +++ b/tests/test_5xx.py @@ -46,6 +46,5 @@ def _async_test(self, ten_env: TenEnvTester) -> None: def test_5xx(): tester = ExtensionTester5xx() - tester.add_addon_base_dir(str(Path(__file__).resolve().parent.parent)) tester.set_test_mode_single("http_server_python") tester.run() diff --git a/tests/test_basic.py b/tests/test_basic.py index c047d58..b483ea5 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -58,6 +58,9 @@ def _async_test(self, ten_env: TenEnvTester) -> None: def test_basic(): tester = ExtensionTesterBasic() - tester.add_addon_base_dir(str(Path(__file__).resolve().parent.parent)) tester.set_test_mode_single("http_server_python") tester.run() + + +if __name__ == "__main__": + test_basic() diff --git a/tests/test_set_property.py b/tests/test_set_property.py index 7f105ce..d56abe9 100644 --- a/tests/test_set_property.py +++ b/tests/test_set_property.py @@ -48,20 +48,17 @@ def test_set_property(): # change port property_json_1 = '{"listen_port":8899}' tester_1 = ExtensionTesterSetProperty() - tester_1.add_addon_base_dir(str(Path(__file__).resolve().parent.parent)) tester_1.set_test_mode_single("http_server_python", property_json_1) tester_1.run() # change port with localhost property_json_2 = '{"listen_addr":"127.0.0.1","listen_port":8899}' tester_2 = ExtensionTesterSetProperty() - tester_2.add_addon_base_dir(str(Path(__file__).resolve().parent.parent)) tester_2.set_test_mode_single("http_server_python", property_json_2) tester_2.run() # change port with any addr property_json_3 = '{"listen_addr":"0.0.0.0","listen_port":8899}' tester_3 = ExtensionTesterSetProperty() - tester_3.add_addon_base_dir(str(Path(__file__).resolve().parent.parent)) tester_3.set_test_mode_single("http_server_python", property_json_3) tester_3.run() diff --git a/tests/test_timeout.py b/tests/test_timeout.py index be55bf2..0e84f3d 100644 --- a/tests/test_timeout.py +++ b/tests/test_timeout.py @@ -37,6 +37,5 @@ def on_start(self, ten_env: TenEnvTester) -> None: def test_timeout(): tester = ExtensionTesterTimeout() - tester.add_addon_base_dir(str(Path(__file__).resolve().parent.parent)) tester.set_test_mode_single("http_server_python") tester.run()