-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add gitignore * Add packaging files * Add formatting to python script files * Fixes to make notebook work * Notebook review, challange updated. * Fix data loading directory for test * update gitignore * fix prediction test * Add comment to challange.md * Passed models tests * Add poetry lock file * Fix model bugs * Additional model improvements * Remove ipdb from model training. * Update fastapi version * Add api * Update gitignore * Removed unused imports * Update model storing directory * Chande model loading * Change directory for storing the model * Update poetry with appropriate versions * Add dockerfile * Update dockerfile command * Add deploy script, and docker fix * update library version for stress test * update stress tests url * Update doc * Add copy of model to dockerfile * Update dockerfile and poetry lock * Add change to dockerfile * Add training to deploy script * Moved ci/cd files to appropriate directory. * First ci update * Add paths to testing * Add .github folder to trigger * add '' to paths * Add commands to ci * Fix syntax error * Add module files to needed paths * setup python version * Check directory * Checkout code * Fix installation * add virtualenv folder to executing machine * Add test dependencies to poetry * Modified dependencies installation * Add model retrival * Add api test * rename job * Add cd workflow * Fix syntax error * Check secret upload * Add gcp authentication * Add github actions workflows to PRs on main.
- Loading branch information
1 parent
8377c97
commit a63f7b3
Showing
19 changed files
with
4,906 additions
and
336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[flake8] | ||
# select all | ||
select = A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z | ||
max-line-length = 88 | ||
inline-quotes = double | ||
exclude = .venv, .git, .eggs, __pycache__, build, dist, __init__.py, .ipynb, .ipynb_checkpoints | ||
ignore = | ||
# disable, whitespace before ':' | ||
E203, | ||
# disable "too many leading '#' for block comment" | ||
E266, | ||
# disable "line break before binary operator" which clashes with black | ||
W503, | ||
# disable "invalid escape sequence" | ||
W605, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: 'Continuous Delivery' | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
- main | ||
paths: | ||
- 'challenge/**' | ||
- 'scripts/**' | ||
- '.github/**' | ||
- 'pyproject.toml' | ||
- 'poetry.lock' | ||
|
||
jobs: | ||
run_testing: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Google Cloud SDK | ||
uses: google-github-actions/auth@v1 | ||
with: | ||
credentials_json: ${{ secrets.GCP_CREDENTIAL }} | ||
- name: Check directory | ||
run: | | ||
ls | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10.8' | ||
- name: Python version | ||
run: | | ||
python --version | ||
- name: Install poetry and virtualenv | ||
run: | | ||
pip install poetry | ||
- name: Install dependencies | ||
run: | | ||
poetry config virtualenvs.create false | ||
poetry lock --no-update | ||
poetry install | ||
- name: Push to prod | ||
run: | | ||
bash scripts/deploy.sh | ||
- name: Run stress test | ||
run: | | ||
make stress-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: 'Continuous Integration' | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
- main | ||
paths: | ||
- 'challenge/**' | ||
- 'scripts/**' | ||
- '.github/**' | ||
- 'pyproject.toml' | ||
- 'poetry.lock' | ||
|
||
jobs: | ||
run_testing: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Check directory | ||
run: | | ||
ls | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10.8' | ||
- name: Python version | ||
run: | | ||
python --version | ||
- name: Install poetry and virtualenv | ||
run: | | ||
pip install poetry | ||
- name: Install dependencies | ||
run: | | ||
poetry config virtualenvs.create false | ||
poetry lock --no-update | ||
poetry install | ||
- name: Get model | ||
run: | ||
python challenge/model.py | ||
- name: Run model test | ||
run: | | ||
make model-test | ||
- name: Run api test | ||
run: | | ||
make api-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# poetry | ||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. | ||
# This is especially recommended for binary packages to ensure reproducibility, and is more | ||
# commonly ignored for libraries. | ||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control | ||
#poetry.lock | ||
|
||
# pdm | ||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. | ||
#pdm.lock | ||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it | ||
# in version control. | ||
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control | ||
.pdm.toml | ||
.pdm-python | ||
.pdm-build/ | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm | ||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
#.idea/ | ||
|
||
reports/* | ||
*.pkl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.10.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
// Set correct python path to venv's one | ||
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python", | ||
// Hide .venv from explorer and searchbar | ||
"files.watcherExclude": { | ||
"**/.venv/**": true | ||
}, | ||
"files.exclude": { | ||
"**/.venv/": true | ||
}, | ||
"search.exclude": { | ||
"**/.venv/": true | ||
}, | ||
// Linting and formatting | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "explicit" | ||
}, | ||
// auto formatter | ||
"black-formatter.importStrategy": "fromEnvironment", | ||
// import formatter | ||
"isort.importStrategy": "fromEnvironment", | ||
"isort.args": [ | ||
"--settings-path", | ||
"${workspaceFolder}/pyproject.toml" | ||
], | ||
// linting | ||
"flake8.importStrategy": "fromEnvironment", | ||
"flake8.args": [ | ||
"--config=${workspaceFolder}/.flake8" | ||
], | ||
"editor.wordWrapColumn": 100, | ||
"files.trimFinalNewlines": true, | ||
"files.trimTrailingWhitespace": true, | ||
// | ||
// Jupyter | ||
// | ||
"jupyter.notebookFileRoot": "${workspaceFolder}", | ||
"jupyter.interactiveWindow.textEditor.executeSelection": true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
# syntax=docker/dockerfile:1.2 | ||
FROM python:latest | ||
# put you docker configuration here | ||
FROM python:3.10.11 | ||
# put you docker configuration here | ||
|
||
WORKDIR /module | ||
RUN apt update && apt install -y build-essential | ||
RUN pip install poetry | ||
|
||
# copy all stuff into container | ||
COPY challenge/ ./challenge | ||
COPY pyproject.toml/ . | ||
COPY poetry.lock . | ||
COPY models/ ./models | ||
|
||
# add empty README and install | ||
RUN touch README.md | ||
RUN poetry config virtualenvs.create false | ||
RUN poetry lock --no-update | ||
RUN poetry install --only main | ||
|
||
|
||
CMD ["python", "-m", "uvicorn", "challenge.api:app", "--host", "0.0.0.0", "--port", "8080"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.