metaso-sdk 0.1.0__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. metaso_sdk-0.1.3/CHANGELOG.md +5 -0
  2. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/PKG-INFO +3 -7
  3. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/README.md +2 -3
  4. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/config/vscode/tasks.json +14 -14
  5. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/duties.py +10 -31
  6. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/mkdocs.yml +0 -6
  7. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/pyproject.toml +1 -4
  8. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/scripts/make.py +1 -1
  9. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/src/metaso_sdk/__init__.py +11 -11
  10. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/src/metaso_sdk/model.py +2 -0
  11. metaso_sdk-0.1.0/CHANGELOG.md +0 -8
  12. metaso_sdk-0.1.0/scripts/make +0 -193
  13. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/CONTRIBUTING.md +0 -0
  14. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/LICENSE +0 -0
  15. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/config/coverage.ini +0 -0
  16. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/config/git-changelog.toml +0 -0
  17. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/config/mypy.ini +0 -0
  18. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/config/pytest.ini +0 -0
  19. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/config/ruff.toml +0 -0
  20. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/config/vscode/launch.json +0 -0
  21. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/config/vscode/settings.json +0 -0
  22. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/docs/.overrides/partials/comments.html +0 -0
  23. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/docs/changelog.md +0 -0
  24. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/docs/contributing.md +0 -0
  25. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/docs/css/material.css +0 -0
  26. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/docs/css/mkdocstrings.css +0 -0
  27. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/docs/index.md +0 -0
  28. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/docs/js/feedback.js +0 -0
  29. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/docs/license.md +0 -0
  30. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/scripts/gen_ref_nav.py +0 -0
  31. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/src/metaso_sdk/__main__.py +0 -0
  32. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/src/metaso_sdk/cli.py +0 -0
  33. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/src/metaso_sdk/client.py +0 -0
  34. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/src/metaso_sdk/debug.py +0 -0
  35. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/src/metaso_sdk/py.typed +0 -0
  36. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/src/metaso_sdk/search.py +0 -0
  37. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/src/metaso_sdk/subject.py +0 -0
  38. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/tests/__init__.py +0 -0
  39. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/tests/conftest.py +0 -0
  40. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/tests/fixtures/1/functions.pdf +0 -0
  41. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/tests/fixtures/2/phd-thesis.pdf +0 -0
  42. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/tests/fixtures/3/eurosys16-final29.pdf +0 -0
  43. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/tests/test_cli.py +0 -0
  44. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/tests/test_search.py +0 -0
  45. {metaso_sdk-0.1.0 → metaso_sdk-0.1.3}/tests/test_subject.py +0 -0
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ 0.1.0: 专题相关接口。
4
+ 0.1.1: 搜索支持混合模式开关 enableMix。
5
+ 0.1.3: 搜索支持 newEngine 开关。
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: metaso-sdk
3
- Version: 0.1.0
3
+ Version: 0.1.3
4
4
  Summary: The official Python SDK for https://metaso.cn
5
5
  Author-Email: Zhao Xiaohong <zhaoxiaohong@metasota.ai>
6
6
  License: MIT
@@ -15,7 +15,6 @@ Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
- Classifier: Programming Language :: Python :: 3.14
19
18
  Classifier: Topic :: Documentation
20
19
  Classifier: Topic :: Software Development
21
20
  Classifier: Topic :: Utilities
@@ -26,8 +25,6 @@ Project-URL: Changelog, https://meta-sota.github.io/metaso-sdk/changelog
26
25
  Project-URL: Repository, https://github.com/meta-sota/metaso-sdk
27
26
  Project-URL: Issues, https://github.com/meta-sota/metaso-sdk/issues
28
27
  Project-URL: Discussions, https://github.com/meta-sota/metaso-sdk/discussions
29
- Project-URL: Gitter, https://gitter.im/metaso-sdk/community
30
- Project-URL: Funding, https://github.com/sponsors/meta-sota
31
28
  Requires-Python: >=3.8
32
29
  Requires-Dist: httpx-sse>=0.4.0
33
30
  Requires-Dist: httpx>=0.27.2
@@ -40,9 +37,8 @@ Description-Content-Type: text/markdown
40
37
  [![ci](https://github.com/meta-sota/metaso-sdk/workflows/ci/badge.svg)](https://github.com/meta-sota/metaso-sdk/actions?query=workflow%3Aci)
41
38
  [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://meta-sota.github.io/metaso-sdk/)
42
39
  [![pypi version](https://img.shields.io/pypi/v/metaso-sdk.svg)](https://pypi.org/project/metaso-sdk/)
43
- [![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#metaso-sdk:gitter.im)
44
40
 
45
- The official Python SDK for https://metaso.cn
41
+ [秘塔AI搜索](https://metaso.cn) Python SDK。在使用这个 SDK 之前,请先通过[API文档专题](https://metaso.cn/s/hXHmJkx)了解 HTTP 接口的更多细节。
46
42
 
47
43
  ## 安装
48
44
 
@@ -76,7 +72,7 @@ search(Query(question="abc"))
76
72
  ### 追问
77
73
 
78
74
  ```python
79
- search(Query(question="广播公司", sessionId='8550018047390023680'))
75
+ search(Query(question="广播公司", sessionId="8550018047390023680"))
80
76
  ```
81
77
 
82
78
  ### 流式返回
@@ -3,9 +3,8 @@
3
3
  [![ci](https://github.com/meta-sota/metaso-sdk/workflows/ci/badge.svg)](https://github.com/meta-sota/metaso-sdk/actions?query=workflow%3Aci)
4
4
  [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://meta-sota.github.io/metaso-sdk/)
5
5
  [![pypi version](https://img.shields.io/pypi/v/metaso-sdk.svg)](https://pypi.org/project/metaso-sdk/)
6
- [![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#metaso-sdk:gitter.im)
7
6
 
8
- The official Python SDK for https://metaso.cn
7
+ [秘塔AI搜索](https://metaso.cn) Python SDK。在使用这个 SDK 之前,请先通过[API文档专题](https://metaso.cn/s/hXHmJkx)了解 HTTP 接口的更多细节。
9
8
 
10
9
  ## 安装
11
10
 
@@ -39,7 +38,7 @@ search(Query(question="abc"))
39
38
  ### 追问
40
39
 
41
40
  ```python
42
- search(Query(question="广播公司", sessionId='8550018047390023680'))
41
+ search(Query(question="广播公司", sessionId="8550018047390023680"))
43
42
  ```
44
43
 
45
44
  ### 流式返回
@@ -4,86 +4,86 @@
4
4
  {
5
5
  "label": "changelog",
6
6
  "type": "process",
7
- "command": "scripts/make",
7
+ "command": "scripts/make.py",
8
8
  "args": ["changelog"]
9
9
  },
10
10
  {
11
11
  "label": "check",
12
12
  "type": "process",
13
- "command": "scripts/make",
13
+ "command": "scripts/make.py",
14
14
  "args": ["check"]
15
15
  },
16
16
  {
17
17
  "label": "check-quality",
18
18
  "type": "process",
19
- "command": "scripts/make",
19
+ "command": "scripts/make.py",
20
20
  "args": ["check-quality"]
21
21
  },
22
22
  {
23
23
  "label": "check-types",
24
24
  "type": "process",
25
- "command": "scripts/make",
25
+ "command": "scripts/make.py",
26
26
  "args": ["check-types"]
27
27
  },
28
28
  {
29
29
  "label": "check-docs",
30
30
  "type": "process",
31
- "command": "scripts/make",
31
+ "command": "scripts/make.py",
32
32
  "args": ["check-docs"]
33
33
  },
34
34
  {
35
35
  "label": "check-api",
36
36
  "type": "process",
37
- "command": "scripts/make",
37
+ "command": "scripts/make.py",
38
38
  "args": ["check-api"]
39
39
  },
40
40
  {
41
41
  "label": "clean",
42
42
  "type": "process",
43
- "command": "scripts/make",
43
+ "command": "scripts/make.py",
44
44
  "args": ["clean"]
45
45
  },
46
46
  {
47
47
  "label": "docs",
48
48
  "type": "process",
49
- "command": "scripts/make",
49
+ "command": "scripts/make.py",
50
50
  "args": ["docs"]
51
51
  },
52
52
  {
53
53
  "label": "docs-deploy",
54
54
  "type": "process",
55
- "command": "scripts/make",
55
+ "command": "scripts/make.py",
56
56
  "args": ["docs-deploy"]
57
57
  },
58
58
  {
59
59
  "label": "format",
60
60
  "type": "process",
61
- "command": "scripts/make",
61
+ "command": "scripts/make.py",
62
62
  "args": ["format"]
63
63
  },
64
64
  {
65
65
  "label": "release",
66
66
  "type": "process",
67
- "command": "scripts/make",
67
+ "command": "scripts/make.py",
68
68
  "args": ["release", "${input:version}"]
69
69
  },
70
70
  {
71
71
  "label": "setup",
72
72
  "type": "process",
73
- "command": "scripts/make",
73
+ "command": "scripts/make.py",
74
74
  "args": ["setup"]
75
75
  },
76
76
  {
77
77
  "label": "test",
78
78
  "type": "process",
79
- "command": "scripts/make",
79
+ "command": "scripts/make.py",
80
80
  "args": ["test", "coverage"],
81
81
  "group": "test"
82
82
  },
83
83
  {
84
84
  "label": "vscode",
85
85
  "type": "process",
86
- "command": "scripts/make",
86
+ "command": "scripts/make.py",
87
87
  "args": ["vscode"]
88
88
  }
89
89
  ],
@@ -4,16 +4,12 @@ from __future__ import annotations
4
4
 
5
5
  import os
6
6
  import sys
7
- from contextlib import contextmanager
8
- from importlib.metadata import version as pkgversion
9
7
  from pathlib import Path
10
8
  from typing import TYPE_CHECKING
11
9
 
12
10
  from duty import duty, tools
13
11
 
14
12
  if TYPE_CHECKING:
15
- from collections.abc import Iterator
16
-
17
13
  from duty.context import Context
18
14
 
19
15
 
@@ -33,18 +29,6 @@ def pyprefix(title: str) -> str: # noqa: D103
33
29
  return title
34
30
 
35
31
 
36
- @contextmanager
37
- def material_insiders() -> Iterator[bool]: # noqa: D103
38
- if "+insiders" in pkgversion("mkdocs-material"):
39
- os.environ["MATERIAL_INSIDERS"] = "true"
40
- try:
41
- yield True
42
- finally:
43
- os.environ.pop("MATERIAL_INSIDERS")
44
- else:
45
- yield False
46
-
47
-
48
32
  @duty
49
33
  def changelog(ctx: Context, bump: str = "") -> None:
50
34
  """Update the changelog in-place with latest commits.
@@ -74,11 +58,10 @@ def check_docs(ctx: Context) -> None:
74
58
  """Check if the documentation builds correctly."""
75
59
  Path("htmlcov").mkdir(parents=True, exist_ok=True)
76
60
  Path("htmlcov/index.html").touch(exist_ok=True)
77
- with material_insiders():
78
- ctx.run(
79
- tools.mkdocs.build(strict=True, verbose=True),
80
- title=pyprefix("Building documentation"),
81
- )
61
+ ctx.run(
62
+ tools.mkdocs.build(strict=True, verbose=True),
63
+ title=pyprefix("Building documentation"),
64
+ )
82
65
 
83
66
 
84
67
  @duty
@@ -108,22 +91,18 @@ def docs(ctx: Context, *cli_args: str, host: str = "127.0.0.1", port: int = 8000
108
91
  host: The host to serve the docs from.
109
92
  port: The port to serve the docs on.
110
93
  """
111
- with material_insiders():
112
- ctx.run(
113
- tools.mkdocs.serve(dev_addr=f"{host}:{port}").add_args(*cli_args),
114
- title="Serving documentation",
115
- capture=False,
116
- )
94
+ ctx.run(
95
+ tools.mkdocs.serve(dev_addr=f"{host}:{port}").add_args(*cli_args),
96
+ title="Serving documentation",
97
+ capture=False,
98
+ )
117
99
 
118
100
 
119
101
  @duty
120
102
  def docs_deploy(ctx: Context) -> None:
121
103
  """Deploy the documentation to GitHub pages."""
122
104
  os.environ["DEPLOY"] = "true"
123
- with material_insiders() as insiders:
124
- if not insiders:
125
- ctx.run(lambda: False, title="Not deploying docs without Material for MkDocs Insiders!")
126
- ctx.run(tools.mkdocs.gh_deploy(), title="Deploying documentation")
105
+ ctx.run(tools.mkdocs.gh_deploy(), title="Deploying documentation")
127
106
 
128
107
 
129
108
  @duty
@@ -132,17 +132,11 @@ plugins:
132
132
  type: timeago
133
133
  - minify:
134
134
  minify_html: !ENV [DEPLOY, false]
135
- - group:
136
- enabled: !ENV [MATERIAL_INSIDERS, false]
137
- plugins:
138
- - typeset
139
135
 
140
136
  extra:
141
137
  social:
142
138
  - icon: fontawesome/brands/github
143
139
  link: https://github.com/meta-sota
144
- - icon: fontawesome/brands/gitter
145
- link: https://gitter.im/metaso-sdk/community
146
140
  - icon: fontawesome/brands/python
147
141
  link: https://pypi.org/project/metaso-sdk/
148
142
  analytics:
@@ -26,7 +26,6 @@ classifiers = [
26
26
  "Programming Language :: Python :: 3.11",
27
27
  "Programming Language :: Python :: 3.12",
28
28
  "Programming Language :: Python :: 3.13",
29
- "Programming Language :: Python :: 3.14",
30
29
  "Topic :: Documentation",
31
30
  "Topic :: Software Development",
32
31
  "Topic :: Utilities",
@@ -38,7 +37,7 @@ dependencies = [
38
37
  "pydantic>=2.10.0",
39
38
  "streamable>=1.3.5",
40
39
  ]
41
- version = "0.1.0"
40
+ version = "0.1.3"
42
41
 
43
42
  [project.license]
44
43
  text = "MIT"
@@ -50,8 +49,6 @@ Changelog = "https://meta-sota.github.io/metaso-sdk/changelog"
50
49
  Repository = "https://github.com/meta-sota/metaso-sdk"
51
50
  Issues = "https://github.com/meta-sota/metaso-sdk/issues"
52
51
  Discussions = "https://github.com/meta-sota/metaso-sdk/discussions"
53
- Gitter = "https://gitter.im/metaso-sdk/community"
54
- Funding = "https://github.com/sponsors/meta-sota"
55
52
 
56
53
  [project.scripts]
57
54
  metaso = "metaso_sdk.cli:main"
@@ -16,7 +16,7 @@ if TYPE_CHECKING:
16
16
  from collections.abc import Iterator
17
17
 
18
18
 
19
- PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.9 3.10 3.11 3.12 3.13 3.14").split()
19
+ PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.8 3.9 3.10 3.11 3.12 3.13").split()
20
20
 
21
21
 
22
22
  def shell(cmd: str, *, capture_output: bool = False, **kwargs: Any) -> str | None:
@@ -10,15 +10,15 @@ from .search import search
10
10
  from .subject import create_topic, delete_file, delete_topic, update_progress, upload_directory, upload_file
11
11
 
12
12
  __all__: list[str] = [
13
- Status,
14
- Query,
15
- Topic,
16
- File,
17
- search,
18
- create_topic,
19
- delete_topic,
20
- upload_file,
21
- update_progress,
22
- delete_file,
23
- upload_directory,
13
+ "Status",
14
+ "Query",
15
+ "Topic",
16
+ "File",
17
+ "search",
18
+ "create_topic",
19
+ "delete_topic",
20
+ "upload_file",
21
+ "update_progress",
22
+ "delete_file",
23
+ "upload_directory",
24
24
  ]
@@ -15,6 +15,8 @@ class Query(BaseModel):
15
15
  stream: bool = False
16
16
  topicId: Optional[str] = None
17
17
  searchTopicId: Optional[str] = None
18
+ enableMix: bool = False
19
+ newEngine: bool = False
18
20
 
19
21
 
20
22
  class Topic(BaseModel):
@@ -1,8 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
- and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
-
8
- <!-- insertion marker -->
@@ -1,193 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Management commands."""
3
-
4
- from __future__ import annotations
5
-
6
- import os
7
- import shutil
8
- import subprocess
9
- import sys
10
- from contextlib import contextmanager
11
- from pathlib import Path
12
- from textwrap import dedent
13
- from typing import TYPE_CHECKING, Any
14
-
15
- if TYPE_CHECKING:
16
- from collections.abc import Iterator
17
-
18
-
19
- PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.9 3.10 3.11 3.12 3.13 3.14").split()
20
-
21
-
22
- def shell(cmd: str, *, capture_output: bool = False, **kwargs: Any) -> str | None:
23
- """Run a shell command."""
24
- if capture_output:
25
- return subprocess.check_output(cmd, shell=True, text=True, **kwargs) # noqa: S602
26
- subprocess.run(cmd, shell=True, check=True, stderr=subprocess.STDOUT, **kwargs) # noqa: S602
27
- return None
28
-
29
-
30
- @contextmanager
31
- def environ(**kwargs: str) -> Iterator[None]:
32
- """Temporarily set environment variables."""
33
- original = dict(os.environ)
34
- os.environ.update(kwargs)
35
- try:
36
- yield
37
- finally:
38
- os.environ.clear()
39
- os.environ.update(original)
40
-
41
-
42
- def uv_install(venv: Path) -> None:
43
- """Install dependencies using uv."""
44
- with environ(UV_PROJECT_ENVIRONMENT=str(venv), PYO3_USE_ABI3_FORWARD_COMPATIBILITY="1"):
45
- if "CI" in os.environ:
46
- shell("uv sync --no-editable")
47
- else:
48
- shell("uv sync")
49
-
50
-
51
- def setup() -> None:
52
- """Setup the project."""
53
- if not shutil.which("uv"):
54
- raise ValueError("make: setup: uv must be installed, see https://github.com/astral-sh/uv")
55
-
56
- print("Installing dependencies (default environment)")
57
- default_venv = Path(".venv")
58
- if not default_venv.exists():
59
- shell("uv venv")
60
- uv_install(default_venv)
61
-
62
- if PYTHON_VERSIONS:
63
- for version in PYTHON_VERSIONS:
64
- print(f"\nInstalling dependencies (python{version})")
65
- venv_path = Path(f".venvs/{version}")
66
- if not venv_path.exists():
67
- shell(f"uv venv --python {version} {venv_path}")
68
- with environ(UV_PROJECT_ENVIRONMENT=str(venv_path.resolve())):
69
- uv_install(venv_path)
70
-
71
-
72
- def run(version: str, cmd: str, *args: str, no_sync: bool = False, **kwargs: Any) -> None:
73
- """Run a command in a virtual environment."""
74
- kwargs = {"check": True, **kwargs}
75
- uv_run = ["uv", "run"]
76
- if no_sync:
77
- uv_run.append("--no-sync")
78
- if version == "default":
79
- with environ(UV_PROJECT_ENVIRONMENT=".venv"):
80
- subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
81
- else:
82
- with environ(UV_PROJECT_ENVIRONMENT=f".venvs/{version}", MULTIRUN="1"):
83
- subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
84
-
85
-
86
- def multirun(cmd: str, *args: str, **kwargs: Any) -> None:
87
- """Run a command for all configured Python versions."""
88
- if PYTHON_VERSIONS:
89
- for version in PYTHON_VERSIONS:
90
- run(version, cmd, *args, **kwargs)
91
- else:
92
- run("default", cmd, *args, **kwargs)
93
-
94
-
95
- def allrun(cmd: str, *args: str, **kwargs: Any) -> None:
96
- """Run a command in all virtual environments."""
97
- run("default", cmd, *args, **kwargs)
98
- if PYTHON_VERSIONS:
99
- multirun(cmd, *args, **kwargs)
100
-
101
-
102
- def clean() -> None:
103
- """Delete build artifacts and cache files."""
104
- paths_to_clean = ["build", "dist", "htmlcov", "site", ".coverage*", ".pdm-build"]
105
- for path in paths_to_clean:
106
- shutil.rmtree(path, ignore_errors=True)
107
-
108
- cache_dirs = {".cache", ".pytest_cache", ".mypy_cache", ".ruff_cache", "__pycache__"}
109
- for dirpath in Path(".").rglob("*/"):
110
- if dirpath.parts[0] not in (".venv", ".venvs") and dirpath.name in cache_dirs:
111
- shutil.rmtree(dirpath, ignore_errors=True)
112
-
113
-
114
- def vscode() -> None:
115
- """Configure VSCode to work on this project."""
116
- shutil.copytree("config/vscode", ".vscode", dirs_exist_ok=True)
117
-
118
-
119
- def main() -> int:
120
- """Main entry point."""
121
- args = list(sys.argv[1:])
122
- if not args or args[0] == "help":
123
- if len(args) > 1:
124
- run("default", "duty", "--help", args[1])
125
- else:
126
- print(
127
- dedent(
128
- """
129
- Available commands
130
- help Print this help. Add task name to print help.
131
- setup Setup all virtual environments (install dependencies).
132
- run Run a command in the default virtual environment.
133
- multirun Run a command for all configured Python versions.
134
- allrun Run a command in all virtual environments.
135
- 3.x Run a command in the virtual environment for Python 3.x.
136
- clean Delete build artifacts and cache files.
137
- vscode Configure VSCode to work on this project.
138
- """,
139
- ),
140
- flush=True,
141
- )
142
- if os.path.exists(".venv"):
143
- print("\nAvailable tasks", flush=True)
144
- run("default", "duty", "--list", no_sync=True)
145
- return 0
146
-
147
- while args:
148
- cmd = args.pop(0)
149
-
150
- if cmd == "run":
151
- run("default", *args)
152
- return 0
153
-
154
- if cmd == "multirun":
155
- multirun(*args)
156
- return 0
157
-
158
- if cmd == "allrun":
159
- allrun(*args)
160
- return 0
161
-
162
- if cmd.startswith("3."):
163
- run(cmd, *args)
164
- return 0
165
-
166
- opts = []
167
- while args and (args[0].startswith("-") or "=" in args[0]):
168
- opts.append(args.pop(0))
169
-
170
- if cmd == "clean":
171
- clean()
172
- elif cmd == "setup":
173
- setup()
174
- elif cmd == "vscode":
175
- vscode()
176
- elif cmd == "check":
177
- multirun("duty", "check-quality", "check-types", "check-docs")
178
- run("default", "duty", "check-api")
179
- elif cmd in {"check-quality", "check-docs", "check-types", "test"}:
180
- multirun("duty", cmd, *opts)
181
- else:
182
- run("default", "duty", cmd, *opts)
183
-
184
- return 0
185
-
186
-
187
- if __name__ == "__main__":
188
- try:
189
- sys.exit(main())
190
- except subprocess.CalledProcessError as process:
191
- if process.output:
192
- print(process.output, file=sys.stderr)
193
- sys.exit(process.returncode)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes