Skip to content

Commit

Permalink
0.28.0 debiai-gui
Browse files Browse the repository at this point in the history
DebiAI Standalone Python module
  • Loading branch information
Tomansion authored Jul 25, 2024
2 parents 018865a + 7688919 commit add8960
Show file tree
Hide file tree
Showing 97 changed files with 638 additions and 240 deletions.
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"]

5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include debiaiServer/swagger.yaml
include debiaiServer/config/config.ini
include images/ *
recursive-include debiaiServer/dist *

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

This file was deleted.

10 changes: 7 additions & 3 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@
"Valeo",
"vuejs",
"Vuex",
"websrv"
"websrv",
"werkzeug",
"sdist",
"bdist"
],
"flagWords": [],
"ignorePaths": [
Expand All @@ -64,11 +67,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
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import numpy as np
import numpy.random as nr

from scipy.stats.stats import pearsonr, spearmanr
from scipy.stats import pearsonr, spearmanr
from scipy.special import digamma
import scipy.spatial as ss
from scipy.spatial.ckdtree import cKDTree
from scipy.spatial import cKDTree
from sklearn.neighbors import NearestNeighbors
from math import log, fabs, sqrt

Expand Down
Loading

0 comments on commit add8960

Please sign in to comment.