소스 검색

初始化 Claudia 项目结构,添加必要的配置文件和基础代码

admin 3 달 전
부모
커밋
a9b2c19c4a
7개의 변경된 파일70개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      .env
  2. 7 0
      .vscode/settings.json
  3. 22 0
      pyproject.toml
  4. 7 0
      src/claudia/__init__.py
  5. 7 0
      src/claudia/__main__.py
  6. 14 0
      tests/conftest.py
  7. 12 0
      tests/test_imports.py

+ 1 - 0
.env

@@ -0,0 +1 @@
+PYTHONPATH=src

+ 7 - 0
.vscode/settings.json

@@ -0,0 +1,7 @@
+{
+  "python.terminal.activateEnvironment": true,
+  "python.terminal.useEnvFile": true,
+  "python.analysis.extraPaths": [
+    "${workspaceFolder}/src"
+  ]
+}

+ 22 - 0
pyproject.toml

@@ -0,0 +1,22 @@
+[project]
+name = "claudia"
+version = "0.1.0"
+description = "Claudia - Python project scaffold"
+readme = "README.md"
+requires-python = ">=3.9"
+keywords = ["scaffold", "template"]
+license = { file = "LICENSE" }
+
+[project.optional-dependencies]
+dev = ["pytest>=7"]
+
+[build-system]
+requires = ["setuptools>=61.0"]
+build-backend = "setuptools.build_meta"
+
+[project.scripts]
+claudia = "claudia.__main__:main"
+
+[tool.pytest.ini_options]
+addopts = "-q"
+pythonpath = ["src"]

+ 7 - 0
src/claudia/__init__.py

@@ -0,0 +1,7 @@
+"""Claudia package: ready for future features."""
+
+__version__ = "0.1.0"
+
+__all__ = [
+    # public API placeholders will be added here later
+]

+ 7 - 0
src/claudia/__main__.py

@@ -0,0 +1,7 @@
+def main() -> int:
+    print("Claudia package is ready.")
+    return 0
+
+
+if __name__ == "__main__":
+    raise SystemExit(main())

+ 14 - 0
tests/conftest.py

@@ -0,0 +1,14 @@
+import sys
+from pathlib import Path
+
+
+def _ensure_src_on_syspath():
+    root = Path(__file__).resolve().parents[1]
+    src = root / "src"
+    src_str = str(src)
+    # Insert at position 0 to ensure it takes precedence
+    if src_str not in sys.path:
+        sys.path.insert(0, src_str)
+
+
+_ensure_src_on_syspath()

+ 12 - 0
tests/test_imports.py

@@ -0,0 +1,12 @@
+import importlib
+
+
+def test_import_package():
+    mod = importlib.import_module("claudia")
+    assert hasattr(mod, "__version__")
+
+
+def test_entry_point_main_returns_zero():
+    entry = importlib.import_module("claudia.__main__")
+    assert callable(entry.main)
+    assert entry.main() == 0