pam-python 0.1.23__tar.gz → 0.1.24__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {pam_python-0.1.23/pam_python.egg-info → pam_python-0.1.24}/PKG-INFO +1 -1
  2. {pam_python-0.1.23 → pam_python-0.1.24}/pam/templates/docker/Dockerfile +1 -1
  3. pam_python-0.1.24/pam/templates/init/run_test.sh +7 -0
  4. {pam_python-0.1.23 → pam_python-0.1.24}/pam/templates/service/service.test.tmpl +12 -1
  5. {pam_python-0.1.23 → pam_python-0.1.24}/pam/templates/service/service_class.tmpl +10 -1
  6. {pam_python-0.1.23 → pam_python-0.1.24/pam_python.egg-info}/PKG-INFO +1 -1
  7. {pam_python-0.1.23 → pam_python-0.1.24}/setup.py +8 -8
  8. pam_python-0.1.23/pam/templates/init/run_test.sh +0 -1
  9. {pam_python-0.1.23 → pam_python-0.1.24}/LICENSE.txt +0 -0
  10. {pam_python-0.1.23 → pam_python-0.1.24}/README.md +0 -0
  11. {pam_python-0.1.23 → pam_python-0.1.24}/pam/__init__.py +0 -0
  12. {pam_python-0.1.23 → pam_python-0.1.24}/pam/api.py +0 -0
  13. {pam_python-0.1.23 → pam_python-0.1.24}/pam/cli.py +0 -0
  14. {pam_python-0.1.23 → pam_python-0.1.24}/pam/interface_task_manager.py +0 -0
  15. {pam_python-0.1.23 → pam_python-0.1.24}/pam/models/__init__.py +0 -0
  16. {pam_python-0.1.23 → pam_python-0.1.24}/pam/models/request_command.py +0 -0
  17. {pam_python-0.1.23 → pam_python-0.1.24}/pam/server.py +0 -0
  18. {pam_python-0.1.23 → pam_python-0.1.24}/pam/service.py +0 -0
  19. {pam_python-0.1.23 → pam_python-0.1.24}/pam/sqlite.py +0 -0
  20. {pam_python-0.1.23 → pam_python-0.1.24}/pam/task_manager.py +0 -0
  21. {pam_python-0.1.23 → pam_python-0.1.24}/pam/temp_file_utils.py +0 -0
  22. {pam_python-0.1.23 → pam_python-0.1.24}/pam/templates/buildcmd/pamb +0 -0
  23. {pam_python-0.1.23 → pam_python-0.1.24}/pam/templates/buildcmd/pamb-base.sh +0 -0
  24. {pam_python-0.1.23 → pam_python-0.1.24}/pam/templates/init/dockerignore.tmpl +0 -0
  25. {pam_python-0.1.23 → pam_python-0.1.24}/pam/templates/init/gitignore.tmpl +0 -0
  26. {pam_python-0.1.23 → pam_python-0.1.24}/pam/templates/init/main.tmpl +0 -0
  27. {pam_python-0.1.23 → pam_python-0.1.24}/pam/templates/init/pylintrc.tmpl +0 -0
  28. {pam_python-0.1.23 → pam_python-0.1.24}/pam/templates/service/functions.tmpl +0 -0
  29. {pam_python-0.1.23 → pam_python-0.1.24}/pam/templates/service/service.yaml +0 -0
  30. {pam_python-0.1.23 → pam_python-0.1.24}/pam/tester_task.py +0 -0
  31. {pam_python-0.1.23 → pam_python-0.1.24}/pam/utils.py +0 -0
  32. {pam_python-0.1.23 → pam_python-0.1.24}/pam_python.egg-info/SOURCES.txt +0 -0
  33. {pam_python-0.1.23 → pam_python-0.1.24}/pam_python.egg-info/dependency_links.txt +0 -0
  34. {pam_python-0.1.23 → pam_python-0.1.24}/pam_python.egg-info/entry_points.txt +0 -0
  35. {pam_python-0.1.23 → pam_python-0.1.24}/pam_python.egg-info/requires.txt +0 -0
  36. {pam_python-0.1.23 → pam_python-0.1.24}/pam_python.egg-info/top_level.txt +0 -0
  37. {pam_python-0.1.23 → pam_python-0.1.24}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pam-python
3
- Version: 0.1.23
3
+ Version: 0.1.24
4
4
  Summary: Pam Python Library
5
5
  Home-page: https://github.com/heart/pam-python
6
6
  Author: Narongrit Kanhanoi
@@ -1,4 +1,4 @@
1
- FROM python:3.12-slim
1
+ FROM python:3.13-alpine
2
2
 
3
3
  COPY . /app
4
4
 
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ if [ -n "$1" ]; then
4
+ python -m unittest discover -s "$1" -p "test_*.py"
5
+ else
6
+ python -m unittest discover
7
+ fi
@@ -9,7 +9,7 @@ from pam.tester_task import TesterTask
9
9
  from pam.models.request_command import RequestCommand
10
10
  from pam.temp_file_utils import TempfileUtils
11
11
  #pylint: disable=import-error
12
- from .#CLASS_NAME# import #CLASS_NAME#
12
+ from #MODULE_NAME#.#CLASS_NAME# import #CLASS_NAME#
13
13
 
14
14
 
15
15
  # ==================== GLOBAL VARIABLES ====================
@@ -50,6 +50,13 @@ def on_request_data(page) -> Tuple[List[str], bool, str]:
50
50
  mock_csv = f"{MOCK_DIR}/mock_data_{page}.csv"
51
51
  return [mock_csv], is_end, next_page
52
52
 
53
+ def on_request_sqlite():
54
+ sqlite_path = f"{MOCK_DIR}/sqlite_path.sqlite"
55
+ return sqlite_path
56
+
57
+
58
+ def on_upload_sqlite(sqlite_path):
59
+ print(f"Upload SQLite {sqlite_path}")
53
60
 
54
61
  def on_upload_report(report_file):
55
62
  print(f"Uploaded Report {report_file}")
@@ -77,6 +84,8 @@ class Test#CLASS_NAME#(unittest.TestCase):
77
84
  self.testerTask.set_on_upload_result(on_upload_result)
78
85
  self.testerTask.set_on_request_data(on_request_data)
79
86
  self.testerTask.set_on_upload_report(on_upload_report)
87
+ self.testerTask.set_on_upload_sqlite(on_upload_sqlite)
88
+ self.testerTask.set_on_request_sqlite(on_request_sqlite)
80
89
 
81
90
  def test_run_service(self):
82
91
  #---- Create Request Command
@@ -88,6 +97,8 @@ class Test#CLASS_NAME#(unittest.TestCase):
88
97
  RESPONSE_API="https://localhost.test/api/dataadapter/test"
89
98
 
90
99
  req = RequestCommand(
100
+ sqlite_download="",
101
+ sqlite_upload="",
91
102
  runtime_parameters=runtime_parameters,
92
103
  token=token,
93
104
  cmd="start",
@@ -1,8 +1,9 @@
1
+ import threading
1
2
  from pam.service import Service
2
3
  from pam.models.request_command import RequestCommand
3
4
  from pam.utils import log
4
5
  #pylint: disable=import-error
5
- from .functions import create_report, load_csv_file
6
+ from #MODULE_NAME#.functions import create_report, load_csv_file
6
7
 
7
8
  class #CLASS_NAME#(Service):
8
9
 
@@ -22,6 +23,14 @@ class #CLASS_NAME#(Service):
22
23
  def on_data_input(self, req: RequestCommand):
23
24
  log(f"on_data_input req.is_end = {req.is_end}")
24
25
 
26
+ #RUN IN A SEPERATED THREAD TO PREVENT HTTP REQUEST BLOCKING
27
+ thread = threading.Thread(
28
+ target=lambda: self.__run_process_data_in_thread(req),
29
+ daemon=True,
30
+ )
31
+ thread.start()
32
+
33
+ def __run_process_data_in_thread(self, req: RequestCommand):
25
34
  dataframe = self.__process_data(req.input_files)
26
35
  self._upload_result(dataframe)
27
36
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pam-python
3
- Version: 0.1.23
3
+ Version: 0.1.24
4
4
  Summary: Pam Python Library
5
5
  Home-page: https://github.com/heart/pam-python
6
6
  Author: Narongrit Kanhanoi
@@ -1,27 +1,27 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
- name="pam-python",
5
- version="0.1.23",
4
+ name="pam-python",
5
+ version="0.1.24",
6
6
  author="Narongrit Kanhanoi",
7
7
  author_email="narongrit@pams.ai",
8
8
  description="Pam Python Library",
9
9
  long_description=open("README.md", encoding='utf-8').read(),
10
10
  long_description_content_type="text/markdown",
11
- url="https://github.com/heart/pam-python",
12
- packages=find_packages(),
11
+ url="https://github.com/heart/pam-python",
12
+ packages=find_packages(),
13
13
  classifiers=[
14
14
  "Programming Language :: Python :: 3",
15
15
  "Programming Language :: Python :: 3.8",
16
16
  "Programming Language :: Python :: 3.9",
17
- "License :: Other/Proprietary License",
17
+ "License :: Other/Proprietary License",
18
18
  "Operating System :: OS Independent",
19
19
  "Intended Audience :: Developers",
20
20
  "Intended Audience :: Customer Service",
21
21
  "Topic :: Software Development :: Libraries",
22
22
  ],
23
23
  package_data={
24
- "pam": ["templates/**/*"],
24
+ "pam": ["templates/**/*"],
25
25
  },
26
26
  install_requires=[
27
27
  "setuptools>=70.0.0",
@@ -37,8 +37,8 @@ setup(
37
37
  ],
38
38
  entry_points={
39
39
  "console_scripts": [
40
- "pam=pam.cli:main",
40
+ "pam=pam.cli:main",
41
41
  ],
42
42
  },
43
- python_requires=">=3.8",
43
+ python_requires=">=3.8",
44
44
  )
@@ -1 +0,0 @@
1
- python -m unittest discover
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes