Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed backend directory as python module #206

Merged
Merged
Show file tree
Hide file tree
Changes from 99 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
82f38b0
changed backend directory as python module
FadyCoding Jun 10, 2024
f95c388
removed unwanted data files from git repo
FadyCoding Jun 26, 2024
8bd3e7c
updated .gitignore
FadyCoding Jun 26, 2024
4e44b64
formated necessary files
FadyCoding Jun 26, 2024
174631f
formatting and cspell
FadyCoding Jun 26, 2024
8741db0
ignore flake8 checks for init files
FadyCoding Jun 26, 2024
b1c344e
adjusted files for flake8 checks
FadyCoding Jun 26, 2024
12d5388
cpsell and format
FadyCoding Jun 26, 2024
e2b08b0
cspell checks and ignore files added
FadyCoding Jun 26, 2024
b5d42d3
added sdist and bdist
FadyCoding Jun 26, 2024
4e57dc0
upgraded version in front and backend
FadyCoding Jun 26, 2024
07939a6
recursive for dist dir into backend package
FadyCoding Jun 28, 2024
4f40926
refactor backend script for imports
FadyCoding Jun 28, 2024
93e4779
conditionnal reloader + debug mode depending on flask env var
FadyCoding Jun 28, 2024
a9f8d5e
removed verify function and comments
FadyCoding Jun 28, 2024
4d305ef
deleted build files wrongly pushed before
FadyCoding Jun 28, 2024
b764af1
modifcation for merging with main
FadyCoding Jun 28, 2024
551bb0a
cspell
FadyCoding Jun 28, 2024
509ca76
cspell column
FadyCoding Jun 28, 2024
1c91796
Merge branch '205-debiai-easy-start-module-to-launch-debiai-standlalo…
FadyCoding Jun 28, 2024
ffa0095
fix browser opening
FadyCoding Jul 1, 2024
64f167d
enhanced setup file
FadyCoding Jul 1, 2024
30685c9
comments
FadyCoding Jul 1, 2024
43a4a78
rename backend to debiaiServer
FadyCoding Jul 4, 2024
274d91e
new workflow pipeline for debiai gui
FadyCoding Jul 4, 2024
b0735c5
setuptools added to pipeline
FadyCoding Jul 4, 2024
7ad5619
new name
FadyCoding Jul 4, 2024
a923319
version check for back and front and rename
FadyCoding Jul 4, 2024
6738b61
rename backend dir in run section
FadyCoding Jul 4, 2024
c075c1e
version update
FadyCoding Jul 4, 2024
07d47ed
ignore files updated
FadyCoding Jul 5, 2024
aafff63
rename and version var
FadyCoding Jul 5, 2024
593447b
pipeline actions for build and frontend and command to start debiai
FadyCoding Jul 5, 2024
03a4bc3
frontend dir
FadyCoding Jul 5, 2024
fd734d1
frontend test
FadyCoding Jul 5, 2024
57f58f6
version updated
FadyCoding Jul 5, 2024
61626a2
debiai command
FadyCoding Jul 5, 2024
2f934b4
new version and erased beta version
FadyCoding Jul 8, 2024
aff0e2b
update version
FadyCoding Jul 8, 2024
ed78f9f
build then setup
FadyCoding Jul 8, 2024
7b5aca8
moved frontend copy after build
FadyCoding Jul 8, 2024
9860877
frontend paths
FadyCoding Jul 8, 2024
2e0db8f
frontend build action
FadyCoding Jul 8, 2024
289700e
version updated
FadyCoding Jul 8, 2024
f5a4ee7
version fetched from swagger
FadyCoding Jul 8, 2024
34e4d0b
new command and yaml installation
FadyCoding Jul 9, 2024
e174194
update swagger version
FadyCoding Jul 9, 2024
e187ccb
doc and command options
FadyCoding Jul 10, 2024
8fca906
added connexion dependency
FadyCoding Jul 10, 2024
42ef090
requirements installed in the pipeline
FadyCoding Jul 10, 2024
69601be
requirements path
FadyCoding Jul 10, 2024
4d32f83
path corrected
FadyCoding Jul 10, 2024
e01584c
enhanced bash info
FadyCoding Jul 11, 2024
4ee8653
update frontend version
FadyCoding Jul 11, 2024
a1c6404
package data to include swagger
FadyCoding Jul 11, 2024
e554d7f
no pip upgrade
FadyCoding Jul 11, 2024
6d76195
fixed python version to 3.11
FadyCoding Jul 11, 2024
958335a
version update
FadyCoding Jul 11, 2024
7f4d22a
env var are availables in the package
FadyCoding Jul 11, 2024
382d0e2
version up
FadyCoding Jul 11, 2024
ccb957b
env var included through configs files
FadyCoding Jul 11, 2024
295694d
version updated
FadyCoding Jul 11, 2024
86168c0
double check inclusion of config files
FadyCoding Jul 11, 2024
3beb5e1
version update
FadyCoding Jul 11, 2024
8da0c2d
use of pkg ressources to get file paths
FadyCoding Jul 12, 2024
7eeeec4
update swagger version
FadyCoding Jul 12, 2024
98450a0
new path for data direcotry and psutil added to requirements
FadyCoding Jul 12, 2024
d662e77
version update
FadyCoding Jul 12, 2024
4e5a78a
colored function instead of ANSI
FadyCoding Jul 15, 2024
45974df
link to doc in bash
FadyCoding Jul 15, 2024
627cf54
ability to choose a port in command line
FadyCoding Jul 15, 2024
90cf087
wsgi for prod server condition
FadyCoding Jul 16, 2024
238ffec
added gevent module
FadyCoding Jul 16, 2024
754bd6a
versionning
FadyCoding Jul 16, 2024
57a17ae
waitress server for prod
FadyCoding Jul 16, 2024
39fa3ba
script to run + docker file updated
FadyCoding Jul 18, 2024
373cf4b
version update
FadyCoding Jul 18, 2024
9f3a22b
disable waitress warning
FadyCoding Jul 18, 2024
bf087b2
review
FadyCoding Jul 18, 2024
59e59e4
rename, comments and updated markdown
FadyCoding Jul 19, 2024
294afc6
added images for doc purposes
FadyCoding Jul 19, 2024
f2d6c82
added images to md with github links and enahnce number of threads
FadyCoding Jul 19, 2024
7d30399
corrected image links
FadyCoding Jul 19, 2024
359b378
updated version
FadyCoding Jul 19, 2024
90f2396
Merge branch 'main' of https://github.com/debiai/debiai into 205-debi…
FadyCoding Jul 19, 2024
ead0c40
rename backend into debiaiServer for PR
FadyCoding Jul 19, 2024
ffcf5d3
black
FadyCoding Jul 19, 2024
5601139
update version
FadyCoding Jul 19, 2024
52d991c
flake
FadyCoding Jul 19, 2024
bfa4b69
dockerfile
FadyCoding Jul 19, 2024
c0ca121
script to run in dev and rename of paths
FadyCoding Jul 22, 2024
9cf823f
Fixed issue with dependencies
Tomansion Jul 22, 2024
2331a47
Fixed issue with Flask env
Tomansion Jul 22, 2024
c3cb816
new name for module and correction to workflow
FadyCoding Jul 24, 2024
bba2481
Merge branch 'main' into 205-debiai-easy-start-module-to-launch-debia…
FadyCoding Jul 24, 2024
3bb9d39
coorected name
FadyCoding Jul 24, 2024
76035bb
renamed workflow
FadyCoding Jul 24, 2024
ba60ea0
test for backend
FadyCoding Jul 25, 2024
5560a14
corrected path
FadyCoding Jul 25, 2024
14fb10b
review
FadyCoding Jul 25, 2024
7688919
added swagger file
FadyCoding Jul 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ kubernetes.yaml
LICENSE

# Back
backend/__pycache__/
backend/data/
backend/tests/
backend/dist/
backend/.gitignore
backend/README.md
debiaiServer/__pycache__/
debiaiServer/data/
debiaiServer/tests/
debiaiServer/dist/
debiaiServer/.gitignore
debiaiServer/README.md

# Front
frontend/node_modules/
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/debiai_gui-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow will upload a Debiai-gui Package using Twine when the main branch is updated
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: build

on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Build frontend
run: |
cd frontend
npm install
npm run build
cp -r dist ../debiaiServer/dist
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r debiaiServer/requirements.txt
pip install setuptools wheel
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist
21 changes: 10 additions & 11 deletions .github/workflows/pull-request-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- reopened

jobs:
black-format-check: # Check that the backend codebase is formatted with black
black-format-check: # Check that the debiaiServer codebase is formatted with black
name: Black format check
runs-on: ubuntu-latest
steps:
Expand All @@ -19,12 +19,12 @@ jobs:
python-version: 3.8
- name: Install dependencies and check black format
run: |
cd backend
cd debiaiServer
python -m pip install --upgrade pip
pip install black
black --check --diff .

flake8-check: # Check that the backend codebase does not contain linting errors
flake8-check: # Check that the debiaiServer codebase does not contain linting errors
name: Flake8 check
runs-on: ubuntu-latest
steps:
Expand All @@ -35,7 +35,7 @@ jobs:
python-version: 3.8
- name: Install dependencies and check flake8 format
run: |
cd backend
cd debiaiServer
python -m pip install --upgrade pip
pip install flake8
flake8 .
Expand Down Expand Up @@ -73,18 +73,18 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Check that the version in backend and frontend are the same
- name: Check that the version in debiaiServer and frontend are the same
id: version-check
run: |
cd frontend
FRONTEND_VERSION=$(cat package.json | grep -m1 version | cut -d '"' -f 4)
cd ../backend
cd ../debiaiServer
BACKEND_VERSION=$(cat swagger.yaml | grep -m1 version | cut -d ':' -f 2 | sed 's/ //g')
if [ "$FRONTEND_VERSION" != "$BACKEND_VERSION" ]; then
echo "Version mismatch: frontend/package.json version '$FRONTEND_VERSION' != backend/swagger.yaml version '$BACKEND_VERSION'."
echo "Version mismatch: frontend/package.json version '$FRONTEND_VERSION' != debiaiServer/swagger.yaml version '$BACKEND_VERSION'."
exit 1
fi
echo "Version match: frontend/package.json version '$FRONTEND_VERSION' == backend/swagger.yaml version '$BACKEND_VERSION'."
echo "Version match: frontend/package.json version '$FRONTEND_VERSION' == debiaiServer/swagger.yaml version '$BACKEND_VERSION'."
echo "BRANCH_VERSION=$FRONTEND_VERSION" >> $GITHUB_OUTPUT

- uses: actions/checkout@v3
Expand Down Expand Up @@ -146,14 +146,13 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
cd backend
cd debiaiServer
python -m pip install --upgrade pip
pip install pytest
pip install -r requirements.txt
- name: Test with pytest
run: |
cd backend
python websrv.py & sleep 5 && pytest tests/
python run_debiai_server_dev.py & sleep 5 && pytest debiaiServer/tests/

docker-build-check: # Build the docker image and check that it can run
name: Docker build check
Expand Down
26 changes: 19 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# Byte-compiled / optimized / DLL files
__pycache__/

# Build and packaging
dist/
deployment/
.vscode/
build/
*data/
*.egg-info/

# Dependency directories
frontend/node_modules/

# Back
backend/data
# coverage
.coverage
__pycache__/

# Front
frontend/node_modules/
# Scripts
build_and_run.sh

# Deployement
deployment/

# VSCODE
.vscode/
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ COPY frontend/ .
RUN npm install
RUN npm run build

# DebiAI Python Backend
# DebiAI Python debiaiServer
FROM python:3.10.12-slim-bullseye
WORKDIR /backend
COPY backend/ .
RUN pip install --trusted-host pypi.python.org -r requirements.txt
COPY --from=build-stage /frontend/dist dist
ENV FLASK_ENV production
CMD ["python", "websrv.py"]
WORKDIR /
COPY debiaiServer/ debiaiServer/
RUN pip install --trusted-host pypi.python.org -r debiaiServer/requirements.txt
COPY run_debiai_server_prod.py .
COPY --from=build-stage /frontend/dist debiaiServer/dist
CMD ["python", "run_debiai_server_prod.py"]

6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include debiaiServer/swagger.yaml
include debiaiServer/config/config.env
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file required?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include debiaiServer/config/config.ini
include images/ *
recursive-include debiaiServer/dist *

26 changes: 0 additions & 26 deletions backend/init.py

This file was deleted.

11 changes: 11 additions & 0 deletions build_and_run.sh
Tomansion marked this conversation as resolved.
Show resolved Hide resolved
Tomansion marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Remove previous build and dist directories
rm -rf build dist debiaiServer.egg-info

# Generated source distribution and wheel distribution
python3 setup.py sdist bdist_wheel

# Install the package
pip install .

# Run the package
debiai_gui start
10 changes: 7 additions & 3 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@
"Valeo",
"vuejs",
"Vuex",
"websrv"
"websrv",
"werkzeug",
"sdist",
"bdist"
],
"flagWords": [],
"ignorePaths": [
Expand All @@ -63,11 +66,12 @@
"*.png",
"*.yaml",
".vscode/*",
"backend/requirements.txt",
"backend/data/*",
"debiaiServer/requirements.txt",
"debiaiServer/data/*",
"__pycache__/",
"frontend/dist",
"frontend/node_modules",
"./setup.py",
"TODO"
]
}
1 change: 1 addition & 0 deletions debiaiServer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from debiaiServer.websrv import send_frontend, create_app, start_server
Empty file added debiaiServer/config/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from configparser import ConfigParser
from termcolor import colored

import pkg_resources
import os

config_path = "config/config.ini"
config_path = pkg_resources.resource_filename("debiaiServer", "config/config.ini")
config_parser = ConfigParser()

DEBUG_COLOR = "light_blue"
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#############################################################################
# Imports
#############################################################################
from config.init_config import get_config
from utils.utils import is_url_valid, is_valid_name
import modules.algoProviders.algoProvidersManager as algo_provider_manager
from modules.algoProviders.AlgoProviderException import AlgoProviderException
from modules.algoProviders.AlgoProvider import AlgoProvider
from debiaiServer.config.init_config import get_config
from debiaiServer.utils.utils import is_url_valid, is_valid_name
import debiaiServer.modules.algoProviders.algoProvidersManager as algo_provider_manager
from debiaiServer.modules.algoProviders.AlgoProviderException import (
AlgoProviderException,
)
from debiaiServer.modules.algoProviders.AlgoProvider import AlgoProvider

#############################################################################
# Algo providers Management
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#############################################################################
# Imports
#############################################################################
import modules.dataProviders.dataProviderManager as data_provider_manager
from modules.dataProviders.DataProviderException import DataProviderException
import debiaiServer.modules.dataProviders.dataProviderManager as data_provider_manager
from debiaiServer.modules.dataProviders.DataProviderException import (
DataProviderException,
)

#############################################################################
# Data Management
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#############################################################################
# Imports
#############################################################################
from config.init_config import get_config
from modules.dataProviders.webDataProvider.WebDataProvider import WebDataProvider
from utils.utils import is_url_valid
import modules.dataProviders.dataProviderManager as data_provider_manager
from modules.dataProviders.DataProviderException import DataProviderException
from debiaiServer.config.init_config import get_config
from debiaiServer.modules.dataProviders.webDataProvider.WebDataProvider import (
WebDataProvider,
)
from debiaiServer.utils.utils import is_url_valid
import debiaiServer.modules.dataProviders.dataProviderManager as data_provider_manager
from debiaiServer.modules.dataProviders.DataProviderException import (
DataProviderException,
)

#############################################################################
# Data Providers Management
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from config.init_config import get_config
import modules.exportMethods.exportUtils as exportUtils
from debiaiServer.config.init_config import get_config
import debiaiServer.modules.exportMethods.exportUtils as exportUtils

#############################################################################
# Export API Management
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#############################################################################
# Imports
#############################################################################
import utils.layouts.layouts as layoutsUtils
import debiaiServer.utils.layouts.layouts as layoutsUtils

#############################################################################
# Analysis dashboard layout Management
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# Imports
#############################################################################

import modules.dataProviders.dataProviderManager as data_provider_manager
from modules.dataProviders.DataProviderException import DataProviderException
import debiaiServer.modules.dataProviders.dataProviderManager as data_provider_manager
from debiaiServer.modules.dataProviders.DataProviderException import (
DataProviderException,
)

#############################################################################
# MODELS Management
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#############################################################################
# Imports
#############################################################################
from modules.dataProviders.DataProviderException import DataProviderException
import modules.dataProviders.dataProviderManager as data_provider_manager
from debiaiServer.modules.dataProviders.DataProviderException import (
DataProviderException,
)
import debiaiServer.modules.dataProviders.dataProviderManager as data_provider_manager

#############################################################################
# PROJECTS Management
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from modules.dataProviders.DataProviderException import DataProviderException
import modules.dataProviders.dataProviderManager as data_provider_manager
from debiaiServer.modules.dataProviders.DataProviderException import (
DataProviderException,
)
import debiaiServer.modules.dataProviders.dataProviderManager as data_provider_manager


# Project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# Imports
#############################################################################

import modules.dataProviders.dataProviderManager as data_provider_manager
from modules.dataProviders.DataProviderException import DataProviderException
import debiaiServer.modules.dataProviders.dataProviderManager as data_provider_manager
from debiaiServer.modules.dataProviders.DataProviderException import (
DataProviderException,
)

#############################################################################
# Selections Management
Expand Down
Loading
Loading