From 6a2877ca716df44375fa06cafb1dbad76bc4d3bc Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Thu, 6 Jun 2024 20:58:00 -0500 Subject: [PATCH] reorg and other stuff --- apps/app1/subdir/foo.py | 6 ++++ apps/databases.yaml | 6 +++- apps/hello.py | 36 +++++++++---------- apps/my_repo/pyproject.toml | 4 +++ apps/my_repo/{ => src}/my_pkg/__init__.py | 0 apps/my_repo/{ => src}/my_pkg/foo.py | 0 .../{ => src}/my_pkg/my_sub_pkg/__init__.py | 0 .../{ => src}/my_pkg/my_sub_pkg/bar.py | 0 .../{ => src}/my_pkg/my_sub_pkg/baz.py | 0 apps/requirements.txt | 4 ++- docker-compose.yml | 3 +- 11 files changed, 36 insertions(+), 23 deletions(-) create mode 100644 apps/app1/subdir/foo.py rename apps/my_repo/{ => src}/my_pkg/__init__.py (100%) rename apps/my_repo/{ => src}/my_pkg/foo.py (100%) rename apps/my_repo/{ => src}/my_pkg/my_sub_pkg/__init__.py (100%) rename apps/my_repo/{ => src}/my_pkg/my_sub_pkg/bar.py (100%) rename apps/my_repo/{ => src}/my_pkg/my_sub_pkg/baz.py (100%) diff --git a/apps/app1/subdir/foo.py b/apps/app1/subdir/foo.py new file mode 100644 index 0000000..761206a --- /dev/null +++ b/apps/app1/subdir/foo.py @@ -0,0 +1,6 @@ +from appdaemon.adapi import ADAPI + +class Foo(ADAPI): + def initialize(self): + self.log(f'Initialized from {__file__}') + \ No newline at end of file diff --git a/apps/databases.yaml b/apps/databases.yaml index 3170b8c..7076102 100644 --- a/apps/databases.yaml +++ b/apps/databases.yaml @@ -4,4 +4,8 @@ App1: App2: module: app2.database - class: OtherDatabaseApp \ No newline at end of file + class: OtherDatabaseApp + +App1Foo: + module: app1.subdir.foo + class: Foo diff --git a/apps/hello.py b/apps/hello.py index 2ab2f36..499a7e1 100755 --- a/apps/hello.py +++ b/apps/hello.py @@ -1,27 +1,25 @@ import logging import logging.config -import appdaemon.adbase as ad +from appdaemon.adapi import ADAPI -class HelloWorld(ad.ADBase): +class HelloWorld(ADAPI): def initialize(self): - self.adapi = self.get_ad_api() - self.log = self.adapi.log self.log(f'Initialized app from {__file__}') - logging.config.dictConfig( - { - 'version': 1, - 'disable_existing_loggers': False, - 'formatters': {'basic': {'style': '{', 'format': '{message}'}}, - 'handlers': {'rich': {'()': 'rich.logging.RichHandler'}}, - 'loggers': { - 'AppDaemon._app_management': { - 'level': 'DEBUG', - 'propagate': False, - 'handlers': ['rich'], - } - }, - } - ) + # logging.config.dictConfig( + # { + # 'version': 1, + # 'disable_existing_loggers': False, + # 'formatters': {'basic': {'style': '{', 'format': '{message}'}}, + # 'handlers': {'rich': {'()': 'rich.logging.RichHandler'}}, + # 'loggers': { + # 'AppDaemon._app_management': { + # 'level': 'DEBUG', + # 'propagate': False, + # 'handlers': ['rich'], + # } + # }, + # } + # ) diff --git a/apps/my_repo/pyproject.toml b/apps/my_repo/pyproject.toml index e69de29..006f12f 100644 --- a/apps/my_repo/pyproject.toml +++ b/apps/my_repo/pyproject.toml @@ -0,0 +1,4 @@ +[project] +name = "my_pkg" +description="Config for AppDaemon testing" +version = "0.1.0" \ No newline at end of file diff --git a/apps/my_repo/my_pkg/__init__.py b/apps/my_repo/src/my_pkg/__init__.py similarity index 100% rename from apps/my_repo/my_pkg/__init__.py rename to apps/my_repo/src/my_pkg/__init__.py diff --git a/apps/my_repo/my_pkg/foo.py b/apps/my_repo/src/my_pkg/foo.py similarity index 100% rename from apps/my_repo/my_pkg/foo.py rename to apps/my_repo/src/my_pkg/foo.py diff --git a/apps/my_repo/my_pkg/my_sub_pkg/__init__.py b/apps/my_repo/src/my_pkg/my_sub_pkg/__init__.py similarity index 100% rename from apps/my_repo/my_pkg/my_sub_pkg/__init__.py rename to apps/my_repo/src/my_pkg/my_sub_pkg/__init__.py diff --git a/apps/my_repo/my_pkg/my_sub_pkg/bar.py b/apps/my_repo/src/my_pkg/my_sub_pkg/bar.py similarity index 100% rename from apps/my_repo/my_pkg/my_sub_pkg/bar.py rename to apps/my_repo/src/my_pkg/my_sub_pkg/bar.py diff --git a/apps/my_repo/my_pkg/my_sub_pkg/baz.py b/apps/my_repo/src/my_pkg/my_sub_pkg/baz.py similarity index 100% rename from apps/my_repo/my_pkg/my_sub_pkg/baz.py rename to apps/my_repo/src/my_pkg/my_sub_pkg/baz.py diff --git a/apps/requirements.txt b/apps/requirements.txt index c94be38..bf47204 100644 --- a/apps/requirements.txt +++ b/apps/requirements.txt @@ -1 +1,3 @@ -rich \ No newline at end of file +rich +anyio +pydantic \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 9177129..32ed1e5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,7 @@ -version: '3.9' services: appdaemon: container_name: appdaemon_dev - image: appdaemon:jsl-dev + image: appdaemon:local-dev volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro