Skip to main content

attendancex

A lightweight, dependency-free Python library for attendance calculations and planning.

PyPI version Python License: MIT


What is attendancex?

attendancex is a pure Python library that handles attendance logic — so developers don't have to write it themselves.

It works as a calculation engine that can be plugged into any project — a college app, a chatbot, a web dashboard, or an academic management system.


Installation

pip install attendancex

Quick Example

All examples below use:

  • attended — number of classes you have attended so far
  • total — total number of classes held so far
  • remaining — number of classes yet to be held this semester (e.g. if semester has 80 total classes and 60 are done, remaining = 20)
import attendancex

# What is my current attendance percentage?
# attended=45 classes out of total=60 classes held
attendancex.calculate_percentage(attended=45, total=60)
# → 75.0

# How many classes can I skip without falling below 75%?
# attended=49 out of total=60 — I have some buffer
attendancex.safe_bunks(attended=49, total=60)
# → 4  (I can skip 4 more classes safely)

# My attendance is low — how many classes must I attend in a row to recover?
# attended=30 out of total=60 — currently at 50%
attendancex.classes_needed(attended=30, total=60)
# → 60  (need to attend 60 consecutive classes to reach 75%)

# Can I still pass by end of semester?
# attended=45, total=60 held, remaining=20 classes left
attendancex.will_pass(attended=45, total=60, remaining=20)
# → True

# If I attend all upcoming classes, what will my attendance be?
# attended=45, total=60, extra_classes=10 upcoming
attendancex.projected_attendance(attended=45, total=60, extra_classes=10)
# → 78.57%

# What is the minimum number of remaining classes I must attend to pass?
# attended=45, total=60 held, remaining=20 classes left
attendancex.minimum_to_pass(attended=45, total=60, remaining=20)
# → 15  (must attend at least 15 out of the 20 remaining classes)

# How many classes can I skip in a row right now?
# attended=49 out of total=60
attendancex.bunk_streak(attended=49, total=60)
# → 5  (can skip 5 consecutive classes before dropping below 75%)

# Get a complete attendance report in one call
attendancex.attendance_summary(attended=45, total=60, remaining=20)
# → {
#     'percentage': 75.0,         # current attendance %
#     'status': 'warning',        # safe / warning / critical
#     'safe_bunks': 0,            # classes that can still be skipped
#     'classes_needed': 0,        # classes needed to recover (0 = already passing)
#     'will_pass': True,          # can you still pass this semester?
#     'projected_attendance': 81.25,  # % if all remaining classes are attended
#     'minimum_to_pass': 15,      # minimum classes to attend from remaining
#     'bunk_streak': 0            # max consecutive classes that can be skipped
#   }

All Functions

Function Parameters Returns Description
calculate_percentage attended, total float Current attendance percentage
safe_bunks attended, total int Classes that can be safely skipped
classes_needed attended, total int Classes to attend to reach required %
will_pass attended, total, remaining bool Whether passing is still achievable
projected_attendance attended, total, extra_classes float % if all future classes are attended
minimum_to_pass attended, total, remaining int Minimum classes to attend from remaining
bunk_streak attended, total int Max classes that can be skipped in a row
attendance_summary attended, total, remaining dict Complete attendance report

Custom Attendance Requirement

By default, all functions use 75% as the minimum required attendance.

If your college has a different requirement, pass it using required_percent:

# Default — 75% minimum requirement
attendancex.safe_bunks(attended=49, total=60)
# → 4  (can skip 4 classes)

# Custom — 80% minimum requirement
attendancex.safe_bunks(attended=49, total=60, required_percent=80)
# → 1  (can skip only 1 class)

# Works with all functions
attendancex.attendance_summary(attended=45, total=60, remaining=20, required_percent=80)

Error Handling

attendancex raises clear exceptions for invalid inputs — no silent failures.

# Total classes cannot be zero
try:
    attendancex.calculate_percentage(attended=45, total=0)
except ValueError as e:
    print(e)
# → 'total' must be greater than zero

# Attended cannot be more than total
try:
    attendancex.calculate_percentage(attended=70, total=60)
except ValueError as e:
    print(e)
# → 'attended' cannot be greater than 'total'

License

MIT — free to use, modify, and distribute.

Metadata

Release files for attendancex 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for attendancex 0.1.1
File Size Uploaded Provenance
attendancex-0.1.1.tar.gz 4.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for attendancex 0.1.1
File Interpreter ABI Platform
attendancex-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.8 kB

Release files / attendancex-0.1.1.tar.gz

Download URL attendancex-0.1.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ddb313128694dbbab9e9bc1afd06a963c5ae7b3e7f4e73edff6698da5d5c8102
BLAKE2b-256 checksum
How to use checksums
79e9c426cd827e2ba898401d34d6d4f93b72e82f063b3b041212850ddde37035
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / attendancex-0.1.1-py3-none-any.whl

Download URL attendancex-0.1.1-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20fe4f02ebaf384982f4dbccb808b07b23de579a155897f9e1084aff928b4884
BLAKE2b-256 checksum
How to use checksums
78a4e59f7f7ee2fd7f7c85f0a5b73564f9aaadbf570f1bc831be87cd4d903798
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for attendancex 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page