Core business logic for adventure staycation packages (trekking, hills staycation, jungle safari, lodging).
Project description
adventurestay-utils
Core business logic for adventure staycation experiences such as trekking, hills staycations, jungle safaris, and rustic lodging. The package centralizes package configuration, booking validation, availability checking, and price calculations so that multiple web or backend apps can share the same rules.
Installation
pip install adventurestay-utils
During local development inside this repo:
pip install -e .
Usage
from datetime import date
from adventurestay_utils import (
AdventurePackage,
PackageBookingValidator,
PackageAvailabilityChecker,
AdventurePriceCalculator,
build_itinerary_summary,
AdventureBooking,
)
package = AdventurePackage(
package_id="JUNGLE001",
category="JUNGLE_SAFARI",
name="2N/3D Jungle Safari",
location="Kanha",
base_price_per_person=95.0,
max_guests=8,
min_nights=2,
max_nights=4,
includes_meals=True,
includes_guide=True,
)
validator = PackageBookingValidator()
request = validator.create_booking_request(
package, start_date=date(2025, 3, 10), end_date=date(2025, 3, 13), num_guests=4
)
availability_checker = PackageAvailabilityChecker()
availability_checker.check_availability(request, package, existing_bookings=[])
price = AdventurePriceCalculator().calculate_price(request, package)
booking = AdventureBooking(
package=package,
start_date=request.start_date,
end_date=request.end_date,
num_guests=request.num_guests,
nights=(request.end_date - request.start_date).days,
total_price=price,
)
print(build_itinerary_summary(booking))
Development
-
Create/activate the provided
.venv. -
Install dependencies:
pip install -e .[dev]. -
Run tests:
python -m pytest. -
Build the package when ready for publishing:
python -m pip install --upgrade build twine python -m build # twine upload dist/* # requires credentials via environment variables
Features
- Dataclass-based domain models for packages and bookings.
- Validators for dates, guest counts, and package configuration.
- Availability checker that prevents overlapping bookings beyond capacity.
- Pricing calculator with weekend and peak-season multipliers.
- Itinerary summary helper for emails and notifications.
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 adventurestay_utils-0.1.0.tar.gz.
File metadata
- Download URL: adventurestay_utils-0.1.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
280b165d9f96cd60bf9bbde2f84256d7bce3501e38ebd1a97bc15db691a0bacb
|
|
| MD5 |
e6391b1fdb4d3eed64f2adb477c92723
|
|
| BLAKE2b-256 |
d16430618654d5bca3192c38ff35474aa03806af51ee481faccfdbc4eec41aa5
|
File details
Details for the file adventurestay_utils-0.1.0-py3-none-any.whl.
File metadata
- Download URL: adventurestay_utils-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9309f62ea1a0f08e7d0563afe16b57502056781dd5821a757da42e1c31efa8ef
|
|
| MD5 |
10860ba5d8736e385219571d83412e2e
|
|
| BLAKE2b-256 |
267486b4df821f810b005b078c536d725f2c69b5819d1927404340976dca7716
|