build using requirements.txt; improve README; fix: exclude pycache;

This commit is contained in:
Daniel Langbein 2020-12-03 16:30:29 +01:00
parent 04c29d21e5
commit 8a652852a9
5 changed files with 40 additions and 19 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
/secret/*.txt
/data/*.xml
/src/__pycache__/
/plot/*.png
__pycache__/

6
.idea/other.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PySciProjectComponent">
<option name="PY_SCI_VIEW_SUGGESTED" value="true" />
</component>
</project>

View File

@ -2,6 +2,10 @@ FROM python:3.8-alpine
WORKDIR /usr/src/
# setting the correct timezone requires "zdtata"
# numpy (dependency of matplotlib) requires "make automake gcc ..."
# source: https://stackoverflow.com/a/48349161/6334421
# pillow (dependency of matplotlib) requires "zlib-dev jpeg-dev ..."
RUN apk update && \
apk add \
tzdata \
@ -14,13 +18,7 @@ RUN apk update && \
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# TODO
#COPY requirements.txt ./
#RUN pip3 install --no-cache-dir -r requirements.txt
# numpy (dependency of matplotlib)
# requires "make automake gcc ..."
# source: https://stackoverflow.com/a/48349161/6334421
RUN python3 -m pip install --no-cache-dir --upgrade pip
# LDFLAGS required for "pip install pillow"
# otherwise this would be necessary:
@ -29,15 +27,19 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# source: https://github.com/python-pillow/Pillow/issues/3103#issuecomment-382634946
ENV LDFLAGS=-L/usr/lib/x86_64-linux-gnu/
RUN python3 -m pip install --no-cache-dir --upgrade pip
RUN python3 -m pip install --no-cache-dir --upgrade requests
RUN python3 -m pip install --no-cache-dir --upgrade setuptools
RUN python3 -m pip install --no-cache-dir --upgrade numpy
RUN python3 -m pip install --no-cache-dir --upgrade pillow
RUN python3 -m pip install --no-cache-dir --upgrade matplotlib
COPY requirements.txt ./
RUN python3 -m pip install --no-cache-dir --upgrade -r requirements.txt
#
# if the above fails, try using the below instead
#
#RUN python3 -m pip install --no-cache-dir --upgrade requests
#RUN python3 -m pip install --no-cache-dir --upgrade setuptools
#RUN python3 -m pip install --no-cache-dir --upgrade numpy
#RUN python3 -m pip install --no-cache-dir --upgrade pillow
#RUN python3 -m pip install --no-cache-dir --upgrade matplotlib
COPY ./src/ ./
RUN chmod +x ./langfingaz/main.py
COPY src/ ./
RUN chmod +x langfingaz/main.py
# unbuffered output option otherwise script sleeps before any output appears
# python -u

View File

@ -16,7 +16,14 @@ Save these two values in the first line of the following files:
## run
Start logging in the background:
```shell
docker-compose up -d
```
docker-compose build
docker-compose up
Generate a new plot with the saved data:
```shell
sudo docker-compose run bbb-status plot
```

View File

@ -40,7 +40,12 @@ def doPlotMeetings(bbbStati: List[BbbStatus]) -> Path:
voices.append(bbbStatus.voiceParticipantCount)
# Note that even in the OO-style, we use `.pyplot.figure` to create the figure.
fig, ax = plt.subplots() # Create a figure and an axes.
_a, _b = plt.subplots() # Create a figure and an axes.
fig: plt.Figure = _a
ax = _b # of type plt.axes.Axes ??
if not (issubclass(type(fig), plt.Figure)):
raise ValueError("expected Figure")
ax.plot(time, participants, label='participants') # Plot some data on the axes.
ax.plot(time, videos, label='video') # Plot more data on the axes...
ax.plot(time, voices, label='voice') # ... and some more.