Skip to content

Commit

Permalink
1.0.0 (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemanspiff2007 authored Jul 25, 2022
1 parent a123fbf commit 005fd47
Show file tree
Hide file tree
Showing 337 changed files with 7,068 additions and 3,810 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
- uses: actions/checkout@v2
with:
ref: master
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9

- name: Install setuptools
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v1
Expand Down
43 changes: 39 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
.mypy_cache
.idea
__pycache__
/conf
/conf_testing
/build

# HABApp configurations
run/*/log/
run/*/config/*.items

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
/lib/
/lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
hooks:
- id: check-yaml
- id: end-of-file-fixer
exclude: ^_doc/(?:images|gifs)
exclude: ^docs/(?:images|gifs)
- id: trailing-whitespace

# - repo: https://github.com/pycqa/isort
Expand Down
2 changes: 1 addition & 1 deletion .pyup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pr_prefix: "PyUp"
# default: empty
# allowed: list
requirements:
- _doc/requirements.txt:
- docs/requirements.txt:
update: False
- requirements.txt:
update: True
Expand Down
12 changes: 9 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: _doc/conf.py
configuration: docs/conf.py

# Build documentation with MkDocs
#mkdocs:
Expand All @@ -16,10 +16,16 @@ sphinx:
# Optionally build your docs in additional formats such as PDF and ePub
formats: all

build:
os: ubuntu-20.04
tools:
python: "3.9"
apt_packages:
- graphviz

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
install:
- requirements: _doc/requirements.txt
- requirements: docs/requirements.txt
- method: setuptools
path: .
54 changes: 39 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
FROM python:3.8-alpine
FROM python:3.9-slim as buildimage

VOLUME [ "/config"]
COPY . /tmp/app_install

# Install required dependencies
RUN apk add --no-cache \
# Support for Timezones
tzdata \
# ujson won't compile without these libs
g++
RUN set -eux; \
# wheel all packages for habapp
cd /tmp/app_install; \
pip wheel --wheel-dir=/root/wheels --use-feature=in-tree-build .

FROM python:3.9-slim

COPY --from=buildimage /root/wheels /root/wheels
COPY container/entrypoint.sh /entrypoint.sh

# Always use latest versions
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . .
ENV HABAPP_HOME=/habapp \
USER_ID=9001 \
GROUP_ID=${USER_ID}

RUN set -eux; \
# Install required dependencies
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
gosu \
tini; \
ln -s -f $(which gosu) /usr/local/bin/gosu; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*; \
mkdir -p ${HABAPP_HOME}; \
mkdir -p ${HABAPP_HOME}/config; \
# install HABApp
pip3 install \
--no-index \
--find-links=/root/wheels \
habapp; \
# prepare entrypoint script
chmod +x /entrypoint.sh; \
# clean up
rm -rf /root/wheels

# Install
RUN pip3 install .
WORKDIR ${HABAPP_HOME}
VOLUME ["${HABAPP_HOME}/config"]
ENTRYPOINT ["/entrypoint.sh"]

CMD [ "python", "-m", "HABApp", "--config", "/config" ]
CMD ["gosu", "habapp", "tini", "--", "python", "-m", "HABApp", "--config", "./config"]
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include LICENSE
include requirements_setup.txt
25 changes: 0 additions & 25 deletions _doc/_static/theme_overrides.css

This file was deleted.

1 change: 0 additions & 1 deletion _doc/images/folders.drawio

This file was deleted.

Binary file removed _doc/images/folders.png
Binary file not shown.
5 changes: 0 additions & 5 deletions _doc/requirements.txt

This file was deleted.

25 changes: 25 additions & 0 deletions container/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash -x

set -euo pipefail

NEW_USER_ID=${USER_ID}
NEW_GROUP_ID=${GROUP_ID:-$NEW_USER_ID}

echo "Starting with habapp user id: $NEW_USER_ID and group id: $NEW_GROUP_ID"
if ! id -u habapp >/dev/null 2>&1; then
if [ -z "$(getent group $NEW_GROUP_ID)" ]; then
echo "Create group habapp with id ${NEW_GROUP_ID}"
groupadd -g $NEW_GROUP_ID habapp
else
group_name=$(getent group $NEW_GROUP_ID | cut -d: -f1)
echo "Rename group $group_name to habapp"
groupmod --new-name habapp $group_name
fi
echo "Create user habapp with id ${NEW_USER_ID}"
adduser -u $NEW_USER_ID --disabled-password --gecos '' --home "${HABAPP_HOME}" --gid ${NEW_GROUP_ID} habapp
fi

chown -R habapp:habapp "${HABAPP_HOME}/config"
sync

exec "$@"
File renamed without changes.
28 changes: 28 additions & 0 deletions docs/_static/theme_changes.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* https://stackoverflow.com/questions/23211695/modifying-content-width-of-the-sphinx-theme-read-the-docs
and https://github.com/readthedocs/sphinx_rtd_theme/issues/295
*/
@media screen and (min-width: 767px) {
.wy-nav-content {
max-width: 1100px !important;
}

/* and fix wrap bug per https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html */
.wy-table-responsive table td {
/* !important prevents the common CSS stylesheets from overriding
this as on RTD they are loaded after this stylesheet */
white-space: normal !important;
}

.wy-table-responsive {
overflow: visible !important;
}
}

h1 { font-size: 200% }
h2 { font-size: 180% }
h3 { font-size: 160% }
h4 { font-size: 140% }
h5 { font-size: 120% }
h6 { font-size: 100% }
10 changes: 5 additions & 5 deletions _doc/about_habapp.rst → docs/about_habapp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ HABApp folder structure

Integration with openHAB
------------------------------
HABApp connects to the openhab event stream and automatically updates the local openhab items when an item in openhab changes.
HABApp connects to the openHAB event stream and automatically updates the local openHAB items when an item in openHAB changes.
These item values are cached, so accessing and working with items in rules is very fast.
The events from openhab are also mirrored to the internal event bus which means that triggering on these
The events from openHAB are also mirrored to the internal event bus which means that triggering on these
events is also possible.

When HABApp connects to openhab for the first time it will load all items/things from the openhab instance and create local items.
The name of the local openhab items is equal to the name in openhab.
When HABApp connects to openHAB for the first time it will load all items/things from the openHAB instance and create local items.
The name of the local openHAB items is equal to the name in openHAB.

Posting updates, sending commands or any other openhab interface call will issue a corresponding REST-API call to change openhab.
Posting updates, sending commands or any other openHAB interface call will issue a corresponding REST-API call to change openHAB.

Integration with MQTT
------------------------------
Expand Down
Loading

0 comments on commit 005fd47

Please sign in to comment.