Skip to main content

A lean and powerful Python library for business day calculations and schedule

No dependencies, just Python. Simple, fast, and efficient


some statistics …

Pypi Version

Doc Status

Coverage

Downloads

pypi version

Documentation Status

code coverage

Downloads on Pypi


Tired of heavy libraries for simple date calculations?

networkdays is the solution you’ve been looking for. A pure Python library, with no dependencies, to calculate business days between dates, quickly and efficiently. Ideal for Python developers and data scientists who value simplicity and performance.

Why choose networkdays?

  • 🚀 Lightweight and Fast: Without the weight of external dependencies. Perfect for microservices, scripts, and projects where every millisecond counts.

  • 🧘‍♀️ Simple and Intuitive: A clear and straightforward API that resembles the spreadsheet functions you already know.

  • 💪 Flexible and Powerful: Support for custom holidays and days off, adapting to any calendar.

  • 📅 Project Planning: Calculate work schedules based on effort hours and business days.

Get started now!

Install networkdays with pip and start simplifying your date calculations today.

pip install python-networkdays

Practical Examples

Calculate business days between two dates

Just like in your favorite spreadsheet, calculate the working days, disregarding weekends and holidays.

from datetime import date
from networkdays import Networkdays

# Define the holidays
HOLIDAYS = {date(2024, 12, 25), date(2025, 1, 1)}

# Create a Networkdays instance
workdays = Networkdays(
    date(2024, 12, 20),  # Start date
    date(2025, 1, 10),   # End date
    HOLIDAYS             # List of holidays
)

# Get the list of workdays
day_list = workdays.networkdays()
print(f"There are {len(day_list)} working days.")
# There are 14 working days.

# You can also list the weekends and holidays in the period
print(f"Holidays: {workdays.holidays()}")
# Holidays: [datetime.date(2024, 12, 25), datetime.date(2025, 1, 1)]

print(f"Weekends: {workdays.weekends()}")
# Weekends: [datetime.date(2024, 12, 21), datetime.date(2024, 12, 22), ... ]

Plan your Project

Estimate the end date of a project based on working hours.

from datetime import date
from networkdays import JobSchedule

# Plan a 120-hour project, with 8 working hours per day,
# starting on July 1, 2024.
schedule = JobSchedule(
    project_duration_hours=120,
    workhours_per_day=8,
    date_start=date(2024, 7, 1)
)

print(f"The project will take {schedule.bussines_days} business days.")
# The project will take 15 business days.

print(f"Starts on: {schedule.prj_starts}")
# Starts on: 07/01/24

print(f"Ends on: {schedule.prj_ends}")
# Ends on: 07/19/24

# Analyze the work distribution
print(f"Project years: {list(schedule.years())}")
# Project years: [2024]

print(f"Project months: {list(schedule.months())}")
# Project months: [7]

Total Flexibility

Work on Saturdays? No problem. networkdays adapts to your needs.

from datetime import date
from networkdays import Networkdays

# Consider only Sunday as a day off (1=Mon, 7=Sun)
saturday_workdays = Networkdays(
    date(2024, 7, 1),
    date(2024, 7, 31),
    weekdaysoff={7}  # Only Sundays
)

print(f"Working days in July (working on Saturdays): {len(saturday_workdays.networkdays())}")
# Working days in July (working on Saturdays): 27

Complete Documentation

For more details and examples, access our official documentation:

https://networkdays.readthedocs.io/

Contributions

Contributions are always welcome! Feel free to open an issue or submit a pull request.

Code of Conduct

Everyone interacting with the project must follow our Code of Conduct.

License

This project is licensed under the MIT license. See the LICENSE file for more details.

Necto Logo

Metadata

Release files for python-networkdays 1.2

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

Source distribution (sdist)

Source distribution for python-networkdays 1.2
File Size Uploaded
python_networkdays-1.2.tar.gz 12.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-networkdays 1.2
File Interpreter ABI Platform
python_networkdays-1.2-py3-none-any.whl Python 3 none any Details

Total release size: 26.3 kB

Release files / python_networkdays-1.2.tar.gz

Download URL python_networkdays-1.2.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dda9f5603a0464a00612fdd2f2939f6d410c2432a2cad6843a93828953774ba5
BLAKE2b-256 checksum
How to use checksums
3f7775f985d06c9ea2ef48bd0f687056bc89981fc21ad3704bb614d1223a601b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Release files / python_networkdays-1.2-py3-none-any.whl

Download URL python_networkdays-1.2-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53843a8650885c30e87a1c37107148a82ab38276c613ac92c94face9e35925dd
BLAKE2b-256 checksum
How to use checksums
3d41a5c0add60e3c2ee0f951d7ee959ab31da766b57fef00a37f13a5673f9a5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files

1.1

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.0.1

2 release files

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