diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..d1b5c0b --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,14 @@ +ARG VARIANT=3-bullseye +FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} + +RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel + +# Install craftbeerpi requirements for better caching +COPY ./requirements.txt /workspace/requirements.txt +RUN pip3 install --no-cache-dir -r /workspace/requirements.txt + +# Install current version of cbpi-ui +RUN mkdir /opt/downloads \ + && curl https://github.com/avollkopf/craftbeerpi4-ui/archive/main.zip -L -o /opt/downloads/cbpi-ui.zip \ + && pip3 install --no-cache-dir /opt/downloads/cbpi-ui.zip \ + && rm -rf /opt/downloads \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..9490202 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,48 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "CraftBeerPi4 Development Container", + + // Update the 'dockerComposeFile' list if you have more compose files or use different names. + // The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. + "dockerComposeFile": [ + "docker-compose.dev.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "craftbeerpi4-development", + + // The optional 'workspaceFolder' property is the path VS Code should open by default when + // connected. This is typically a file mount in .devcontainer/docker-compose.yml + "workspaceFolder": "/workspace", + + // Set *default* container specific settings.json values on container create. + "settings": { + //"terminal.integrated.shell.linux": null + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python", + "ms-azuretools.vscode-docker", + "editorconfig.editorconfig", + "eamodio.gitlens" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [80], + + // Uncomment the next line if you want start specific services in your Docker Compose config. + // "runServices": [], + + // Uncomment the next line if you want to keep your containers running after VS Code shuts down. + "shutdownAction": "stopCompose", + + // Uncomment the next line to run commands after the container is created - for example installing curl. + //"postCreateCommand": "pip3 install -r ./requirements.txt", + + // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} diff --git a/.devcontainer/docker-compose.dev.yml b/.devcontainer/docker-compose.dev.yml new file mode 100644 index 0000000..fa0ca39 --- /dev/null +++ b/.devcontainer/docker-compose.dev.yml @@ -0,0 +1,30 @@ +version: '3.4' +services: + mqtt: + image: eclipse-mosquitto:2 + volumes: + - "./mosquitto/config:/mosquitto/config" + restart: unless-stopped + + craftbeerpi4-development: + build: + context: ../ + dockerfile: .devcontainer/Dockerfile + command: /bin/sh -c "while sleep 1000; do :; done" + user: vscode + depends_on: + - mqtt + volumes: + # Update this to wherever you want VS Code to mount the folder of your project + - ../:/workspace:cached + + mqtt-explorer: + image: smeagolworms4/mqtt-explorer + environment: + HTTP_PORT: 4000 + CONFIG_PATH: /mqtt-explorer/config + volumes: + - "./mqtt-explorer/config:/mqtt-explorer/config" + depends_on: + - mqtt + restart: unless-stopped diff --git a/.gitignore b/.gitignore index c9519c8..cd36875 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,5 @@ node_modules .vscode .venv* .DS_Store -.vscode/ config/* logs/ \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..c2f9637 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Verwendet IntelliSense zum Ermitteln möglicher Attribute. + // Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen. + // Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "name": "Run CraftBeerPi4", + "type": "python", + "request": "launch", + "module": "run", + "args": ["--config-folder-path=./.devcontainer/cbpi-dev-config", "start"] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7ec7342 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "python.pythonPath": "/bin/python3", + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true +} \ No newline at end of file diff --git a/README.md b/README.md index 9e47003..5dfc777 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,19 @@ in the documentation, that can be found here: [gitbook.io](https://openbrewing.g Plugins extend the base functionality of CraftBeerPi 4. You can find a list of available plugins [here](https://openbrewing.gitbook.io/craftbeerpi4_support/master/plugin-installation#plugin-list). -## 🧑‍🤝‍🧑 Contributers +## 🧑‍🤝‍🧑 Contribute +You want to help develop CraftBeerPi4? To get you quickly stated, this repository comes with a preconfigured +development environment. To be able to use this environment you need 2 things installed on your computer: + +- docker +- visual studio code (vscode) + +To start developing clone this repository, open the folder in vscode and use the _development container_ feature. The command is called _Reopen in container_. Please note that this quick start setup does not work if you want to develop directly on a 32bit raspberry pi os because docker is only available for 64bit arm plattform. Please use the regular development setup for that. + +For a more detailed description of a development setup without the _development container_ feature see the documentation page: +[gitbook.io](https://openbrewing.gitbook.io/craftbeerpi4_support/) + +### Contributors Thanks to all the people who have contributed [![contributors](https://contributors-img.web.app/image?repo=craftbeerpi/craftbeerpi4)](https://github.com/craftbeerpi/craftbeerpi4/graphs/contributors) diff --git a/requirements.txt b/requirements.txt index ca5da1d..088cdc4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,4 +21,6 @@ asyncio-mqtt psutil==5.9.0 zipp>=0.5 PyInquirer==1.0.3 -colorama==0.4.4 \ No newline at end of file +colorama==0.4.4 +pytest-aiohttp +coverage==6.3.1