Skip to main content

A Python library for leave management calculations, balance tracking and policy enforcement.

Project description

leave-utils

A Python library for leave management applications. Provides business day calculations, leave balance management and policy enforcement.

Installation

````pip install leave-utils```

Classes

LeaveCalculator

Calculates the number of working days between two dates, excluding weekends and Irish public holidays.

LeaveBalanceManager

Manages and validates employee leave balances and entitlements for different leave types including annual, sick, maternity, paternity and unpaid leave.

LeavePolicyEngine

Enforces organisational leave policies including minimum notice periods, maximum consecutive days and documentation requirements.

Usage

from leave_utils import LeaveCalculator, LeaveBalanceManager, LeavePolicyEngine
from datetime import date

# Calculate working days
calc = LeaveCalculator()
days = calc.count_working_days(date(2025, 1, 6), date(2025, 1, 10))
print(days)  # 5

# Check balance
manager = LeaveBalanceManager()
remaining = manager.calculate_remaining('annual', days_used=5)
print(remaining)  # 15

# Validate policy
policy = LeavePolicyEngine(min_notice_days=3)
result = policy.validate_request(date(2025, 2, 10), date(2025, 2, 14), 'annual', 5)
print(result)  # {'valid': True, 'errors': []}

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

leave_utils-1.0.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

leave_utils-1.0.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file leave_utils-1.0.1.tar.gz.

File metadata

  • Download URL: leave_utils-1.0.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for leave_utils-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4263c5e721a606e6c9d2c293c4fc331fa50bccec471774608b4aa0ea2181844e
MD5 f9ddc14591a1bdec7ef77bdcb49294e1
BLAKE2b-256 cdd96f14d5f0e839eb307edfa8d09f3d65444de02e9c5ac7b17d11856c44e65e

See more details on using hashes here.

File details

Details for the file leave_utils-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: leave_utils-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for leave_utils-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 746c06fd10f6c1bc273b0f4210ef2bcd86cc87b0b1b8727e3d5fb9efeec69376
MD5 261265ca1f221165ac01ee08bcea0725
BLAKE2b-256 6826317e77804725c05ed9399627f03689bd26ed511e9a29342a4a268de88c06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page