From c21a5120f4fc0fc99982cd04510a75c15a4ea461 Mon Sep 17 00:00:00 2001 From: osoken Date: Thu, 30 May 2024 19:59:02 +0900 Subject: [PATCH] fix(etl): Update package structure for Python packages --- etl/pyproject.toml | 3 +++ etl/src/{ => birdxplorer_etl}/__init__.py | 0 etl/src/{ => birdxplorer_etl}/extract.py | 0 etl/src/{ => birdxplorer_etl}/load.py | 0 etl/src/{ => birdxplorer_etl}/main.py | 0 etl/src/{ => birdxplorer_etl}/py.typed | 0 etl/src/{ => birdxplorer_etl}/settings.py | 0 etl/src/{ => birdxplorer_etl}/transform.py | 0 etl/src/lib/sqlite/init.py | 17 ----------------- 9 files changed, 3 insertions(+), 17 deletions(-) rename etl/src/{ => birdxplorer_etl}/__init__.py (100%) rename etl/src/{ => birdxplorer_etl}/extract.py (100%) rename etl/src/{ => birdxplorer_etl}/load.py (100%) rename etl/src/{ => birdxplorer_etl}/main.py (100%) rename etl/src/{ => birdxplorer_etl}/py.typed (100%) rename etl/src/{ => birdxplorer_etl}/settings.py (100%) rename etl/src/{ => birdxplorer_etl}/transform.py (100%) delete mode 100644 etl/src/lib/sqlite/init.py diff --git a/etl/pyproject.toml b/etl/pyproject.toml index b6a97af..09c847d 100644 --- a/etl/pyproject.toml +++ b/etl/pyproject.toml @@ -26,6 +26,9 @@ Source = "https://github.com/codeforjapan/BirdXplorer" [tool.setuptools.package-data] birdxplorer = ["py.typed"] +[tool.setuptools] +package-dir = {"" = "src"} + [project.optional-dependencies] dev=[ "black", diff --git a/etl/src/__init__.py b/etl/src/birdxplorer_etl/__init__.py similarity index 100% rename from etl/src/__init__.py rename to etl/src/birdxplorer_etl/__init__.py diff --git a/etl/src/extract.py b/etl/src/birdxplorer_etl/extract.py similarity index 100% rename from etl/src/extract.py rename to etl/src/birdxplorer_etl/extract.py diff --git a/etl/src/load.py b/etl/src/birdxplorer_etl/load.py similarity index 100% rename from etl/src/load.py rename to etl/src/birdxplorer_etl/load.py diff --git a/etl/src/main.py b/etl/src/birdxplorer_etl/main.py similarity index 100% rename from etl/src/main.py rename to etl/src/birdxplorer_etl/main.py diff --git a/etl/src/py.typed b/etl/src/birdxplorer_etl/py.typed similarity index 100% rename from etl/src/py.typed rename to etl/src/birdxplorer_etl/py.typed diff --git a/etl/src/settings.py b/etl/src/birdxplorer_etl/settings.py similarity index 100% rename from etl/src/settings.py rename to etl/src/birdxplorer_etl/settings.py diff --git a/etl/src/transform.py b/etl/src/birdxplorer_etl/transform.py similarity index 100% rename from etl/src/transform.py rename to etl/src/birdxplorer_etl/transform.py diff --git a/etl/src/lib/sqlite/init.py b/etl/src/lib/sqlite/init.py deleted file mode 100644 index 599f351..0000000 --- a/etl/src/lib/sqlite/init.py +++ /dev/null @@ -1,17 +0,0 @@ -# Create Note table for sqlite with columns: id, title, content, created_at, updated_at by sqlalchemy -from sqlalchemy import create_engine -from sqlalchemy.orm import sessionmaker -import os -from prefect import get_run_logger -from birdxplorer_common.storage import Row - -def init_db(): - logger = get_run_logger() - - db_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'data', 'note.db')) - logger.info(f'Initializing database at {db_path}') - engine = create_engine('sqlite:///' + db_path) - Base.metadata.create_all(engine) - Session = sessionmaker(bind=engine) - - return Session()