Skip to content

Commit 48be8f8

Browse files
author
Peter Schwips
committed
build: added hatchling as the build system and changed the repo structure accordingly
1 parent 91a9d97 commit 48be8f8

21 files changed

Lines changed: 79 additions & 47 deletions

main.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
from utils.filehandler import file_setup
2-
from utils.screens import DatasphereApp
1+
from sap_datasphere_automation.cli import main
32

4-
# Create all files
5-
# Must be executed first
6-
file_setup()
7-
8-
# Start app
9-
app = DatasphereApp()
10-
app.run(mouse=False)
3+
main()

pyproject.toml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
1+
# ----- Build System -----
2+
3+
[build-system]
4+
requires = ["hatchling"]
5+
build-backend = "hatchling.build"
6+
17
# ----- Project Info -----
28

39
[project]
410
name = "sap-datasphere-automation"
511
version = "0.2.0"
6-
description = "SAP Datasphere Automation"
12+
description = "Unofficial TUI for automating recurring tasks in SAP Datasphere"
713
authors = [
8-
{ name = "Peter Schwips" }
14+
{ name = "Peter Schwips", email = "peter.schwips@web.de" }
915
]
1016
readme = "README.md"
17+
license = { file = "LICENSE.txt" }
1118
requires-python = ">=3.12,<3.14"
19+
classifiers = [
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
23+
"Operating System :: OS Independent",
24+
]
1225
dependencies = [
1326
"beautifulsoup4>=4.13.4,<5.0.0",
1427
"python-dateutil>=2.9.0.post0,<3.0.0",
@@ -20,6 +33,20 @@ dependencies = [
2033
"textual>=8.2.7",
2134
]
2235

36+
[project.urls]
37+
Homepage = "https://github.com/peterschwps/SAP-Datasphere-Automation"
38+
Repository = "https://github.com/peterschwps/SAP-Datasphere-Automation"
39+
40+
[project.scripts]
41+
sap-datasphere-cli = "sap_datasphere_automation.cli:main"
42+
datasphere-cli = "sap_datasphere_automation.cli:main"
43+
datasphere = "sap_datasphere_automation.cli:main"
44+
45+
# ----- Hatch -----
46+
47+
[tool.hatch.build.targets.wheel]
48+
packages = ["sap_datasphere_automation"]
49+
2350
# ----- Tools -----
2451

2552
[tool.ruff]
@@ -45,4 +72,3 @@ dev = [
4572
"ruff>=0.13.0",
4673
"textual-dev>=1.8.0",
4774
]
48-
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from sap_datasphere_automation.cli import main
2+
3+
main()

sap_datasphere_automation/cli.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def main() -> None:
2+
from sap_datasphere_automation.utils.filehandler import file_setup
3+
from sap_datasphere_automation.utils.screens import DatasphereApp
4+
5+
file_setup()
6+
DatasphereApp().run(mouse=False)

utils/__init__.py renamed to sap_datasphere_automation/datasphere/__init__.py

File renamed without changes.

datasphere/analytical_models.py renamed to sap_datasphere_automation/datasphere/analytical_models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
import httpx
1010

11-
from datasphere.automation import DatasphereAutomation
12-
from datasphere.views import Views
13-
from utils.filehandler import ALL_FILES, settings
14-
from utils.logging import logger
15-
from utils.types import AnalyticalModelsDetailsDict
11+
from sap_datasphere_automation.datasphere.automation import DatasphereAutomation
12+
from sap_datasphere_automation.datasphere.views import Views
13+
from sap_datasphere_automation.utils.filehandler import ALL_FILES, settings
14+
from sap_datasphere_automation.utils.logging import logger
15+
from sap_datasphere_automation.utils.types import AnalyticalModelsDetailsDict
1616

1717
# Important URLs from settings
1818
DATASPHERE_URL: str = settings["Setup"]["DATASPHERE_URL"]

datasphere/automation.py renamed to sap_datasphere_automation/datasphere/automation.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212
import httpx
1313
from playwright.async_api import async_playwright
1414

15-
from utils.filehandler import DATA_DIR, SESSION_FILE, settings
16-
from utils.logging import logger
15+
from sap_datasphere_automation.utils.filehandler import (
16+
DATA_DIR,
17+
SESSION_FILE,
18+
settings,
19+
)
20+
from sap_datasphere_automation.utils.logging import logger
1721

1822
REDIRECT_URI: str = "http://localhost:8080"
1923

@@ -117,16 +121,16 @@ async def initialize_datasphere_session(self) -> httpx.AsyncClient:
117121
await self._start_authentication()
118122
return self.session
119123

120-
124+
121125
async def _start_authentication(self):
122126

123127
class ReusableServer(socketserver.TCPServer):
124128
allow_reuse_address = True # to allow immediate reuse of the port
125129

126-
# Mutable container to store the callback code and access it from
130+
# Mutable container to store the callback code and access it from
127131
# different threads
128132
callback: dict[str, str | None] = {"code": None}
129-
133+
130134
# Async handling of the callback server using an event to signal when
131135
# the code is received
132136
loop = asyncio.get_running_loop()
@@ -150,7 +154,7 @@ def callback_server(port=8080):
150154
class Handler(http.server.BaseHTTPRequestHandler):
151155
def do_GET(self):
152156
"""
153-
Checks the query params of an incoming GET-request for a
157+
Checks the query params of an incoming GET-request for a
154158
'code' parameter. Assigns the value to the 'code' key in
155159
the callback dict amd displays a short confirmation in the
156160
browser.

datasphere/remote_tables.py renamed to sap_datasphere_automation/datasphere/remote_tables.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import httpx
44
from dateutil import tz
55

6-
from datasphere.automation import DatasphereAutomation
7-
from utils.filehandler import settings
8-
from utils.logging import logger
9-
from utils.types import (
6+
from sap_datasphere_automation.datasphere.automation import DatasphereAutomation
7+
from sap_datasphere_automation.utils.filehandler import settings
8+
from sap_datasphere_automation.utils.logging import logger
9+
from sap_datasphere_automation.utils.types import (
1010
StatisticsDict,
1111
StatisticsInformationDict,
1212
StatisticsType,

datasphere/task_chains.py renamed to sap_datasphere_automation/datasphere/task_chains.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import httpx
66
import pandas as pd
77

8-
from datasphere.automation import DatasphereAutomation
9-
from utils.filehandler import ALL_FILES, settings
10-
from utils.logging import logger
8+
from sap_datasphere_automation.datasphere.automation import DatasphereAutomation
9+
from sap_datasphere_automation.utils.filehandler import ALL_FILES, settings
10+
from sap_datasphere_automation.utils.logging import logger
1111

1212
# Important URLs from settings
1313
DATASPHERE_URL: str = settings["Setup"]["DATASPHERE_URL"]

0 commit comments

Comments
 (0)