Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
227fe9d
wip
bastgau Sep 23, 2023
85a2238
wip
bastgau Sep 23, 2023
0e5a25d
wip
bastgau Sep 23, 2023
80e08c4
wip
bastgau Sep 23, 2023
6fba1a4
wip
bastgau Sep 23, 2023
031f445
wip
bastgau Sep 24, 2023
f463cd0
wip
bastgau Sep 24, 2023
b1cb796
wip
bastgau Sep 24, 2023
1b1c381
wip
bastgau Sep 24, 2023
f38a109
wip
bastgau Sep 24, 2023
84199cc
wip
bastgau Sep 24, 2023
5719b07
wip
bastgau Sep 24, 2023
ac3b60b
wip
bastgau Sep 24, 2023
7fb49dc
xip
bastgau Sep 24, 2023
788e567
wip
bastgau Sep 25, 2023
b6d98b2
wip
bastgau Sep 25, 2023
2f57a81
wip
bastgau Sep 25, 2023
ee6ed3d
wip
bastgau Sep 25, 2023
fa87225
Delete .devcontainer/devcontainer.json
bastgau Sep 25, 2023
6534cb2
Delete .devcontainer/project.env
bastgau Sep 25, 2023
fcedb2c
wip
bastgau Sep 25, 2023
73b02f5
wip
bastgau Sep 25, 2023
8b02fee
wip
bastgau Sep 25, 2023
9f01c9b
wip
bastgau Sep 25, 2023
4163509
wip
bastgau Sep 25, 2023
30c17ff
Add tool
bastgau Sep 26, 2023
e229164
wip
bastgau Sep 26, 2023
1ae1a5c
wip
Sep 26, 2023
3a0a576
wip
Sep 26, 2023
45d6a52
wip
bastgau Sep 26, 2023
aaf669d
wip
bastgau Sep 26, 2023
8d66732
wip
bastgau Sep 26, 2023
d031986
wip
bastgau Sep 26, 2023
397c4b6
Rename all installation files
bastgau Sep 27, 2023
135a2f1
wip
bastgau Sep 27, 2023
8e97f1e
wip
bastgau Sep 27, 2023
d6f2164
wip
Sep 27, 2023
3246171
wip
bastgau Sep 27, 2023
65939ef
wip
bastgau Sep 27, 2023
d05d908
wip
Oct 6, 2023
0a1eacd
wip
bastgau Oct 6, 2023
dc6e6f9
doc
bastgau Oct 9, 2023
c551ad1
doc
bastgau Oct 9, 2023
05a02d2
ok
bastgau Oct 9, 2023
0f0a92d
update
bastgau Oct 9, 2023
b9d7c43
add streamlist
bastgau Oct 9, 2023
0394da6
ok
bastgau Oct 9, 2023
ae91891
ok
bastgau Oct 9, 2023
f2307ca
ok
bastgau Oct 9, 2023
dadcf0d
ok
bastgau Oct 9, 2023
923a0c6
doc
bastgau Oct 9, 2023
fa3f703
Add package
bastgau Oct 9, 2023
d0bfbb9
ok
Oct 9, 2023
1921c35
Mypy
bastgau Oct 10, 2023
2f3741a
pre-commit
bastgau Oct 10, 2023
6788965
settings
bastgau Oct 10, 2023
0ea591a
config
bastgau Oct 10, 2023
5a61419
settings
bastgau Oct 10, 2023
16a46a0
linter
bastgau Oct 10, 2023
d649121
linter
bastgau Oct 10, 2023
0cb7677
lsp_server.py
bastgau Oct 10, 2023
8abec3e
linters
bastgau Oct 10, 2023
fe70851
pyright
bastgau Oct 10, 2023
5a3719e
Remove lsp_server.py file
bastgau Oct 20, 2023
f353a91
New config for Azure Function
bastgau Oct 20, 2023
468fb68
Remove deprecated file
bastgau Oct 20, 2023
11c11f0
wip
bastgau Oct 20, 2023
e800349
wip
bastgau Oct 25, 2023
963baa8
wip
bastgau Oct 25, 2023
16a9f6a
wip
bastgau Oct 25, 2023
3957876
wip
bastgau Oct 26, 2023
913498b
wip
bastgau Oct 26, 2023
bc6b3cc
wip
bastgau Oct 26, 2023
4d48fca
wip
bastgau Oct 26, 2023
ff99065
wip
bastgau Oct 26, 2023
17e4dee
wip
bastgau Oct 26, 2023
2140ec6
wip
bastgau Oct 26, 2023
baa2ac7
wip
bastgau Oct 26, 2023
308dad8
wip
bastgau Oct 26, 2023
b5fdd37
wip
bastgau Oct 26, 2023
850529a
wip
bastgau Oct 26, 2023
b49bbd8
wip
bastgau Oct 26, 2023
e0079ce
wip
bastgau Oct 26, 2023
f92cec2
wip
bastgau Oct 26, 2023
9b247db
wip
bastgau Oct 26, 2023
7441c57
wip
bastgau Oct 26, 2023
75b5428
ok
bastgau Oct 26, 2023
99490de
wip
bastgau Oct 26, 2023
41bcb6f
wip
bastgau Oct 26, 2023
aa4d901
wip
bastgau Oct 26, 2023
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
26 changes: 0 additions & 26 deletions .devcontainer/check-post-install.sh

This file was deleted.

36 changes: 0 additions & 36 deletions .devcontainer/devcontainer.json

This file was deleted.

11 changes: 1 addition & 10 deletions .devcontainer/install-deps.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
#!/bin/bash

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install vim

# Install the Microsoft ODBC driver for SQL Server (Linux)
# https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server

# curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
# curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list
# sudo apt-get update
# sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
# Notice: Add pyodbc in requirements.txt or pyproject.toml file.
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install vim dos2unix
132 changes: 31 additions & 101 deletions .devcontainer/install.sh
Original file line number Diff line number Diff line change
@@ -1,121 +1,51 @@
#!/bin/bash

RED="\e[31m"
GREEN="\e[32m"
BLUE="\e[34m"
YELLOW="\e[33m"
ENDCOLOR="\e[0m"
. "$WORKSPACE_PATH/tools/color.sh"

echo -e "\n${BLUE}################################"
echo -e "${BLUE}#### INSTALL.SH ####${ENDCOLOR}"
echo -e "${BLUE}################################"
cd "$WORKSPACE_PATH/.devcontainer/install"

echo -e "\n${GREEN}> Configure virtual environment.${ENDCOLOR}\n"
CONTAINER_TYPE=$(jq -r '.customizations.vscode.settings."container.type"' $WORKSPACE_PATH/.devcontainer/devcontainer.json);
echo -e "\n${BLUE}You are about to initiate a project '${YELLOW}$CONTAINER_TYPE${BLUE}'.${ENDCOLOR}"

sudo chgrp vscode /workspaces/app/.venv
sudo chown vscode /workspaces/app/.venv

git config --global --add safe.directory /workspaces/app
git config --global core.eol lf
git config --global core.autocrlf false

python3 -m venv /workspaces/app/.venv
PATH="/workspaces/app/.venv/bin:$PATH"

echo -e "Done.\n"

echo -e "${GREEN}> Update PIP tool.${ENDCOLOR}\n"
pip install --upgrade pip

echo -e "\n${GREEN}> Identify the packaging and dependency manager to install.${ENDCOLOR}\n"

PIP_MANAGER=false
POETRY_MANAGER=false

NEW_POETRY_INSTALL=false

FILE=/workspaces/app/requirements.txt

if [ -f "$FILE" ];
then
echo -e "PIP configuration file was found (requirements.txt).\n"
PIP_MANAGER=true
fi

FILE=/workspaces/app/pyproject.toml

if [ -f "$FILE" ];
then
echo -e "POETRY configuration file was found (pyproject.toml).${ENDCOLOR}"
POETRY_MANAGER=true
fi

if [ "$POETRY_MANAGER" = true ] && [ "$PIP_MANAGER" = true ];
then
echo -e "${RED}> ERROR: You cannot define two packaging and dependency manager in the same time.${ENDCOLOR}\n"
if [ ]; then
echo -e "\n💥 ${RED}Installation was aborted. Specified container type '$CONTAINER_TYPE' is not supported.${ENDCOLOR}💥\n"
exit 1
fi

if [ "$POETRY_MANAGER" = false ] && [ "$PIP_MANAGER" = false ];
then

echo -e "${YELLOW}No packaging and dependency manager was found.${ENDCOLOR}"
echo -e "${YELLOW}Type 'PIP' or 'POETRY' if you want to install a packaging and dependency manager !${ENDCOLOR}"
echo -e "${YELLOW}Another option will install no packaging and dependency manager.${ENDCOLOR}"
echo -e "${YELLOW}Your selection :${ENDCOLOR}"
install_files=()

read MANAGER
echo -e "The following packaging and dependency manager will be installed : $MANAGER\n"

if [ "${MANAGER^^}" = "POETRY" ]
then
POETRY_MANAGER=true
NEW_POETRY_INSTALL=true
while IFS= read -r -d $'\0' current_file ; do
if ! grep -q "# ignored: $CONTAINER_TYPE" "$current_file"; then
install_files+=("$current_file")
fi
done < <(find ./ -type f -name "*.sh" -print0)

if [ "${MANAGER^^}" = "PIP" ]
then
PIP_MANAGER=true
touch /workspaces/app/requirements.txt
touch /workspaces/app/requirements-dev.txt
fi
install_files=($(printf "%s\n" "${install_files[@]}" | sort))

fi

source /workspaces/app/.venv/bin/activate
echo -e "${BLUE}We have found ${YELLOW}${#install_files[@]}${BLUE} installation files.${ENDCOLOR}"

if [ "$PIP_MANAGER" = true ];
then
for install_file in "${install_files[@]}"; do
if [ -f "$install_file" ]; then

echo -e "${GREEN}> Install dependencies with PIP.${ENDCOLOR}\n"
echo -e "\n\e[104m Execute: $install_file \e[49m"

# pip install keyring artifacts-keyring
if [ ! -x "$install_file" ]; then
chmod +x "$install_file"
fi

# cat <<EOF >> /workspaces/app/.venv/pip.conf
# [global]
# extra-index-url=https://pkgs.dev.azure.com/...
# EOF
./"$install_file"

pip install -r /workspaces/app/requirements-dev.txt
pip install -r /workspaces/app/requirements.txt
if [ "$?" -ge 1 ]; then
echo -e "\n💥 ${RED}Installation was aborted. Check the errors displayed above.${ENDCOLOR}💥\n"
exit 1
else
echo -e "${YELLOW}... Press any key to continue ..."
read -s -p " " -n 1 -r
echo -e "${ENDCOLOR}"
fi

fi

if [ "$POETRY_MANAGER" = true ];
then

echo -e "${GREEN}> Install POETRY tool and install dependencies.${ENDCOLOR}\n"
curl -sSL https://install.python-poetry.org | python3 -
poetry completions bash >> ~/.bash_completion

if [ "$POETRY_MANAGER" = true ];
then
poetry init
fi
done

poetry install

fi

chmod +x /workspaces/app/.devcontainer/check-post-install.sh
/workspaces/app/.devcontainer/check-post-install.sh
echo -e "🎉 ${YELLOW}Installation is finished!${ENDCOLOR}"
echo -e "🎉 ${YELLOW}You can close all terminal windows and reload the project!${ENDCOLOR}\n"
71 changes: 71 additions & 0 deletions .devcontainer/install/01-project-review.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash

. "$WORKSPACE_PATH/tools/color.sh"

echo -e "\n${BLUE}#############################################################${ENDCOLOR}"
echo -e "${BLUE}##### #####${ENDCOLOR}"
echo -e "${BLUE}##### Project review #####${ENDCOLOR}"
echo -e "${BLUE}##### #####${ENDCOLOR}"
echo -e "${BLUE}#############################################################${ENDCOLOR}"

echo -e "\n${GREEN}> Project review.${ENDCOLOR}\n"

DEPENDENCY_MANAGER=$(jq -r '.customizations.vscode.settings."python.dependencyManager"' $WORKSPACE_PATH/.devcontainer/devcontainer.json);
PRE_COMMIT_ENABLED=$(jq -r '.customizations.vscode.settings."git.preCommitEnabled"' $WORKSPACE_PATH/.devcontainer/devcontainer.json);
PYTEST_ENABLED=$(jq -r '.customizations.vscode.settings."python.testing.pytestEnabled"' $WORKSPACE_PATH/.devcontainer/devcontainer.json);
UNITTEST_ENABLED=$(jq -r '.customizations.vscode.settings."python.testing.unittestEnabled"' $WORKSPACE_PATH/.devcontainer/devcontainer.json);
COVERAGE_ENABLED=$(jq -r '.customizations.vscode.settings."python.testing.coverageEnabled"' $WORKSPACE_PATH/.devcontainer/devcontainer.json);
FORMATTER=$(jq -r '.customizations.vscode.settings."editor.defaultFormatter"' $WORKSPACE_PATH/.devcontainer/devcontainer.json);

PIP_EXTRA_INDEX_URL=$(jq -r '.customizations.vscode.settings."python.pip.extraIndexUrl"' $WORKSPACE_PATH/.devcontainer/devcontainer.json);

echo -e "The dependency manager used for the project is ${YELLOW}$DEPENDENCY_MANAGER${ENDCOLOR}."
echo -e "The formatter used for the project is ${YELLOW}$FORMATTER${ENDCOLOR}.\n"

if [ "$PIP_EXTRA_INDEX_URL" = "" ] || [ "$PIP_EXTRA_INDEX_URL" = "null" ]; then
echo -e "No additional package indexes is configured.\n"
else
echo -e "An additional package indexes is specified (value: ${YELLOW}$PIP_EXTRA_INDEX_URL${ENDCOLOR}).\n"
fi

if [ $PRE_COMMIT_ENABLED = "true" ]; then
echo -e "✔️ㅤPre-commit"
else
echo -e "✖️ㅤPre-commit"
fi

if [ $PYTEST_ENABLED = "true" ]; then
echo -e "✔️ㅤPytest"
else
echo -e "✖️ㅤPytest"
fi

if [ $UNITTEST_ENABLED = "true" ]; then
echo -e "✔️ㅤUnittest"
else
echo -e "✖️ㅤUnittest"
fi

if [ $COVERAGE_ENABLED = "true" ]; then
echo -e "✔️ㅤCode coverage"
else
echo -e "✖️ㅤCode coverage"
fi

if [ "$DEPENDENCY_MANAGER" != "pip" ] && [ "$DEPENDENCY_MANAGER" != "poetry" ]; then
echo -e "\n${RED}No correct packaging and dependency manager is configured.${ENDCOLOR}"
echo -e "${RED}Only 'pip' and 'poetry' managers are supported.${ENDCOLOR}"
STOP=true
fi

if [ "$FORMATTER" != "eeyore.yapf" ] && [ "$FORMATTER" != "ms-python.black-formatter" ]; then
echo -e "\n${RED}No correct formatter is configured.${ENDCOLOR}"
echo -e "${RED}Only 'eeyore.yapf' and 'ms-python.black-formatter' formaters are supported.${ENDCOLOR}"
STOP=true
fi

if [ "$STOP" == "true" ]; then
exit 1
fi

echo -e ""
25 changes: 25 additions & 0 deletions .devcontainer/install/02-fix-vscode-settings-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

. "$WORKSPACE_PATH/tools/color.sh"

echo -e "\n${BLUE}#############################################################${ENDCOLOR}"
echo -e "${BLUE}##### #####${ENDCOLOR}"
echo -e "${BLUE}##### Fix VSCode Settings File #####${ENDCOLOR}"
echo -e "${BLUE}##### #####${ENDCOLOR}"
echo -e "${BLUE}#############################################################${ENDCOLOR}"

echo -e "\n${GREEN}> Fix VSCode Settings File.${ENDCOLOR}\n"

jq 'del(.["python.formatting.autopep8Path",
"python.formatting.blackPath",
"python.linting.flake8Path",
"python.linting.flake8Enabled",
"python.linting.mypyPath",
"python.linting.mypyEnabled",
"python.linting.pylintPath",
"python.linting.pylintEnabled"
])' $HOME/.vscode-server/data/Machine/settings.json > /tmp/.vscode-server-settings.json

mv /tmp/.vscode-server-settings.json $HOME/.vscode-server/data/Machine/settings.json

echo -e "File '$HOME/.vscode-server/data/Machine/settings.json' has been modified to fix slow issue with linters.\n"
53 changes: 53 additions & 0 deletions .devcontainer/install/03-generate-file-vscode-extensions-json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

# can-be-removed-after-installation

. "$WORKSPACE_PATH/tools/color.sh"

echo -e "\n${BLUE}#############################################################${ENDCOLOR}"
echo -e "${BLUE}##### #####${ENDCOLOR}"
echo -e "${BLUE}##### Generate .vscode/extensions.json file #####${ENDCOLOR}"
echo -e "${BLUE}##### #####${ENDCOLOR}"
echo -e "${BLUE}#############################################################${ENDCOLOR}"

mkdir -p $SOURCE_PATH
mkdir "$WORKSPACE_PATH/.vscode"

if [ -f "$WORKSPACE_PATH/.vscode/extensions.json" ]; then
echo -e "\n${YELLOW}Nothing to do because file is already existing.\n${ENDCOLOR}"
else

echo -e "\n${GREEN}> Generate file '.vscode/extensions.json'.${ENDCOLOR}\n"

# Create initial file.
merged_content=$(echo '{"recommendations": []}' | jq '.')

# Add extensions specifically for the container type.
CONTAINER_TYPE=$(jq -r '.customizations.vscode.settings."container.type"' $WORKSPACE_PATH/.devcontainer/devcontainer.json);

if [ -f "$WORKSPACE_PATH/.devcontainer/templates/${CONTAINER_TYPE}/config/extensions.json" ]; then
content=$(cat $WORKSPACE_PATH/.devcontainer/templates/${CONTAINER_TYPE}/config/extensions.json)
merged_content=$(echo "$merged_content" | jq ".recommendations += $content")
fi

# Add extensions specifically for the default formatter.
defaultFormatter=$(jq -r '.customizations.vscode.settings."editor.defaultFormatter"' $WORKSPACE_PATH/.devcontainer/devcontainer.json);

if [ "$defaultFormatter" == "ms-python.autopep8" ] || [ "$defaultFormatter" == "ms-python.black-formatter" ] || [ "$defaultFormatter" == "eeyore.yapf" ]; then
content="[\"$defaultFormatter\"]"
merged_content=$(echo "$merged_content" | jq ".recommendations += $content")
fi

# Add other extensions.
if [ -f "$WORKSPACE_PATH/.devcontainer/templates/default/config/extensions.json" ]; then
content=$(cat $WORKSPACE_PATH/.devcontainer/templates/default/config/extensions.json)
merged_content=$(echo "$merged_content" | jq ".recommendations += $content")
fi

# Pretty-print the content and create the file.
formatted_content=$(echo $merged_content | jq -c '.')
echo $formatted_content | python -m json.tool --indent=2 > "$WORKSPACE_PATH/.vscode/extensions.json"

echo -e "Done.\n"

fi
Loading