overture-serverless 0.0.0__py3-none-any.whl

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.
File without changes
@@ -0,0 +1,42 @@
1
+ """Lightweight base class for a portable "serverless job" contract.
2
+
3
+ Subclass and implement ``execute_job()``; a runner (container, script, cron
4
+ job, whatever) instantiates the subclass and calls ``run()``.
5
+
6
+ Plain Python by design — no cloud SDKs, no framework dependencies. The same
7
+ subclass runs identically on any backend or on a developer laptop for local
8
+ iteration.
9
+ """
10
+
11
+ import json
12
+ from abc import ABC, abstractmethod
13
+
14
+
15
+ class ServerlessPythonJob(ABC):
16
+ def __init__(self) -> None:
17
+ self._params: dict = {}
18
+
19
+ def run(self, params: "str | dict" = "{}") -> None:
20
+ print(f"Starting job {self.__class__.__name__}")
21
+ self._params = json.loads(params) if isinstance(params, str) else params
22
+ if not isinstance(self._params, dict):
23
+ raise TypeError(
24
+ f"params must decode to a JSON object/dict, got {type(self._params).__name__}"
25
+ )
26
+ print(f"Received params: {sorted(self._params.keys())}")
27
+ self.execute_job()
28
+ print(f"Job {self.__class__.__name__} completed successfully")
29
+
30
+ def get_param(self, name: str, default=None, is_required: bool = True):
31
+ value = self._params.get(name, default)
32
+ if isinstance(value, str):
33
+ value = value.strip() or None
34
+ if is_required and value is None:
35
+ raise ValueError(f"Missing required parameter: {name}")
36
+ return default if value is None else value
37
+
38
+ def log(self, msg: str) -> None:
39
+ print(msg)
40
+
41
+ @abstractmethod
42
+ def execute_job(self) -> None: ...
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: overture-serverless
3
+ Version: 0.0.0
4
+ Summary: Base classes for portable, framework-agnostic serverless Python jobs.
5
+ Author: Overture Maps Foundation
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/OvertureMaps/overture-core
8
+ Project-URL: Source, https://github.com/OvertureMaps/overture-core/tree/main/packages/overture_serverless
9
+ Project-URL: Issues, https://github.com/OvertureMaps/overture-core/issues
10
+ Keywords: overture,overturemaps,serverless,jobs
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest>=9.1.1; extra == "dev"
22
+ Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
23
+ Dynamic: license-file
24
+
25
+ # overture-serverless
26
+
27
+ [![PyPI](https://img.shields.io/pypi/v/overture-serverless.svg)](https://pypi.org/project/overture-serverless/)
28
+ [![Python versions](https://img.shields.io/pypi/pyversions/overture-serverless.svg)](https://pypi.org/project/overture-serverless/)
29
+
30
+ Base class for portable, framework-agnostic "job" classes. A published package that gets installed at run time wherever a job actually executes, and provides the contract your job subclasses.
31
+
32
+ It contains:
33
+ - `ServerlessPythonJob` — abstract base class your jobs subclass (`execute_job()`), with parameter parsing (`get_param()`) and logging (`log()`). Plain Python, no cloud dependencies — runs identically on any backend or on your laptop.
34
+
35
+ ## Writing a job
36
+
37
+ ```python
38
+ from overture_serverless.job import ServerlessPythonJob
39
+
40
+
41
+ class CollectionJob(ServerlessPythonJob):
42
+ def execute_job(self) -> None:
43
+ path = self.get_param("input_path")
44
+ self.log(f"Processing {path}")
45
+ # ... your logic
46
+ ```
47
+
48
+ ## Testing locally
49
+
50
+ ```bash
51
+ cd packages/overture_serverless
52
+ uv run python -c "
53
+ from overture_serverless.job import ServerlessPythonJob
54
+
55
+ class ExampleJob(ServerlessPythonJob):
56
+ def execute_job(self) -> None:
57
+ self.log(self.get_param('input_path'))
58
+
59
+ ExampleJob().run('{\"input_path\": \"s3://...\"}')
60
+ "
61
+ ```
62
+
63
+ ## Publishing
64
+
65
+ See [`PACKAGE_VERSIONING.md`](../PACKAGE_VERSIONING.md) for how a version bump here turns into a PyPI release.
@@ -0,0 +1,7 @@
1
+ overture_serverless/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ overture_serverless/job.py,sha256=TzgJ-soiMNIHGGcHH7JbXBggwU6wljOE2C7khN4ThEg,1547
3
+ overture_serverless-0.0.0.dist-info/licenses/LICENSE,sha256=24ta8OgpjROjE-HE1FWF9T3w46CiGzvcFzxjuEOFIUI,1070
4
+ overture_serverless-0.0.0.dist-info/METADATA,sha256=sFi_Pj8G6E3p8Z4411cfgNChQBAJR0yJccDrpa30H4U,2435
5
+ overture_serverless-0.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
6
+ overture_serverless-0.0.0.dist-info/top_level.txt,sha256=UlY7jr7QD9r-mrw3G3cvlkb2OVmiFwWC-i6_p91Rbpo,20
7
+ overture_serverless-0.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Overture Maps
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ overture_serverless