Skip to main content

nucore_mini_scheduler

Mini Scheduler that fires events to callback listeners. It uses start/end times and walks through a sorted timeline.

Installation

# local editable install
pip install -e .

# once published on PyPI
pip install nucore-mini-scheduler

Quick start

from datetime import datetime, timedelta, timezone

from nucore_mini_scheduler import MiniSchedule, MiniScheduler


def on_event(segment: MiniSchedule):
		print(
				"event",
				segment.getId(),
				segment.getDescription(),
				segment.getStartTime(),
				segment.getEndTime(),
				"processed=", segment.isProcessed(),
		)


scheduler = MiniScheduler()
scheduler.registerCallback(on_event)

start = datetime.now(timezone.utc) + timedelta(seconds=3)
segment = MiniSchedule(
		id=None,  # auto-generated
		description="demo segment",
		start_time=start,
		duration=10,
)

scheduler.setTimeSeries([segment])

MiniSchedule

Represents one schedulable segment.

  • id is always non-null.
  • If id=None, a UUID string is generated.
  • description is optional and may be None.
  • Datetimes are normalized to UTC.

Constructor

MiniSchedule(
		start_time: datetime | None = None,
		end_time: datetime | None = None,
		duration: int | timedelta | None = None,
		id: str | None = None,
		description: str | None = None,
)

Time rules

  • If duration is provided with start_time, then end_time = start_time + duration.
  • If end_time is provided with start_time, then duration = end_time - start_time.
  • Naive datetimes are treated as local time, then converted to UTC.

Equality behavior

MiniSchedule uses value-based equality (__eq__). Two segments are equal if all of the following match:

  • id
  • description
  • start_time
  • end_time
  • duration

This is used by MiniScheduler.setTimeSeries(...) to ignore a new list when its content is equal to the current time series.

MiniScheduler

Thread-based scheduler that consumes a list of MiniSchedule and emits callbacks.

Callbacks

  • registerCallback(callback): callback is invoked around start/end transitions.
  • registerFutureCallback(callback, duration_seconds): callback is invoked for segments that begin within the look-ahead window.

Core methods

  • setTimeSeries(ts: list[MiniSchedule]): starts the worker thread when needed, stops current run, swaps series, then starts scheduling. If ts is equal in value to the current list, it is ignored.
  • stop(): requests scheduler stop and clears current time-series state.

Public exports

  • MiniSchedule
  • MiniScheduler
  • FutureCallback
  • SchedulePoint
  • SchedulerControl

Build and publish to PyPI

  1. Build distribution artifacts:
python3 -m pip install --upgrade build twine
python3 -m build
  1. Validate artifacts:
python3 -m twine check dist/*
  1. Upload to TestPyPI first (recommended):
python3 -m twine upload --repository testpypi dist/*
  1. Upload to PyPI:
python3 -m twine upload dist/*
  1. Install from PyPI:
pip install nucore-mini-scheduler

Metadata

Release files for nucore-mini-scheduler 0.1.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 nucore-mini-scheduler 0.1.0
File Size Uploaded
nucore_mini_scheduler-0.1.0.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nucore-mini-scheduler 0.1.0
File Interpreter ABI Platform
nucore_mini_scheduler-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.8 kB

Release files / nucore_mini_scheduler-0.1.0.tar.gz

Download URL nucore_mini_scheduler-0.1.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0ba63e333185c1e8065929a057c82ec8d9cf721444e5a297dd3fb3694ef09ab4
BLAKE2b-256 checksum
How to use checksums
e2b9bff67cefcd4de8f139495536e0d5fed25aef79a90cbde54c51ea55c7c1a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 1, 2026.

Transparency log

Release files / nucore_mini_scheduler-0.1.0-py3-none-any.whl

Download URL nucore_mini_scheduler-0.1.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f7d51500b9181fb8937ca8b19dddc76932c8cd18b7f49ec2a123c04b5039cd0
BLAKE2b-256 checksum
How to use checksums
0bff1a9279dadb2fabcee4fcc1840ebec18213f75acc93315f58d3c1753a1d0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

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