pygrestqlambda 0.0.2__tar.gz → 0.0.3__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 (36) hide show
  1. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/.github/workflows/publish.yml +7 -0
  2. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/PKG-INFO +1 -1
  3. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/pyproject.toml +1 -1
  4. pygrestqlambda-0.0.3/scripts/pre-publish.sh +7 -0
  5. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/src/pygrestqlambda/aws/lambda_function/json_transform.py +10 -3
  6. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/tests/aws/lambda_function/test_json_transform.py +20 -1
  7. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/.github/workflows/validate.yml +0 -0
  8. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/.gitignore +0 -0
  9. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/LICENSE +0 -0
  10. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/README.md +0 -0
  11. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/direct/README.md +0 -0
  12. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/direct/json_response.py +0 -0
  13. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/direct/requirements.txt +0 -0
  14. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/direct/string_response.py +0 -0
  15. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/lambda/Dockerfile +0 -0
  16. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/lambda/README.md +0 -0
  17. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/lambda/app.py +0 -0
  18. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/local_lambda_gateway_compose/README.md +0 -0
  19. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/local_lambda_gateway_compose/docker-compose.yaml +0 -0
  20. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/local_lambda_gateway_compose/lambda/Dockerfile +0 -0
  21. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/local_lambda_gateway_compose/lambda/app.py +0 -0
  22. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/local_lambda_gateway_compose/lambda/requirements.txt +0 -0
  23. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/docs/examples/local_lambda_gateway_compose/openapi.yaml +0 -0
  24. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/scripts/validate.sh +0 -0
  25. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/src/__init__.py +0 -0
  26. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/src/pygrestqlambda/__init__.py +0 -0
  27. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/src/pygrestqlambda/aws/__init__.py +0 -0
  28. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/src/pygrestqlambda/aws/lambda_function/__init__.py +0 -0
  29. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/src/pygrestqlambda/aws/lambda_function/rest_api_gateway_proxy_integration.py +0 -0
  30. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/src/pygrestqlambda/db/__init__.py +0 -0
  31. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/src/pygrestqlambda/db/record.py +0 -0
  32. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/tests/__init__.py +0 -0
  33. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/tests/aws/__init__.py +0 -0
  34. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/tests/aws/lambda_function/__init__.py +0 -0
  35. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/tests/aws/lambda_function/test_rest_api_gateway_proxy_integration.py +0 -0
  36. {pygrestqlambda-0.0.2 → pygrestqlambda-0.0.3}/tests/test_record.py +0 -0
@@ -4,6 +4,9 @@ on:
4
4
  push:
5
5
  tags: [ '*.*.*' ]
6
6
 
7
+ env:
8
+ PROJECT_VERSION: ${{ github.ref_name }}
9
+
7
10
  jobs:
8
11
  publish:
9
12
  runs-on: ubuntu-latest
@@ -19,6 +22,10 @@ jobs:
19
22
  with:
20
23
  python-version: '3.11'
21
24
 
25
+ # Run pre-publish step to update project version number to tag
26
+ - name: Pre-build
27
+ run: ./scripts/pre-publish.sh
28
+
22
29
  # Re-run validation and build
23
30
  - name: Validate
24
31
  run: ./scripts/validate.sh
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygrestqlambda
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: PostgreSQL REST API framework for AWS Lambda functions
5
5
  Project-URL: Homepage, https://github.com/mesogate/pygrestqlambda
6
6
  Project-URL: Issues, https://github.com/mesogate/pygrestqlambda/issues
@@ -4,7 +4,7 @@ requires = ["hatchling"]
4
4
 
5
5
  [project]
6
6
  name = "pygrestqlambda"
7
- version = "0.0.2"
7
+ version = "0.0.3"
8
8
  description = "PostgreSQL REST API framework for AWS Lambda functions"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ # Override pyproject version if environment variable is set
5
+ PROJECT_VERSION=${PROJECT_VERSION:=0.0.0}
6
+ echo "Setting project version: ${PROJECT_VERSION}"
7
+ sed -i -e "s/version.*=.*\".*\"/version = \"${PROJECT_VERSION}\"/" pyproject.toml
@@ -2,9 +2,9 @@
2
2
  JSON output transformer for non-serialisable values
3
3
  """
4
4
 
5
+ from datetime import date, datetime
6
+ from decimal import Decimal
5
7
  from uuid import UUID
6
- from datetime import datetime
7
-
8
8
 
9
9
  def json_output(value: object) -> str:
10
10
  """
@@ -15,8 +15,15 @@ def json_output(value: object) -> str:
15
15
  if isinstance(value, UUID):
16
16
  value = str(value)
17
17
 
18
- # Handle timestamps
18
+ # Handle date/timestamps
19
19
  if isinstance(value, datetime):
20
20
  value = value.isoformat()
21
21
 
22
+ if isinstance(value, date):
23
+ value = value.isoformat()
24
+
25
+ # Handle decimals
26
+ if isinstance(value, Decimal):
27
+ value = float(value)
28
+
22
29
  return value
@@ -3,7 +3,8 @@ Test JSON transformation for lambda proxy integration response
3
3
  """
4
4
 
5
5
  from uuid import uuid4
6
- from datetime import datetime
6
+ from datetime import date, datetime
7
+ from decimal import Decimal
7
8
  from pygrestqlambda.aws.lambda_function.json_transform import json_output
8
9
 
9
10
 
@@ -25,3 +26,21 @@ def test_datetime():
25
26
  now = datetime.now()
26
27
 
27
28
  assert json_output(now) == now.isoformat()
29
+
30
+
31
+ def test_date():
32
+ """
33
+ Test dates are transformed correctly
34
+ """
35
+
36
+ today = date.today()
37
+ assert json_output(today) == today.isoformat()
38
+
39
+
40
+ def test_decimal():
41
+ """
42
+ Test decimals are transformed correctly
43
+ """
44
+
45
+ assert json_output(Decimal('1.0005')) == 1.0005
46
+ assert json_output(Decimal('1.00050')) == 1.0005
File without changes
File without changes