Skip to main content

calblock

Automatically blocks remaining free time in your Microsoft 365 calendar when it drops below a configurable threshold. Helps ensure you always have dedicated "silent work" time for focused, uninterrupted work.

Features

  • Automatic blocking: Monitors your calendar and creates "Silent work" blocks when free time drops below threshold
  • Configurable work hours: Define your working day (e.g., 8:00-18:00)
  • Smart event filtering: Only blocks based on accepted meetings and busy/tentative events
  • Existing silent work detection: Accounts for already-blocked time
  • Focus reminders: Optional daily reminders (e.g., "Check in on XZY" on Mondays)
  • Multiple-day processing: Can process today or multiple days ahead

Installation

This tool requires M365-Auth for OAuth2 authentication. If you don't have pipx, see the M365-Auth installation guide.

# Install both packages
pipx install m365auth
pipx install calblock

# Set up authentication
get-token --profile calendar

Configuration

On first run, calblock creates a default configuration file at ~/.config/calblock/config.yaml:

auth:
  profile: calendar  # M365 auth profile to use

calendar:
  api_base_url: https://graph.microsoft.com/beta
  timezone: Europe/London
  work_hours:
    start: 8
    end: 18
  min_free_hours: 2.0  # Minimum free + silent work time
  process_days:
    - 0  # Monday
    - 1  # Tuesday
    - 2  # Wednesday
    - 3  # Thursday
    - 4  # Friday
  silent_work_identifier: Silent work

focus_reminders:
  0: Check Project A    # Monday
  4: Check Project B    # Friday

Edit this file to customize:

  • work_hours: Your typical working hours
  • min_free_hours: Minimum combined free + silent work time (hours)
  • process_days: Which days to process (0=Monday, 6=Sunday)
  • timezone: Your timezone name
  • silent_work_identifier: Title for blocking events
  • focus_reminders: Optional day-specific reminders

Usage

# Process today (default)
calblock

# Process next 5 days
calblock --days 5

# Process specific date
calblock --date 2025-10-15

# Verbose mode (shows detailed calculations)
calblock -v

# Custom config file
calblock --config ~/my-config.yaml

How It Works

  1. Fetch events: Retrieves your calendar events for the specified date
  2. Calculate free time:
    • Identifies busy periods (accepted meetings, busy/tentative events)
    • Calculates free slots within work hours
    • Accounts for existing "Silent work" blocks
  3. Check threshold: If free time + existing silent work ≤ min_free_hours
  4. Create blocks: Fills free slots with "Silent work" events until threshold is met

Event Filtering

The blocker intelligently filters events:

  • Included: Accepted meetings, busy events, tentative events, out-of-office
  • Excluded: Declined/not-responded invitations, "free" status, "working elsewhere"

This ensures you don't over-block based on tentative or unconfirmed time.

Example Output

2025-10-13: 1.5h free + 0.5h silent = 2.0h total
✅ No blocking needed

2025-10-14: 0.5h free + 0.0h silent = 0.5h total
Created: Silent work (Check in on research project) 14:00-15:30 (90min)
✅ Blocked 1 slots

2025-10-15: 3.0h free + 0.0h silent = 3.0h total
✅ No blocking needed

Scheduling

Run automatically via cron:

# Add to crontab (crontab -e)
# Run at 7am every weekday, check next 2 days
0 7 * * 1-5 /Users/yourusername/.local/bin/calblock --days 2

Authentication

calblock uses the calendar profile from M365-Auth. Ensure you've run:

get-token --profile calendar

The OAuth refresh token is stored securely in your system keychain and automatically refreshed as needed.

Troubleshooting

"Error: m365auth module not found"

"No refresh token found"

  • Run: get-token --profile calendar

"Events not being filtered correctly"

  • Use --verbose mode to see detailed event processing
  • Check the showAs status and response status of events

"Wrong timezone"

  • Set the correct timezone name in config.yaml (e.g., timezone: America/New_York)
  • Use --verbose to see how times are being interpreted

License

MIT License

Credits

Built with M365-Auth for OAuth2 authentication.

Metadata

Release files for calblock 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 calblock 0.1.1
File Size Uploaded Provenance Actions
calblock-0.1.1.tar.gz 9.9 kB Without provenance Details for calblock-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 20.2 kB

Release files / calblock-0.1.1.tar.gz

Download URL calblock-0.1.1.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5d2a2073f3d62af5f2cf35bcfbbfbfc0852ed5935c86bf1547586dac2bc38cf1
BLAKE2b-256 checksum
How to use checksums
c0e3ae212a56d6d1fad5a2810b683d966d3c73c24fb1694ea5e932e3fa27f8d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

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

Download URL calblock-0.1.1-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7dc186ed4d9eb42662a3f377dde9381bfd5e51d99902ffe305282d279fa4ffbc
BLAKE2b-256 checksum
How to use checksums
490e5aeb107f3e025db669f4de64eb39af601e090917030b39fa36b589e82cf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for calblock 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.

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

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