Skip to content

Commit 2b1fd5a

Browse files
committed
Squashed merge
1 parent a02de40 commit 2b1fd5a

File tree

171 files changed

+96451
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+96451
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Base image for Python development with Node.js integration
2+
ARG VARIANT=3.13-bullseye
3+
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
4+
5+
ARG NODE_VERSION="20"
6+
ENV NPM_HOME="/npm"
7+
ENV PATH="$NPM_HOME:$PATH"
8+
9+
RUN if [ "${NODE_VERSION}" != "none" ]; then \
10+
su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} && nvm alias default ${NODE_VERSION}"; \
11+
fi
12+
13+
WORKDIR /workspace
14+
15+
COPY ./backend /workspace/backend
16+
17+
# Install Maven and JRE dependencies
18+
RUN apt-get update && apt-get install -y curl default-jre-headless maven jq && \
19+
mkdir -p ~/bin/openapitools && \
20+
curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/dc175c5/bin/utils/openapi-generator-cli.sh > ~/bin/openapitools/openapi-generator-cli && \
21+
chmod u+x ~/bin/openapitools/openapi-generator-cli && \
22+
export PATH=$PATH:~/bin/openapitools/
23+
24+
# Generate API clients
25+
RUN mkdir -p /workspace/backend/lib/aitrios-console-python-client && \
26+
OPENAPI_GENERATOR_VERSION=7.12.0 ~/bin/openapitools/openapi-generator-cli generate \
27+
-i /workspace/backend/client_specs/aitrios-console-openapi.json \
28+
-g python \
29+
-o /workspace/backend/lib/aitrios-console-python-client \
30+
--package-name console_api_client
31+
32+
RUN mkdir -p /workspace/backend/lib/aitrios-console-v2-python-client && \
33+
OPENAPI_GENERATOR_VERSION=7.12.0 ~/bin/openapitools/openapi-generator-cli generate \
34+
-i /workspace/backend/client_specs/aitrios-console-v2-openapi.json \
35+
-g python \
36+
-o /workspace/backend/lib/aitrios-console-v2-python-client \
37+
--package-name console_v2_api_client
38+
39+
RUN pip install ./backend/lib/aitrios-console-python-client \
40+
&& pip install ./backend/lib/aitrios-console-v2-python-client \
41+
&& pip install -e ./backend
42+
43+
EXPOSE 8000 3000
44+
45+
WORKDIR /workspace/backend
46+
CMD ["sh", "-c", "tail -f /dev/null"]

.devcontainer/devcontainer.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "Reference Solution dev container",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "app",
5+
"features": {
6+
"github-cli": "latest"
7+
},
8+
"workspaceFolder": "/workspace",
9+
"customizations": {
10+
"vscode": {
11+
"extensions": [
12+
"ms-python.python",
13+
"ms-python.vscode-pylance",
14+
"ms-python.flake8",
15+
"ms-python.black-formatter",
16+
"dbaeumer.vscode-eslint",
17+
"esbenp.prettier-vscode"
18+
]
19+
},
20+
"settings": {
21+
"terminal.integrated.defaultProfile.linux": "bash",
22+
"terminal.integrated.profiles.linux": {
23+
"bash": {
24+
"path": "/bin/bash",
25+
"icon": "terminal-bash"
26+
}
27+
},
28+
"python.pythonPath": "/usr/local/bin/python",
29+
"python.defaultInterpreterPath": "/usr/local/bin/python",
30+
"python.languageServer": "Pylance",
31+
"editor.formatOnSave": true,
32+
"[python]": {
33+
"editor.defaultFormatter": "ms-python.black-formatter"
34+
},
35+
"black-formatter.args": [
36+
"--line-length=88"
37+
],
38+
"flake8.args": [
39+
"--max-line-length=88",
40+
"--select=W,B,F,E711,E712,E901",
41+
"--ignore=E203,B005,F401,F811,F821,F403,F405,W503",
42+
"--max-complexity=11"
43+
],
44+
"[typescript]": {
45+
"editor.defaultFormatter": "esbenp.prettier-vscode"
46+
},
47+
"[typescriptreact]": {
48+
"editor.defaultFormatter": "esbenp.prettier-vscode"
49+
},
50+
"prettier.workingDirectories": [
51+
{
52+
"mode": "auto"
53+
}
54+
],
55+
"eslint.workingDirectories": [
56+
{
57+
"mode": "auto"
58+
}
59+
]
60+
}
61+
},
62+
"forwardPorts": [8000, 3000, 5432],
63+
"remoteEnv": {
64+
"SQLALCHEMY_DATABASE_URI": "postgresql://youruser:yourpassword@db/yourdatabase"
65+
},
66+
"postCreateCommand": ".devcontainer/scripts/postCreate.sh",
67+
"postStartCommand": ".devcontainer/scripts/postStart.sh",
68+
"portsAttributes": {
69+
"8000": { "label": "Backend API"},
70+
"3000": { "label": "Frontend" ,
71+
"onAutoForward": "openBrowser"
72+
},
73+
"5432": { "label": "Database" }
74+
}
75+
}

.devcontainer/docker-compose.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
services:
2+
app:
3+
build:
4+
context: ..
5+
dockerfile: .devcontainer/Dockerfile
6+
ports:
7+
- "8000:8000"
8+
- "3000:3000"
9+
environment:
10+
POSTGRES_USER: youruser
11+
POSTGRES_PASSWORD: yourpassword
12+
POSTGRES_DB: yourdatabase
13+
SQLALCHEMY_DATABASE_URI: postgresql://youruser:yourpassword@db/yourdatabase
14+
volumes:
15+
- ..:/workspace:cached
16+
depends_on:
17+
- db
18+
19+
db:
20+
image: postgres:17.1
21+
environment:
22+
POSTGRES_USER: youruser
23+
POSTGRES_PASSWORD: yourpassword
24+
POSTGRES_DB: yourdatabase
25+
ports:
26+
- "5432:5432"
27+
tmpfs:
28+
- /var/lib/postgresql/data
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo "Running post-create tasks..."
6+
7+
cd /workspace/frontend/app
8+
echo "Installing dependencies for frontend..."
9+
npm install
10+

.devcontainer/scripts/postStart.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo "Running post-start tasks..."
6+
if [ -n "$CODESPACE_NAME" ]; then
7+
gh codespace ports visibility 8000:public -c $CODESPACE_NAME
8+
fi
9+
10+
echo "Starting the backend and frontend services..."
11+
cd /workspace
12+
uvicorn backend.app.main:app --host 0.0.0.0 --port 8000 --reload &
13+
(
14+
cd /workspace/frontend/app
15+
echo "Starting the frontend..."
16+
if [ -n "$CODESPACE_NAME" ]; then
17+
npm run dev -- --mode codespace --host 0.0.0.0 --port 3000
18+
else
19+
npm run dev -- --host 0.0.0.0 --port 3000
20+
fi
21+
)

.flake8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[flake8]
2+
max-line-length = 88
3+
select = W,B,F,E711,E712,E901
4+
extend-ignore = E203,B005,F401,F811,F821,F403,F405,W503
5+
exclude = .git,.eggs,__pycache__,build,dist,venv
6+
max-complexity = 11

.gitignore

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
5+
6+
# Distribution / packaging
7+
.Python
8+
build/
9+
develop-eggs/
10+
frontend/node_modules/
11+
12+
dist/
13+
sdist/
14+
var/
15+
*.egg-info/
16+
*.egg
17+
MANIFEST
18+
19+
# Unit test / coverage reports
20+
htmlcov/
21+
.tox/
22+
.nox/
23+
.coverage
24+
.coverage.*
25+
.cache
26+
nosetests.xml
27+
coverage.xml
28+
*.cover
29+
*.py,cover
30+
.hypothesis/
31+
.pytest_cache/
32+
cover/
33+
34+
# Jupyter Notebook
35+
.ipynb_checkpoints
36+
37+
# IPython
38+
profile_default/
39+
ipython_config.py
40+
41+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
42+
__pypackages__/
43+
44+
# Environments
45+
.venv
46+
env/
47+
venv/
48+
ENV/
49+
env.bak/
50+
venv.bak/
51+
52+
ai_model/datasets/
53+
ai_model/yolo*
54+
ai_model/converter*
55+
ai_model/best_yolo*

.pre-commit-config.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
exclude: '(\.vscode/.*\.json|backend/client_specs/)'
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.6.0
5+
hooks:
6+
- id: trailing-whitespace
7+
- id: check-docstring-first
8+
- id: check-added-large-files
9+
- id: debug-statements
10+
- repo: https://github.com/hadialqattan/pycln
11+
rev: v2.5.0
12+
hooks:
13+
- id: pycln
14+
args: [--all]
15+
- repo: https://github.com/pre-commit/pygrep-hooks
16+
rev: v1.10.0
17+
hooks:
18+
- id: python-use-type-annotations
19+
- repo: https://github.com/asottile/reorder_python_imports
20+
rev: v3.13.0
21+
hooks:
22+
- id: reorder-python-imports
23+
args: [--py39-plus]
24+
- repo: https://github.com/asottile/pyupgrade
25+
rev: v3.17.0
26+
hooks:
27+
- id: pyupgrade
28+
args: [--py39-plus]
29+
- repo: https://github.com/psf/black-pre-commit-mirror
30+
rev: 24.8.0
31+
hooks:
32+
- id: black
33+
- repo: https://github.com/PyCQA/flake8
34+
rev: 7.1.1
35+
hooks:
36+
- id: flake8
37+
- repo: https://gitlab.com/bmares/check-json5
38+
rev: v1.0.0
39+
hooks:
40+
- id: check-json5
41+
- repo: https://github.com/whtsky/pre-commit-pretty-format-json5
42+
rev: "1.0.0"
43+
hooks:
44+
- id: pretty-format-json5
45+
args: [--autofix, --no-sort-keys]
46+

.vscode/launch.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Launch FE Debugger",
6+
"type": "chrome",
7+
"request": "launch",
8+
"url": "http://localhost:3000",
9+
"webRoot": "${workspaceFolder}/frontend/app"
10+
},
11+
{
12+
"name": "Launch BE Debugger",
13+
"type": "python",
14+
"request": "attach",
15+
"connect": {
16+
"host": "0.0.0.0",
17+
"port": 10001
18+
},
19+
"pathMappings": [
20+
{
21+
"localRoot": "${workspaceFolder}/backend/app",
22+
"remoteRoot": "/app/app"
23+
}
24+
],
25+
"justMyCode": true
26+
}
27+
]
28+
}

0 commit comments

Comments
 (0)