diff --git a/code/python/.env b/code/python/.env new file mode 100644 index 0000000..6605cf0 --- /dev/null +++ b/code/python/.env @@ -0,0 +1,4 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Environment variables +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +APPNAME=ads2 diff --git a/code/python/.gitignore b/code/python/.gitignore new file mode 100644 index 0000000..5d86543 --- /dev/null +++ b/code/python/.gitignore @@ -0,0 +1,50 @@ +* +!/.gitignore + +################################################################ +# MAIN FOLDER +################################################################ + +!/.env +!/Makefile +!/README.md +!/LICENSE +!/requirements + +################################################################ +# PROJECT FILES +################################################################ + +!/src +!/src/**/ +!/src/**/*.py + +!/tests +!/tests/**/ +!/tests/**/*.py + +!/assets +!/assets/**/ + +!/dist +!/dist/VERSION + +################################################################ +# AUXLIARY +################################################################ + +/logs + +################################################################ +# ARTEFACTS +################################################################ + +/**/__pycache__ +/**/.DS_Store +/**/__archive__* + +################################################################ +# Git Keep +################################################################ + +!/**/.gitkeep diff --git a/code/python/LICENSE b/code/python/LICENSE new file mode 100644 index 0000000..e69de29 diff --git a/code/python/Makefile b/code/python/Makefile new file mode 100644 index 0000000..e9c4822 --- /dev/null +++ b/code/python/Makefile @@ -0,0 +1,92 @@ +SHELL:=/usr/bin/env bash +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Makefile +# NOTE: Do not change the contents of this file! +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +include .env + +################################ +# VARIABLES +################################ + +ARTEFACT_NAME:=${APPNAME} +PYTHON:=python3 +ifeq ($(OS),Windows_NT) +ARTEFACT_NAME:=${APPNAME}.exe +PYTHON=py -3 +endif + +################################ +# Macros +################################ + +define create_folder_if_not_exists + @if ! [ -d "$(1)" ]; then mkdir "$(1)"; fi +endef + +define create_folder_if_not_exists + @touch "$(1)"; +endef + +define delete_if_file_exists + @if [ -f "$(1)" ]; then rm "$(1)"; fi +endef + +define delete_if_folder_exists + @if [ -d "$(1)" ]; then rm -rf "$(1)"; fi +endef + +define clean_all_files + @find . -type f -name "$(1)" -exec basename {} \; + @find . -type f -name "$(1)" -exec rm {} \; 2> /dev/null +endef + +define clean_all_folders + @find . -type d -name "$(1)" -exec basename {} \; + @find . -type d -name "$(1)" -exec rm -rf {} \; 2> /dev/null +endef + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# TARGETS +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +################################ +# BASIC TARGETS: setup, build, run +################################ +setup: check-system-requirements setup-no-checks +setup-no-checks: + @${PYTHON} -m pip install -r "requirements" +run: + @${PYTHON} src/main.py; +all: setup run +################################ +# TARGETS: testing +################################ +unit-test: unit-tests +unit-tests: + @cd tests && \ + ${PYTHON} -m unittest discover -v \ + --start-directory "." \ + --top-level-directory ".." \ + --pattern "test_*.py" +################################ +# AUXILIARY (INTERNAL TARGETS) +################################ +check-system-requirements: + @if ! ( ${PYTHON} --version >> /dev/null 2> /dev/null ); then \ + echo "Install Python 3.10.x first!"; \ + exit 1; \ + fi + @${PYTHON} --version +################################ +# TARGETS: clean +################################ +clean: + @echo "All system artefacts will be force removed." + @$(call clean_all_files,.DS_Store) + @echo "All build artefacts will be force removed." + @$(call clean_all_folders,__pycache__) + @$(call clean_all_folders,.pytest_cache) + @$(call delete_if_file_exists,dist/${ARTEFACT_NAME}) + @exit 0 diff --git a/code/python/README.md b/code/python/README.md new file mode 100644 index 0000000..3c1e43c --- /dev/null +++ b/code/python/README.md @@ -0,0 +1,3 @@ +# ADS2 - Implementierung in Python # + +(_Noch nicht implementiert_) diff --git a/code/python/dist/VERSION b/code/python/dist/VERSION new file mode 100644 index 0000000..77d6f4c --- /dev/null +++ b/code/python/dist/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/code/python/requirements b/code/python/requirements new file mode 100644 index 0000000..a7fe9bf --- /dev/null +++ b/code/python/requirements @@ -0,0 +1,4 @@ +pip>=22.0.4 +typing>=3.7.4.3 +numpy>=1.22.3 +pandas>=1.4.1 diff --git a/code/python/src/main.py b/code/python/src/main.py new file mode 100644 index 0000000..1804b90 --- /dev/null +++ b/code/python/src/main.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# IMPORTS +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +import os; +import sys; + +os.chdir(os.path.join(os.path.dirname(__file__), '..')); +sys.path.insert(0, os.getcwd()); + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# GLOBAL CONSTANTS/VARIABLES +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# MAIN METHOD +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +def enter(): + print('Hello world!') + return; + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# EXECUTION +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +if __name__ == '__main__': + enter();