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.0.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.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: leave_utils-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 2911ecd2b00e8a2918d64ec5b8c752a1a7b8c7e8c70e73f3ad309ec5df49f4a4
MD5 9fdaab37b5f7e824f64ee362557e6826
BLAKE2b-256 ad04b9e6feeef86fd1d6fe6f232468148e8743edc6e354bae7a7b3e10979a4df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: leave_utils-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0b1d03bc76b4c10795ea0411347d7ddfb774adf27063ab750c28d54a22058c6
MD5 7cfd5cda565656959a342dc197dbc502
BLAKE2b-256 4d61a1639613f4c17eb89be2e6ec61c2773e51e31beece038ee5700fd40fffd1

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