Spaces:
Sleeping
Sleeping
Commit
·
ba78982
1
Parent(s):
d0e1780
修正
Browse files- .github/workflows/ci.yml +2 -2
- pyproject.toml +4 -1
- src/ai_api/main.py +4 -2
- tests/__init__.py +0 -0
- tests/test_main.py +1 -2
.github/workflows/ci.yml
CHANGED
@@ -37,7 +37,7 @@ jobs:
|
|
37 |
ruff format --check .
|
38 |
|
39 |
- name: Type check with Mypy
|
40 |
-
run: mypy
|
41 |
|
42 |
- name: Test with pytest
|
43 |
-
run: pytest
|
|
|
37 |
ruff format --check .
|
38 |
|
39 |
- name: Type check with Mypy
|
40 |
+
run: mypy -p ai_api -p tests
|
41 |
|
42 |
- name: Test with pytest
|
43 |
+
run: PYTHONPATH=src pytest
|
pyproject.toml
CHANGED
@@ -13,8 +13,11 @@ python_version = "3.12"
|
|
13 |
ignore_missing_imports = true
|
14 |
disallow_untyped_defs = true
|
15 |
warn_return_any = true
|
|
|
|
|
16 |
|
17 |
[tool.pytest.ini_options]
|
18 |
testpaths = ["tests"]
|
19 |
addopts = "-ra --strict-markers"
|
20 |
-
minversion = "7.0"
|
|
|
|
13 |
ignore_missing_imports = true
|
14 |
disallow_untyped_defs = true
|
15 |
warn_return_any = true
|
16 |
+
mypy_path = "src"
|
17 |
+
explicit_package_bases = true
|
18 |
|
19 |
[tool.pytest.ini_options]
|
20 |
testpaths = ["tests"]
|
21 |
addopts = "-ra --strict-markers"
|
22 |
+
minversion = "7.0"
|
23 |
+
|
src/ai_api/main.py
CHANGED
@@ -1,14 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
|
|
4 |
"""
|
5 |
名前を受け取り、挨拶文を返す簡単な関数。
|
6 |
"""
|
7 |
return "Hello, " + name + "!"
|
8 |
|
|
|
9 |
# Gradioインターフェースの定義
|
10 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
11 |
|
12 |
# スクリプトとして実行された場合にUIを起動
|
13 |
if __name__ == "__main__":
|
14 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
|
4 |
+
def greet(name: str) -> str:
|
5 |
"""
|
6 |
名前を受け取り、挨拶文を返す簡単な関数。
|
7 |
"""
|
8 |
return "Hello, " + name + "!"
|
9 |
|
10 |
+
|
11 |
# Gradioインターフェースの定義
|
12 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
13 |
|
14 |
# スクリプトとして実行された場合にUIを起動
|
15 |
if __name__ == "__main__":
|
16 |
+
iface.launch()
|
tests/__init__.py
ADDED
File without changes
|
tests/test_main.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
|
2 |
-
from src.ai_api.main import greet
|
3 |
|
4 |
def test_greet():
|
5 |
"""
|
|
|
1 |
+
from ai_api.main import greet
|
|
|
2 |
|
3 |
def test_greet():
|
4 |
"""
|