AWS-backed parking management library used by the Cloud Parking System
Project description
parking-booking-engine
A reusable Python library for parking operations backed by AWS services.
parking-booking-engine provides ready-to-use managers for parking slots, bookings, evidence photo upload, event logging, and CloudWatch monitoring.
Features
- DynamoDB-backed slot management
- Booking lifecycle management with conflict checks
- S3 evidence photo upload and retrieval links
- SNS notifications and SQS event publishing
- Booking audit/event logs
- Occupancy and activity metrics to CloudWatch
Requirements
- Python 3.9+
- AWS credentials configured
- AWS resources in your target region
Required AWS resources:
- DynamoDB table:
ParkingSlots - DynamoDB table:
ParkingBookings - DynamoDB table for event logs (example:
ParkingEventLogs) - S3 bucket for booking photos
- Optional SNS topic ARN
- Optional SQS queue URL
Installation
pip install parking-booking-engine
Quick Start
import boto3
from parking_lib import SlotManager, BookingManager, AwsServiceManager, ParkingMonitor, EventLogManager
region = "us-east-1"
dynamodb = boto3.resource("dynamodb", region_name=region)
slot_manager = SlotManager(dynamodb_resource=dynamodb, region_name=region)
booking_manager = BookingManager(dynamodb_resource=dynamodb, region_name=region)
aws_services = AwsServiceManager(
region_name=region,
s3_bucket="your-s3-bucket",
s3_prefix="booking-car-photos",
sns_topic_arn="arn:aws:sns:us-east-1:123456789012:parking-bookings",
sqs_queue_url="https://sqs.us-east-1.amazonaws.com/123456789012/parking-events",
)
monitor = ParkingMonitor(region_name=region)
event_log_manager = EventLogManager(table_name="ParkingEventLogs", region_name=region)
Common Usage
Create a slot
slot = slot_manager.add_slot(slot_number="A-101", location="Ground Floor")
Create a booking
booking = booking_manager.create_booking(
user_id="user-123",
slot_id=slot.slot_id,
slot_number=slot.slot_number,
start_time="2026-04-13T09:00",
end_time="2026-04-13T12:00",
vehicle_reg="141 D 123",
timezone_name="Europe/Dublin",
)
Upload booking photo
photo_key = aws_services.upload_booking_car_photo(
file_obj=file_obj,
booking_id=booking.booking_id,
user_id="user-123",
)
if photo_key:
booking_manager.attach_evidence(booking.booking_id, photo_key)
Emit event + metrics
aws_services.queue_booking_event("BOOKING_CREATED", {
"booking_id": booking.booking_id,
"slot_id": booking.slot_id,
"slot_number": booking.slot_number,
"user_id": booking.user_id,
"status": booking.status,
})
event_log_manager.create_event(
event_type="BOOKING_CREATED",
booking_id=booking.booking_id,
user_id=booking.user_id,
slot_number=booking.slot_number,
actor_user_id=booking.user_id,
status=booking.status,
)
monitor.log_booking_created()
monitor.log_occupancy(total=120, occupied=84)
Public API
from parking_lib import (
ParkingSlot,
SlotManager,
Booking,
BookingManager,
AwsServiceManager,
ParkingMonitor,
EventLog,
EventLogManager,
)
Error Handling
ValueError: booking conflicts / invalid booking statePermissionError: unauthorized cancel/update operations- Generic exceptions include underlying AWS service error details
Development
Run tests:
PYTHONPATH=. pytest -q tests/
Build and validate package metadata:
python -m build
python -m twine check dist/*
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file parking_booking_engine-0.1.1.tar.gz.
File metadata
- Download URL: parking_booking_engine-0.1.1.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08ae3e25f55fc6f6b558d2b6246586e3483c700732038cbc5270e06c8dd86ba6
|
|
| MD5 |
ce96c09287d89d86101756e257c373c0
|
|
| BLAKE2b-256 |
8d9f3638db1ed38030a0e7321018daf9fa74926aefb584c228fa18122ec2346f
|
Provenance
The following attestation bundles were made for parking_booking_engine-0.1.1.tar.gz:
Publisher:
python-publish.yml on Jaipalreddy2/parking-booking-engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parking_booking_engine-0.1.1.tar.gz -
Subject digest:
08ae3e25f55fc6f6b558d2b6246586e3483c700732038cbc5270e06c8dd86ba6 - Sigstore transparency entry: 1282508009
- Sigstore integration time:
-
Permalink:
Jaipalreddy2/parking-booking-engine@fc393e96565a4cba008c3abe0d3b667ae681fa6f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Jaipalreddy2
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@fc393e96565a4cba008c3abe0d3b667ae681fa6f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file parking_booking_engine-0.1.1-py3-none-any.whl.
File metadata
- Download URL: parking_booking_engine-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26505e1e8ba26ddcb0e08f02184ad8e7a14c9d776b736ff7490c7088bb7c5a26
|
|
| MD5 |
ba8cbc8fc009ccee66efdfe0e1ffe691
|
|
| BLAKE2b-256 |
c71f2801b55f79eea754486ec6145e01426252a0be75d78266051d561493152b
|
Provenance
The following attestation bundles were made for parking_booking_engine-0.1.1-py3-none-any.whl:
Publisher:
python-publish.yml on Jaipalreddy2/parking-booking-engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parking_booking_engine-0.1.1-py3-none-any.whl -
Subject digest:
26505e1e8ba26ddcb0e08f02184ad8e7a14c9d776b736ff7490c7088bb7c5a26 - Sigstore transparency entry: 1282508052
- Sigstore integration time:
-
Permalink:
Jaipalreddy2/parking-booking-engine@fc393e96565a4cba008c3abe0d3b667ae681fa6f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Jaipalreddy2
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@fc393e96565a4cba008c3abe0d3b667ae681fa6f -
Trigger Event:
workflow_dispatch
-
Statement type: