From 863f9f03f8e0c0dde66b6e4c0e24594a593fa7a6 Mon Sep 17 00:00:00 2001 From: BerndCzech Date: Wed, 9 Oct 2024 11:44:18 +0200 Subject: [PATCH] wip: allow easy access to contribution --- .dockerignore | 15 --------------- .env | 6 ------ .gitignore | 3 +++ CONTRIBUTING.md | 7 ++++--- Dockerfile | 12 +++++------- Makefile | 25 ++++++++++++++++--------- docker-compose.yaml | 13 ------------- requirements.txt | 1 - 8 files changed, 28 insertions(+), 54 deletions(-) delete mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index bc13daa6..00000000 --- a/.dockerignore +++ /dev/null @@ -1,15 +0,0 @@ -.git/ -.github/ -eos-data/ -mariadb-data/ -test_data/ -.dockerignore -.env -.gitignore -docker-compose.yaml -Dockerfile -LICENSE -Makefile -NOTICE -README.md -.venv diff --git a/.env b/.env index fdbe18fb..55fd2f0e 100644 --- a/.env +++ b/.env @@ -1,10 +1,4 @@ EOS_VERSION=latest EOS_PORT=8503 -MARIADB_VERSION=11.1.6 PYTHON_VERSION=3.12.6 - -MARIADB_ROOT_PASSWORD=ruth -MARIADB_DATABASE=eos -MARIADB_USER=eos -MARIADB_PASSWORD=eos diff --git a/.gitignore b/.gitignore index 5863b08e..6612dd41 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,9 @@ data/ !.vscode/extensions.json !.vscode/*.code-snippets +# dont +.idea + # Local History for Visual Studio Code .history/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e4fbc3d4..0efe630a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,15 +16,16 @@ There are just too many possibilities and the project would drown in tickets oth ## Code Contributions -We welcome code contributions and bug fixes via [Pull Requests](https://github.com/Akkudoktor-EOS/EOS/pulls). -To make collaboration easier, we require pull requests to pass code style and unit tests. +We welcome code contributions and bug fixes via [Pull Requests](https://github.com/Akkudoktor-EOS/EOS/pulls). We use +forks [see](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) +for details. To make collaboration easier, we require pull requests to pass code style and unit tests. ### Code Style Our code style checks use [`pre-commit`](https://pre-commit.com). ```bash -pip install -r requirements.txt +pip install -r requirements.txt requirements-dev.txt ``` To run formatting automatically before every commit: diff --git a/Dockerfile b/Dockerfile index dbbb1d25..02752484 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,19 +7,17 @@ EXPOSE 5000 WORKDIR /opt/eos -COPY . . - -ARG APT_OPTS="--yes --auto-remove --no-install-recommends --no-install-suggests" +COPY src src +COPY pyproject.toml pyproject.toml +COPY requirements.txt requirements.txt RUN DEBIAN_FRONTEND=noninteractive \ apt-get update \ - && apt-get install ${APT_OPTS} gcc libhdf5-dev libmariadb-dev pkg-config mariadb-common libmariadb3 \ && rm -rf /var/lib/apt/lists/* \ && pip install --no-cache-dir -r requirements.txt \ && pip install --no-cache-dir build \ - && pip install --no-cache-dir -e . \ - && apt remove ${APT_OPTS} gcc libhdf5-dev libmariadb-dev pkg-config + && pip install --no-cache-dir -e . ENTRYPOINT [] -CMD ["python", "-m", "akkudoktoreos.flask_server"] +CMD ["python", "-m", "akkudoktoreosserver.flask_server"] diff --git a/Makefile b/Makefile index 82df14b5..7a036528 100644 --- a/Makefile +++ b/Makefile @@ -7,15 +7,16 @@ all: help # Target to display help information help: @echo "Available targets:" - @echo " venv - Set up a Python 3 virtual environment." - @echo " pip - Install dependencies from requirements.txt." - @echo " pip-dev - Install dependencies from requirements-dev.txt." - @echo " install - Install EOS in editable form (development mode) into virtual environment." - @echo " docker-run - Run entire setup on docker - @echo " docs - Generate HTML documentation using pdoc." - @echo " run - Run flask_server in the virtual environment (needs install before)." - @echo " dist - Create distribution (in dist/)." - @echo " clean - Remove generated documentation, distribution and virtual environment." + @echo " venv - Set up a Python 3 virtual environment." + @echo " pip - Install dependencies from requirements.txt." + @echo " pip-dev - Install dependencies from requirements-dev.txt." + @echo " install - Install EOS in editable form (development mode) into virtual environment." + @echo " docker-run - Run entire setup on docker + @echo " docker-rebuild - Run entire setup on docker + @echo " docs - Generate HTML documentation using pdoc." + @echo " run - Run flask_server in the virtual environment (needs install before)." + @echo " dist - Create distribution (in dist/)." + @echo " clean - Remove generated documentation, distribution and virtual environment." # Target to set up a Python 3 virtual environment venv: @@ -69,6 +70,12 @@ test: @echo "Running tests..." .venv/bin/pytest +# Run entire setup on docker +docker-rebuild: + @docker compose down + @docker compose build --no-cache + @docker compose up -d + # Run entire setup on docker docker-run: @docker compose up diff --git a/docker-compose.yaml b/docker-compose.yaml index 34650d40..2b6d215b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,8 +10,6 @@ services: dockerfile: 'Dockerfile' args: PYTHON_VERSION: '${PYTHON_VERSION}' - depends_on: - - 'mariadb' init: true environment: FLASK_RUN_PORT: '${EOS_PORT}' @@ -19,14 +17,3 @@ services: - 'eos' ports: - '${EOS_PORT}:${EOS_PORT}' - mariadb: - image: 'mariadb:${MARIADB_VERSION}-jammy' - environment: - MARIADB_ROOT_PASSWORD: '${MARIADB_ROOT_PASSWORD}' - MARIADB_DATABASE: '${MARIADB_DATABASE}' - MARIADB_USER: '${MARIADB_USER}' - MARIADB_PASSWORD: '${MARIADB_PASSWORD}' - networks: - - 'eos' - volumes: - - ./data/mariadb:/var/lib/mysql diff --git a/requirements.txt b/requirements.txt index dfa8727b..46ef52e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ numpy==2.1.2 -mariadb==1.1.10 matplotlib==3.9.2 flask==3.0.3 scikit-learn==1.5.2