Skip to content

Commit f8a67fd

Browse files
committed
chore: update project structure and add test files for admin and document extractor backends
1 parent d5587fd commit f8a67fd

12 files changed

Lines changed: 97 additions & 56 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ pyrightconfig.json
77
notes*.md
88
notes.md
99

10+
# macOS Finder metadata
11+
.DS_Store
12+
**/.DS_Store
13+
1014
# Node Modules
1115
node_modules/
1216

.vscode/launch.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
{
5+
"name": "Debug Pytest (current file)",
6+
"type": "python",
7+
"request": "launch",
8+
// run pytest as a module
9+
"module": "pytest",
10+
"args": [
11+
"--maxfail=1",
12+
"--disable-warnings",
13+
"-q",
14+
"${file}"
15+
],
16+
"console": "integratedTerminal",
17+
"justMyCode": false,
18+
},
419
{
520
"name": "rag_backend",
621
"type": "python",
@@ -94,7 +109,5 @@
94109
}
95110
]
96111
}
97-
98-
99112
]
100113
}

.vscode/settings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@
66
"./rag-core-library/rag-core-api/src",
77
"./rag-core-library/rag-core-lib/src",
88
"./rag-core-library/extractor-api-lib/src",
9+
"./admin-backend",
10+
"./rag-backend"
911
],
1012
"[yaml]": {
1113
"editor.tabSize": 2,
1214
"editor.insertSpaces": true,
1315
"editor.formatOnType": true,
1416
"editor.autoIndent": "advanced"
1517
},
18+
"python.testing.pytestEnabled": true,
19+
"python.testing.unittestEnabled": false,
20+
"python.testing.pytestArgs": ["--import-mode","importlib"],
21+
"python.testing.autoTestDiscoverOnSaveEnabled": true,
22+
"python.envFile": "${workspaceFolder}/.env",
23+
"python-envs.defaultEnvManager": "ms-python.python:venv",
24+
"python-envs.defaultPackageManager": "ms-python.python:pip",
25+
"python-envs.pythonProjects": [],
1626
}
27+
28+
29+

admin-backend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ COPY admin-backend/pyproject.toml admin-backend/poetry.lock ./
1919
RUN mkdir log && chmod 700 log
2020
RUN touch /app/admin-backend/log/logfile.log && chmod 600 /app/admin-backend/log/logfile.log
2121

22-
RUN poetry config virtualenvs.create false &&\
22+
RUN poetry config virtualenvs.create false && \
2323
if [ "$dev" = "1" ]; then \
2424
poetry install --no-interaction --no-ansi --no-root --with dev; \
2525
else \

admin-backend/pyproject.toml

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
[tool.poetry]
2+
name = "admin_backend"
3+
version = "1.0.0"
4+
description = "The admin backend is responsible for the document management. This includes deletion, upload and getting particular documents or document lists."
5+
authors = ["STACKIT Data and AI Consulting <data-ai-consulting@stackit.cloud>"]
6+
readme = "README.md"
7+
8+
[tool.poetry.dependencies]
9+
python = "^3.11"
10+
admin-api-lib = {path = "../rag-core-library/admin-api-lib", develop = true}
11+
12+
[tool.poetry.group.dev.dependencies]
13+
debugpy = "^1.8.1"
14+
pytest = "^8.2.1"
15+
flake8 = "^7.1.0"
16+
flake8-black = "^0.3.6"
17+
flake8-pyproject = "^1.2.3"
18+
coverage = "^7.5.4"
19+
flake8-quotes = "^3.4.0"
20+
flake8-return = "^1.2.0"
21+
flake8-annotations-complexity = "^0.0.8"
22+
flake8-bandit = "^4.1.1"
23+
flake8-bugbear = "^24.8.19"
24+
flake8-builtins = "^2.5.0"
25+
flake8-comprehensions = "^3.15.0"
26+
flake8-eradicate = "^1.5.0"
27+
flake8-expression-complexity = "^0.0.11"
28+
# flake8-logging-format = "^2024.24.12"
29+
# flake8-docstrings = "^1.7.0"
30+
flake8-pytest-style = "^2.0.0"
31+
pep8-naming = "^0.14.1"
32+
flake8-eol = "^0.0.8"
33+
flake8-exceptions = "^0.0.1a0"
34+
flake8-simplify = "^0.21.0"
35+
flake8-wot = "^0.2.0"
36+
flake8-function-order = "^0.0.5"
37+
flake8-tidy-imports = "^4.10.0"
38+
39+
[build-system]
40+
requires = ["poetry-core"]
41+
build-backend = "poetry.core.masonry.api"
42+
143
[tool.flake8]
244
exclude= [".eggs", "./rag-core-library/*", "./src/admin_backend/models/*", "./src/admin_backend/rag_backend_client/*", "./src/admin_backend/document_extractor_client/*", ".git", ".hg", ".mypy_cache", ".tox", ".venv", ".devcontainer", "venv", "_build", "buck-out", "build", "dist"]
345
statistics = true
@@ -49,45 +91,3 @@ skip_gitignore = true
4991

5092
[tool.pylint]
5193
max-line-length = 120
52-
53-
[tool.poetry]
54-
name = "admin_backend"
55-
version = "0.0.1"
56-
description = "The admin backend is responsible for the document management. This includes deletion, upload and getting particular documents or document lists."
57-
authors = ["STACKIT Data and AI Consulting <data-ai-consulting@stackit.cloud>"]
58-
readme = "README.md"
59-
60-
[tool.poetry.group.dev.dependencies]
61-
debugpy = "^1.8.1"
62-
pytest = "^8.2.1"
63-
flake8 = "^7.1.0"
64-
flake8-black = "^0.3.6"
65-
flake8-pyproject = "^1.2.3"
66-
coverage = "^7.5.4"
67-
flake8-quotes = "^3.4.0"
68-
flake8-return = "^1.2.0"
69-
flake8-annotations-complexity = "^0.0.8"
70-
flake8-bandit = "^4.1.1"
71-
flake8-bugbear = "^24.8.19"
72-
flake8-builtins = "^2.5.0"
73-
flake8-comprehensions = "^3.15.0"
74-
flake8-eradicate = "^1.5.0"
75-
flake8-expression-complexity = "^0.0.11"
76-
# flake8-logging-format = "^2024.24.12"
77-
# flake8-docstrings = "^1.7.0"
78-
flake8-pytest-style = "^2.0.0"
79-
pep8-naming = "^0.14.1"
80-
flake8-eol = "^0.0.8"
81-
flake8-exceptions = "^0.0.1a0"
82-
flake8-simplify = "^0.21.0"
83-
flake8-wot = "^0.2.0"
84-
flake8-function-order = "^0.0.5"
85-
flake8-tidy-imports = "^4.10.0"
86-
87-
[build-system]
88-
requires = ["poetry-core"]
89-
build-backend = "poetry.core.masonry.api"
90-
91-
[tool.poetry.dependencies]
92-
python = "^3.11"
93-
admin-api-lib = {path = "../rag-core-library/admin-api-lib", develop = true}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
def test_dummy() -> None:
1+
def test_dummy1() -> None:
22
print("Dummy test.")
33
assert True

conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import sys
2+
import os
3+
from pathlib import Path
4+
5+
# Add project root and specific directories to Python path
6+
project_root = Path(__file__).parent
7+
sys.path.insert(0, str(project_root))
8+
sys.path.insert(0, str(project_root / "admin-backend"))
9+
sys.path.insert(0, str(project_root / "rag-backend"))
10+
sys.path.insert(0, str(project_root / "document-extractor"))
11+
12+
# point at each rag-core library's src folder so their packages (admin_api_lib, rag_core_api, etc.) are importable
13+
lib_root = project_root / "rag-core-library"
14+
for lib in ["admin-api-lib", "rag-core-api", "rag-core-lib", "extractor-api-lib"]:
15+
sys.path.insert(0, str(lib_root / lib / "src"))

rag-backend/pyproject.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
2-
name = "rag-usecase-example"
3-
version = "0.1.0"
4-
description = ""
2+
name = "rag-backend"
3+
version = "1.0.0"
4+
description = "The RAG backend is responsible for handling the interaction with the RAG system."
55
authors = ["STACKIT Data and AI Consulting <data-ai-consulting@stackit.cloud>"]
66

77
[tool.poetry.dependencies]
@@ -39,7 +39,6 @@ flake8-tidy-imports = "^4.10.0"
3939
requires = ["poetry-core"]
4040
build-backend = "poetry.core.masonry.api"
4141

42-
4342
[tool.flake8]
4443
exclude= [".eggs", "./rag-core-library/*", ".git", ".hg", ".mypy_cache", ".tox", ".venv", ".devcontainer", "venv", "_build", "buck-out", "build", "dist"]
4544
statistics = true
@@ -58,7 +57,6 @@ per-file-ignores = """
5857
./tests/*: S101,
5958
"""
6059

61-
6260
[tool.black]
6361
line-length = 120
6462
exclude = """
@@ -80,12 +78,10 @@ exclude = """
8078
)/
8179
"""
8280

83-
8481
[tool.isort]
8582
profile = "black"
8683
skip = ['.eggs', '.git', '.hg', '.mypy_cache', '.nox', '.pants.d', '.tox', '.venv', '_build', 'buck-out', 'build', 'dist', 'node_modules', 'venv']
8784
skip_gitignore = true
8885

8986
[tool.pylint]
9087
max-line-length = 120
91-
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
def test_dummy() -> None:
1+
def test_dummy2() -> None:
22
print("Dummy test.")
33
assert True # noqa S101

0 commit comments

Comments
 (0)