Skip to main content

PyWorkforce

PyPI version Supported Python versions Tests Coverage

Workforce planning in Python, from queue staffing to shift schedules. How many people do you need, and when? PyWorkforce uses Erlang models to size queues and OR-Tools to turn staffing requirements into shifts, rosters, and break schedules. Bring your own demand forecast and inspect the results in pandas.

Quick start · Worked planning tutorial · Runnable examples

Installation

Use Python 3.12–3.14 and install the package from PyPI.

python -m pip install pyworkforce

Build your first shift schedule

A service desk needs 2 people in the morning, 3 at midday, and 1 in the afternoon. Early and Late shifts overlap at midday. How many people should start each shift?

from pyworkforce.scheduling import MinRequiredResources

plan = MinRequiredResources(
    num_days=1,
    periods=3,
    required_resources=[[2, 3, 1]],  # people needed in each period
    shifts_coverage={"Early": [1, 1, 0], "Late": [0, 1, 1]},
    max_shift_concurrency=3,
    max_period_concurrency=3,
)
solution = plan.solve()
print(solution["status"], plan.scheduled_resources())
OPTIMAL {'Early': [2], 'Late': [1]}

Schedule two people on Early and one on Late. The overlap covers all three midday positions. If afternoon demand rises to two, evaluate the same assignments against the new forecast.

coverage = plan.coverage([[2, 3, 2]])
print(coverage[["period", "required", "scheduled", "shortfall"]].to_string(index=False))
 period  required  scheduled  shortfall
      0         2          2          0
      1         3          3          0
      2         2          1          1

The afternoon is one person short. For charts, install python -m pip install "pyworkforce[plot]". The coverage tutorial shows how to plot the gap. The shift coverage guide shows how to describe longer shifts using clock hours.

Planning pipeline

Queue sizing can supply staffing targets for skill mix or shift scheduling. Shift counts feed named rostering and anonymous break scheduling independently.

Start at the decision you need to make. After solving a shift schedule, pass scheduled_resources() to the roster as required_resources, or to the break scheduler as scheduled_resources, along with each tool's constraints.

Your question Model or API Worked guide
How many agents will meet our answer-time target? ErlangC for waiting callers, ErlangA when callers may abandon Waiting · Abandonment
How many channels will keep blocking below target? ErlangB for traffic lost when all channels are busy Channel sizing
Which combination of skills covers demand at minimum cost? MultiSkillStaffing Skill profiles
How many people should work each shift? MinRequiredResources for full coverage, MinAbsDifference to minimize coverage error Shift scheduling
Where will the schedule fall short if demand changes? coverage() and compare_coverage() on the solved plan Demand scenarios
Who works which days and shifts? MinHoursRoster with availability rules and preferences Named rosters
When can people take breaks and still meet minimum coverage? BreakScheduler places breaks for anonymous slots on each shift Break placement

On the main branch, you can also compare shortfalls by day and period across forecasts with compare_coverage(..., by_period=True) and plot_period_shortfalls(), or keep each person's shift consistent with shift_block_starts. See the scenario example and the roster example.

Start from call volume

Erlang C turns forecast call volume into a staffing requirement. For 100 calls in 30 minutes, assume a three-minute average handle time, an 80% answer target within 20 seconds, and 30% shrinkage.

from pyworkforce.queuing import ErlangC

queue = ErlangC(transactions=100, aht=3, asa=20 / 60, interval=30, shrinkage=0.30)
staff = queue.required_positions(service_level=0.80, max_occupancy=0.85)
print(f"{staff['raw_positions']} productive agents, {staff['positions']} to schedule")
14 productive agents, 20 to schedule

Explore how headcount affects service level and occupancy, or run several Erlang scenarios in one batch.

Project and community

PyWorkforce is a beta-stage, MIT-licensed project. The stable documentation and release notes cover the published package. For a bug report or a planning use case, open an issue. To contribute a model, fix, or example, see the contributing guide and license.

Metadata

Release files for pyworkforce 0.7.0

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

Source distribution (sdist)

Source distribution for pyworkforce 0.7.0
File Size Uploaded Provenance Actions
pyworkforce-0.7.0.tar.gz 69.6 kB With provenance Details for pyworkforce-0.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 155.2 kB

Release files / pyworkforce-0.7.0.tar.gz

Download URL pyworkforce-0.7.0.tar.gz
Size 69.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a1223a235dafca5b2125fdb60196fa5c5bdfa99721b036958d991aba7f1e4755
BLAKE2b-256 checksum
How to use checksums
b94a14c10199a80daa28f1cdf7556212415fa31f573618129b51ce0aa2143b89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / pyworkforce-0.7.0-py3-none-any.whl

Download URL pyworkforce-0.7.0-py3-none-any.whl
Size 85.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24a8097e011e95df6239ccc5f982497efd6cfbbfb7eadeaf451eda337d169ead
BLAKE2b-256 checksum
How to use checksums
515f5c08d8f9d61d672a2aa8c3cb5914b963be4cc146c3668d71cf176be3ae5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for pyworkforce 0.7.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyworkforce-0.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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