when-free 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. when_free-0.4.0.dist-info/METADATA +391 -0
  2. when_free-0.4.0.dist-info/RECORD +43 -0
  3. when_free-0.4.0.dist-info/WHEEL +4 -0
  4. when_free-0.4.0.dist-info/entry_points.txt +3 -0
  5. when_free-0.4.0.dist-info/licenses/LICENSE +202 -0
  6. whenfree/__init__.py +3 -0
  7. whenfree/__main__.py +6 -0
  8. whenfree/agents/__init__.py +1 -0
  9. whenfree/agents/mcp.py +93 -0
  10. whenfree/agents/tools.py +176 -0
  11. whenfree/api.py +298 -0
  12. whenfree/calendars/__init__.py +1 -0
  13. whenfree/calendars/cache.py +69 -0
  14. whenfree/calendars/sources.py +72 -0
  15. whenfree/cli/__init__.py +2 -0
  16. whenfree/cli/demo.py +76 -0
  17. whenfree/cli/main.py +325 -0
  18. whenfree/core/__init__.py +1 -0
  19. whenfree/core/errors.py +5 -0
  20. whenfree/core/ical.py +292 -0
  21. whenfree/core/render.py +84 -0
  22. whenfree/core/slots.py +88 -0
  23. whenfree/core/status.py +68 -0
  24. whenfree/devices/__init__.py +1 -0
  25. whenfree/devices/feed.py +57 -0
  26. whenfree/devices/mobile/app.css +85 -0
  27. whenfree/devices/mobile/app.js +135 -0
  28. whenfree/devices/mobile/icon.svg +1 -0
  29. whenfree/devices/mobile/index.html +65 -0
  30. whenfree/devices/mobile/manifest.webmanifest +11 -0
  31. whenfree/devices/pairing.py +92 -0
  32. whenfree/devices/qr.py +280 -0
  33. whenfree/devices/widgets.py +69 -0
  34. whenfree/messages/__init__.py +1 -0
  35. whenfree/messages/dates.py +171 -0
  36. whenfree/messages/extract.py +47 -0
  37. whenfree/settings/__init__.py +13 -0
  38. whenfree/settings/config.py +222 -0
  39. whenfree/smarthome/__init__.py +1 -0
  40. whenfree/smarthome/homeassistant.py +147 -0
  41. whenfree/smarthome/mqtt.py +160 -0
  42. whenfree/web/__init__.py +1 -0
  43. whenfree/web/server.py +334 -0
@@ -0,0 +1,391 @@
1
+ Metadata-Version: 2.5
2
+ Name: when-free
3
+ Version: 0.4.0
4
+ Summary: Which days and times am I free? Reads your calendar feeds and a pasted message, and prints the slots you can offer. Runs on your own machine.
5
+ Project-URL: Homepage, https://github.com/YauhenBichel/when-free
6
+ Project-URL: Issues, https://github.com/YauhenBichel/when-free/issues
7
+ Author: Yauhen Bichel
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: ai-agents,availability,calendar,cli,free-busy,google-calendar,icalendar,ics,interview,mcp,mcp-server,scheduling
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Office/Business :: Scheduling
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+
20
+ # when-free
21
+
22
+ **Someone asks when you're free. This reads your calendar and gives you the answer, ready to paste.**
23
+
24
+ [![tests](https://github.com/YauhenBichel/when-free/actions/workflows/tests.yml/badge.svg)](https://github.com/YauhenBichel/when-free/actions/workflows/tests.yml)
25
+ [![PyPI](https://img.shields.io/pypi/v/when-free.svg)](https://pypi.org/project/when-free/)
26
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/YauhenBichel/when-free/blob/main/LICENSE)
27
+
28
+ <!-- mcp-name: io.github.YauhenBichel/when-free -->
29
+
30
+ ![A recruiter's message goes in; the free slots on those days come out](https://raw.githubusercontent.com/YauhenBichel/when-free/main/docs/demo.gif)
31
+
32
+ - **Paste the message, get the slots.** It reads "Tuesday or Wednesday next week, between 10am and 4pm" and answers for exactly those days and hours.
33
+ - **Works with Google, Outlook and iCloud** calendars, or any `.ics` file. Several calendars at once.
34
+ - **Private.** It runs on your computer, needs no account and no API key, and never changes your calendar.
35
+ - **Works from your AI tools too:** Claude, Cursor and other MCP clients, Open WebUI, n8n, Shortcuts, scripts.
36
+ - **And on your other devices:** phones, tablets and watches, Home Assistant (and Alexa, Google Home, Siri through it), and the menu bar or status bar of macOS, Linux and Windows.
37
+
38
+ ## Contents
39
+
40
+ [Try it](#try-it-in-a-minute) · [Add your calendar](#add-your-calendar) · [Everyday use](#everyday-use) · [Reading a message](#reading-a-message) · [Use it from other tools](#use-it-from-other-tools) · [Other devices](#on-your-other-devices) · [Privacy](#privacy) · [Settings](#settings) · [What counts as busy](#what-counts-as-busy) · [Limits](#limits) · [Problems](#if-something-does-not-work)
41
+
42
+ ## Try it in a minute
43
+
44
+ With [uv](https://docs.astral.sh/uv/), nothing to install first:
45
+
46
+ ```bash
47
+ uvx when-free demo
48
+ ```
49
+
50
+ To keep it (needs Python 3.11 or newer):
51
+
52
+ ```bash
53
+ uv tool install when-free # or: pipx install when-free
54
+ whenfree demo
55
+ ```
56
+
57
+ Using Claude Desktop? You can skip all of this: install the [one-click extension](https://github.com/YauhenBichel/when-free/blob/main/docs/recipes.md#claude-desktop-in-one-click).
58
+
59
+ `whenfree demo` makes up a calendar for next week and answers a recruiter's message from it. It reads none of your data and saves nothing:
60
+
61
+ ```text
62
+ > Hi! Thanks for applying. Could you share a few times on Tuesday, Wednesday or Thursday next week,
63
+ > between 10am and 4pm? The interview takes about an hour.
64
+
65
+ Free between 10:00 and 16:00 (Europe/London), slots of 60+ minutes, 15-minute buffer around events:
66
+ - Tue 13 Oct: 11:45–12:45, 14:15–16:00
67
+ - Wed 14 Oct: 12:15–14:15
68
+ - Thu 15 Oct: 13:15–14:45
69
+ ```
70
+
71
+ ## Add your calendar
72
+
73
+ 1. **Copy your calendar's private address.** It's a link that ends in `.ics`:
74
+
75
+ | Calendar | Where to find it |
76
+ |---|---|
77
+ | Google Calendar | [Settings](https://calendar.google.com/calendar/u/0/r/settings) → click your calendar on the left → *Integrate calendar* → **Secret address in iCal format** |
78
+ | Outlook | Settings → Calendar → Shared calendars → *Publish a calendar* → the **ICS** link |
79
+ | iCloud | Calendar → the share icon next to the calendar → *Public Calendar* (a `webcal://` link is fine) |
80
+ | Anything else | Any `.ics` link, or an exported `.ics` file |
81
+
82
+ 2. **Run `whenfree add` and paste it.** The address isn't shown while you paste. It's checked first, and saved only if it works:
83
+
84
+ ```console
85
+ $ whenfree add
86
+ Paste the address and press Enter (it is not shown):
87
+ Added 'personal': 412 events, 9 block time in the next 14 days.
88
+ Saved in /Users/you/.config/when-free/config.toml, readable only by you. Now run: whenfree
89
+ ```
90
+
91
+ 3. **Run `whenfree`.** You'll see your free time for the next working days.
92
+
93
+ On a Mac, `pbpaste | whenfree add` takes the address straight from the clipboard.
94
+
95
+ > **Keep the address secret.** It works like a password: anyone who has it can read that calendar. Give it to `whenfree add` and to nothing else, so not to a chat, a shell command or a repository. If it leaks, reset it in your calendar's settings.
96
+
97
+ <details>
98
+ <summary><b>Google Calendar, step by step</b></summary>
99
+
100
+ Do this in a browser, because the phone app doesn't show the address.
101
+
102
+ 1. Open [Google Calendar settings](https://calendar.google.com/calendar/u/0/r/settings): the gear icon, then **Settings**.
103
+ 2. In the left column, under **Settings for my calendars**, click the calendar you want. The one with your own name is where invitations arrive.
104
+ 3. Scroll down to **Integrate calendar** and copy **Secret address in iCal format**. It ends in `basic.ics`. Don't take "Public address in iCal format", which only works for a calendar you've made public.
105
+ 4. Run `whenfree add` and paste it when asked.
106
+
107
+ No "Secret address"? Work and school accounts can have it switched off. Export the calendar instead (Settings → Import & export → Export), unzip it, and run `whenfree add ~/calendars/work.ics`. An export is a snapshot, so export again when your calendar changes.
108
+ </details>
109
+
110
+ <details>
111
+ <summary><b>More than one calendar</b></summary>
112
+
113
+ A slot counts as free only if it's free in every calendar you add.
114
+
115
+ ```bash
116
+ whenfree add --name work # a second calendar: asks for its address
117
+ whenfree add ~/calendars/family.ics # an exported file instead of an address
118
+ whenfree check # can every calendar be read?
119
+ ```
120
+
121
+ They're kept in `~/.config/when-free/config.toml`, one `[[calendar]]` block each, with a `name` and a `url` or `path`. You can edit that file by hand. `whenfree init` creates an empty one.
122
+ </details>
123
+
124
+ ## Everyday use
125
+
126
+ | You want | Run |
127
+ |---|---|
128
+ | Your free time over the next working days | `whenfree` |
129
+ | The days and hours a message asks about | `pbpaste \| whenfree --message -` (Mac clipboard) or `whenfree --message invite.txt` |
130
+ | Next week's afternoons | `whenfree --days "next week" --hours afternoon` |
131
+ | Specific days | `whenfree --days "Thu 15 Oct, Fri 16 Oct"` |
132
+ | A date range | `whenfree --from 2026-10-12 --to 2026-10-16` |
133
+ | Only slots long enough for a 90-minute meeting | `whenfree --min 90` |
134
+ | To see what blocks each day | `whenfree --busy` |
135
+ | The answer in another time zone | `whenfree --tz America/New_York` |
136
+ | JSON for a script | `whenfree --format json` |
137
+ | To copy the answer | `whenfree ... \| pbcopy` (only the slot lines are copied) |
138
+
139
+ Only the slot lines go to standard output. The context goes to standard error, so `| pbcopy` copies exactly what you'd paste into a reply.
140
+
141
+ ## Reading a message
142
+
143
+ `--message` finds the days and hours in ordinary text. It understands:
144
+
145
+ - **Dates** written in any common way: `Thu 1 Oct` · `Thursday the 1st of October` · `Monday, October 5th` · `5 October` · `2026-10-05` · `Wednesday 30th`
146
+ - **Hours:** `between 10:00am and 4:00pm` · `10:00–16:00` · `9-5pm` · `2 to 4 pm`
147
+ - **Words, when there's no date** (here, today is Thursday 1 Oct):
148
+
149
+ | Written | Read as |
150
+ |---|---|
151
+ | `today` · `tomorrow` · `the day after tomorrow` | Thu 1 · Fri 2 · Sat 3 Oct |
152
+ | `Thursday or Friday` | the coming ones, today included: Thu 1, Fri 2 Oct |
153
+ | `this Tuesday` · `next Tuesday` | Tuesday of this week (already past, so left out and named) · Tuesday of next week, Tue 6 Oct |
154
+ | `next week` · `this week` · `the week after next` | that week's working days, from today on |
155
+ | `Tuesday or Wednesday next week` | Tue 6, Wed 7 Oct |
156
+ | `any afternoon` · `Friday morning` · `evening` | 12:00–17:00 · 09:00–12:00 · 17:00–20:00, unless hours are given |
157
+
158
+ It always tells you how it read the dates, so you can check them against the message. A few rules keep it from guessing:
159
+
160
+ - **Explicit dates win.** A heading like "Next week:" above "Wednesday 30th, Thursday 1st" doesn't add a whole week.
161
+ - **"Good morning" is a greeting**, not a time.
162
+ - **Days already past are left out** and named, never dropped silently. "Wednesday 30th" means the nearest Wednesday that's a 30th, so a message from last week reads as last week.
163
+ - **Words count from today.** For an older message that says "tomorrow", give the days yourself with `--days`.
164
+
165
+ when-free never connects to your mailbox. You paste the message, pipe it in, or save it to a file.
166
+
167
+ <details>
168
+ <summary><b>Let your own language model read the message</b></summary>
169
+
170
+ If you run a model yourself, it can do the reading instead. Add this to the settings file:
171
+
172
+ ```toml
173
+ [extract]
174
+ command = ["ollama", "run", "llama3.2"] # the prompt is sent on standard input
175
+ # command = ["my-cli", "ask", "{prompt}"] # or placed where {prompt} is
176
+ ```
177
+
178
+ The command receives the message and must print JSON: `{"days": ["2026-10-05"], "hours": "10:00-16:00", "minutes": 60}`. If it fails, pattern matching is used instead. Nothing runs unless you configure it, and `--no-extract` skips it for one run. The message goes to whatever that command talks to, so use a local model for private text.
179
+ </details>
180
+
181
+ ## Use it from other tools
182
+
183
+ Every way gives the same answer, only reads, and leaves event titles out unless asked.
184
+
185
+ | Your tool | Use | Set up |
186
+ |---|---|---|
187
+ | Claude Desktop | [One-click extension](https://github.com/YauhenBichel/when-free/blob/main/docs/recipes.md#claude-desktop-in-one-click) | double-click |
188
+ | Claude Code, with a skill that knows when to use it | [Plugin](#claude-code-plugin) | two commands |
189
+ | Claude Code, Cursor, VS Code, any MCP client | [MCP server](#mcp-claude-cursor-and-other-assistants) | one line |
190
+ | Raycast, a right-click on a message (macOS) | [Recipes](https://github.com/YauhenBichel/when-free/blob/main/docs/recipes.md) | a few minutes |
191
+ | Open WebUI, n8n, Shortcuts, Raycast, anything that calls a URL | [Local HTTP server](#http-open-webui-n8n-shortcuts-and-scripts) | `whenfree serve` |
192
+ | Your own agent with function calling | [Schema and call](#function-calling-harnesses) | two commands |
193
+ | Python | [The library](#python) | `import whenfree` |
194
+
195
+ ### Claude Code plugin
196
+
197
+ The plugin bundles the MCP server with a skill that tells Claude when to use it: when you
198
+ ask about your availability, paste a message asking when you can meet, or before it
199
+ proposes a time.
200
+
201
+ ```
202
+ /plugin marketplace add YauhenBichel/when-free
203
+ /plugin install when-free@when-free
204
+ ```
205
+
206
+ Then add your calendar once, if you have not yet: `uvx when-free add`.
207
+
208
+ ### MCP: Claude, Cursor and other assistants
209
+
210
+ ```bash
211
+ claude mcp add when-free -- uvx when-free mcp # Claude Code
212
+ ```
213
+
214
+ For Cursor and other MCP clients, add this to their server list. `uvx` fetches when-free the first time, so there's nothing to install:
215
+
216
+ ```json
217
+ {
218
+ "mcpServers": {
219
+ "when-free": { "command": "uvx", "args": ["when-free", "mcp"] }
220
+ }
221
+ }
222
+ ```
223
+
224
+ If you installed it with `uv tool install`, use `"command": "whenfree", "args": ["mcp"]` instead. It's also listed in the [MCP registry](https://registry.modelcontextprotocol.io) as `io.github.YauhenBichel/when-free`.
225
+
226
+ Then just ask: *"Here's the recruiter's message. Which of those times can I do?"* The assistant calls `free_slots` and answers from your real calendar.
227
+
228
+ | Tool | What it does |
229
+ |---|---|
230
+ | `free_slots` | Free time per day. Takes `days`, or `from` and `to`, or a `message`, plus `hours`, `min_minutes`, `buffer_minutes`, `timezone`, `weekends`, `all_day_busy`, `include_busy` |
231
+ | `check_calendars` | Whether each calendar can be read, with event counts. No details, no addresses |
232
+
233
+ If a tool can't do its job, the assistant gets an error it can read ("could not read the calendar 'work'"), never a guess.
234
+
235
+ ### HTTP: Open WebUI, n8n, Shortcuts and scripts
236
+
237
+ ```bash
238
+ whenfree serve # http://127.0.0.1:8765, only reachable from this computer
239
+ ```
240
+
241
+ ```bash
242
+ curl -H "Authorization: Bearer $(cat ~/.config/when-free/token)" \
243
+ 'http://127.0.0.1:8765/free_slots?days=next%20week&hours=afternoon'
244
+ ```
245
+
246
+ - `POST /free_slots` with a JSON body, or `GET` with a query string. Same for `/check_calendars`.
247
+ - The answer is `{"ok": true, "text": "...", "data": {...}}`, or `{"ok": false, "error": "..."}` with status 400.
248
+ - **OpenAPI** description at `/openapi.json`. To set up Open WebUI, n8n or Shortcuts, see the [recipes](https://github.com/YauhenBichel/when-free/blob/main/docs/recipes.md).
249
+ - **The token** is created on first run and kept in `~/.config/when-free/token`, readable only by you. Or set your own with `WHENFREE_TOKEN`. Every tool call needs it.
250
+ - Requests addressed to any host other than this computer are refused. A web page may call it only from an origin you allow: `whenfree serve --allow-origin http://localhost:3000`. With `--host 0.0.0.0` it's reachable from your network, and the token alone protects it, so use that only on a network you trust.
251
+
252
+ ### Function-calling harnesses
253
+
254
+ ```bash
255
+ whenfree schema # the tool definitions: name, description, inputSchema
256
+ whenfree schema --format openai # the same, as {"type": "function", "function": {...}}
257
+ whenfree call free_slots --args '{"days": "next week", "hours": "10:00-16:00"}'
258
+ ```
259
+
260
+ `whenfree call` prints `{"ok": true, "text": "...", "data": {...}}`, or `{"ok": false, "error": "..."}` with exit code 1. Arguments can also come on standard input.
261
+
262
+ ### Python
263
+
264
+ ```python
265
+ from whenfree import api
266
+
267
+ result = api.find_free(api.Query(days="next week", hours="10:00-16:00", min_minutes=45))
268
+ for day in result["days"]:
269
+ print(day["label"], day["free"]) # for example: Mon 12 Oct [['10:00', '11:45'], ['13:15', '16:00']]
270
+ ```
271
+
272
+ `find_free` returns plain dicts and lists, ready for `json.dumps`, and raises `api.Problem` with a message that's safe to show. Pass `reader=` to supply calendar text yourself instead of fetching it.
273
+
274
+ ## On your other devices
275
+
276
+ | Device | Start with | Guide |
277
+ |---|---|---|
278
+ | iPhone, iPad, Android, watches | `whenfree serve --lan`, then `whenfree devices add "My phone"` and scan the QR code | [Phones and tablets](https://github.com/YauhenBichel/when-free/blob/main/docs/devices.md#phones-and-tablets) |
279
+ | Home Assistant, Alexa, Google Home, Siri, busy lights | `whenfree mqtt --broker mqtt://homeassistant.local` | [Smart home and voice](https://github.com/YauhenBichel/when-free/blob/main/docs/devices.md#smart-home-and-voice) |
280
+ | macOS menu bar, Waybar, i3blocks, Polybar, GNOME, Windows tray | `whenfree now --format xbar` (or `waybar`, `i3blocks`, …) | [Desktop status bars](https://github.com/YauhenBichel/when-free/blob/main/docs/devices.md#desktop-status-bars) |
281
+
282
+ ```console
283
+ $ whenfree now
284
+ Busy until 15:30 · next free 15:45–17:00
285
+ ```
286
+
287
+ Devices see whether you're free and your free slots, never event titles. Each phone has its own token that you can revoke, and an unreadable calendar shows as "unknown", never "free".
288
+
289
+ ## Privacy
290
+
291
+ - **It runs on your computer.** It fetches your calendar feeds and nothing else. It never writes to a calendar and never sends a message.
292
+ - **Your calendar address stays secret.** It's never printed, isn't shown while you paste it, and is stored in a file only you can read. Errors name the calendar ("personal"), never its address.
293
+ - **Assistants see free time, not your events.** Event titles are left out unless the assistant asks with `include_busy`, and that option's description tells the model that titles are private. No tool can add, change or delete anything, and no tool takes a calendar address, which goes from you to `whenfree add` only.
294
+
295
+ ## Settings
296
+
297
+ All optional except a calendar. They live in `~/.config/when-free/config.toml`, and command-line flags win over the file.
298
+
299
+ | Setting | Default | Flag | Meaning |
300
+ |---|---|---|---|
301
+ | `timezone` | your system's | `--tz` | The zone the answer is given in, like `Europe/London` |
302
+ | `hours` | `09:00-18:00` | `--hours` | The part of the day you offer. Also `morning`, `afternoon`, `evening` |
303
+ | `min_minutes` | `60` | `--min` | Shortest slot worth offering |
304
+ | `buffer_minutes` | `15` | `--buffer` | Kept free before and after every event |
305
+ | `weekends` | `false` | `--weekends` | Include Saturday and Sunday in a date range |
306
+ | `all_day_busy` | `false` | `--all-day-busy` | Whole-day events block the day |
307
+ | `days_ahead` | `7` | | Working days shown when you give no dates |
308
+ | `me` | `[]` | | Your email addresses, so invitations you declined don't block |
309
+ | `[[calendar]]` | | `--calendar` | `name` and `url` or `path`. One block per calendar; `whenfree add` writes them |
310
+ | `[extract] command` | none | `--no-extract` | A command that reads a message with your own model |
311
+
312
+ <details>
313
+ <summary><b>Environment variables</b></summary>
314
+
315
+ For scripts, containers and MCP client configurations. All optional.
316
+
317
+ | Variable | Meaning |
318
+ |---|---|
319
+ | `WHENFREE_CALENDARS` | Comma-separated calendar addresses or paths. Replaces the file's list. **Sensitive**: see below |
320
+ | `WHENFREE_CONFIG` | Path to the settings file |
321
+ | `XDG_CONFIG_HOME` | Where the settings file is looked for when `WHENFREE_CONFIG` isn't set: `$XDG_CONFIG_HOME/when-free/config.toml`, otherwise `~/.config/when-free/config.toml` |
322
+ | `WHENFREE_TZ` | The zone the answer is given in. Wins over `timezone` in the file |
323
+ | `TZ` | Your system's zone, used when neither of the above gives one |
324
+ | `WHENFREE_TOKEN` | The token for `whenfree serve`, instead of the token file. **Sensitive** |
325
+ | `WHENFREE_NOW` | An ISO date-time to use as "now", so a run can be reproduced |
326
+
327
+ **`WHENFREE_CALENDARS` holds passwords.** A private calendar address lets anyone who has it read that calendar. Treat the variable like an API key: keep it out of shared shell profiles, committed MCP configurations, CI logs and screenshots. The settings file `whenfree add` writes is readable only by you, so use it instead where you can.
328
+ </details>
329
+
330
+ ## What counts as busy
331
+
332
+ | In your calendar | Blocks time? |
333
+ |---|---|
334
+ | An ordinary event | Yes, plus the buffer on both sides |
335
+ | An event marked **Free** | No |
336
+ | A cancelled event | No |
337
+ | An invitation you declined (your address in `me`) | No |
338
+ | A whole-day event | No, unless `all_day_busy = true`. Then yes, unless it's marked Free |
339
+ | A repeating event | Each occurrence, with skipped dates skipped and moved ones where they were moved to |
340
+
341
+ A slot shorter than `min_minutes` after the buffers isn't offered. For today, the day starts at the next quarter hour, not in the past.
342
+
343
+ ## Limits
344
+
345
+ - **It reads; it doesn't book.** It never writes to a calendar and never sends a message.
346
+ - **It's as fresh as the feed.** Google refreshes the secret address with some delay, so an event added a minute ago may be missing. Run `whenfree --busy` to see what it saw.
347
+ - **Every calendar or none.** If one calendar can't be read, no slots are shown, because busy time would look free.
348
+ - **Repeating events.** Daily, weekly, monthly (by date, or "first Monday", "last Friday") and yearly rules are expanded, with intervals, end dates, counts, skipped dates and moved occurrences. Rarer rules (`BYSETPOS`, week numbers) aren't. For those the first date is blocked and a note says so.
349
+ - **Time zones** come from the events. A zone name the time zone database doesn't know (some Outlook exports) is read in your own zone.
350
+
351
+ ## If something does not work
352
+
353
+ | What you see | What to do |
354
+ |---|---|
355
+ | `No calendar is configured` | Run `whenfree add`. If you edited the file by hand, the `url` line is still empty or the file wasn't saved; the message names the file |
356
+ | `could not read the calendar 'personal' (...)` | The address is incomplete or isn't the secret one; the message says which when it can tell. Copy it again with the copy button |
357
+ | `returned a web page, not a calendar` or `did not return iCalendar data` | That link isn't a calendar feed. It should end in `.ics` |
358
+ | `Nothing was saved` | `whenfree add` couldn't read the calendar, so nothing changed. Fix the address and run it again |
359
+ | No "Secret address" in Google's settings | Your organisation switched it off. Export the calendar instead: see [Google Calendar, step by step](#add-your-calendar) |
360
+ | An event you just added is missing | The feed refreshes with a delay. See [Limits](#limits) |
361
+ | A meeting doesn't block time | Run `whenfree --busy` to see what was read. Declined invitations, events marked Free and whole-day events don't block; see [What counts as busy](#what-counts-as-busy) |
362
+ | `whenfree check` | Says whether every calendar can be read, at any time |
363
+
364
+ ## Development
365
+
366
+ ```bash
367
+ uv run --with pytest pytest -q # a few seconds; no network
368
+ ```
369
+
370
+ The tests use a small calendar in `tests/data/sample.ics` and a fixed clock (`WHENFREE_NOW`). The code is grouped by component:
371
+
372
+ | Component | Holds | May use |
373
+ |---|---|---|
374
+ | `core/` | `ical`, `slots`, `status`, `render`, `errors`: events, busy time, free slots, where you stand now, the wording. No input or output | nothing |
375
+ | `messages/` | `dates`, `extract`: days and hours read out of a message | `core` |
376
+ | `settings/` | `config`: the settings file and environment variables | nothing |
377
+ | `calendars/` | `sources`: calendars fetched from an address or read from a file | `core`, `settings` |
378
+ | `api.py` | `find_free`, `status`, `check_calendars`: the one entry point for every front end | the four above |
379
+ | `agents/` | `tools`, `mcp`: the tools offered to AI agents, and the MCP server | `api`, `core` |
380
+ | `web/` | `server`: the HTTP front end, for tools and phones | `api`, `agents`, `devices`, `calendars`, `core`, `settings` |
381
+ | `devices/` | `widgets`, `pairing`, `feed`, `qr`, `mobile/`: status bars, phone pairing, the calendar feed, the phone page | `api`, `core`, `settings` |
382
+ | `smarthome/` | `mqtt`, `homeassistant`: MQTT publishing with Home Assistant discovery | `api`, `core` |
383
+ | `cli/` | `main`, `demo`: the `whenfree` command | anything |
384
+
385
+ `tests/test_structure.py` fails if a component imports one it may not, so the domain stays free of front ends.
386
+
387
+ See [CONTRIBUTING.md](https://github.com/YauhenBichel/when-free/blob/main/CONTRIBUTING.md).
388
+
389
+ ## Licence
390
+
391
+ Apache-2.0.
@@ -0,0 +1,43 @@
1
+ whenfree/__init__.py,sha256=4U2IR0j_beBACuRcrMbq6nhKCloS-JoGrA9msdV45Qo,123
2
+ whenfree/__main__.py,sha256=1-uTrRowv1W60HFRcyL56ctXCqaSzsaRnygf70wBo04,112
3
+ whenfree/api.py,sha256=P7-xJ8ym80gEL8Y28_mnw4LjJUrMIFnii2LcTMjiwj8,13311
4
+ whenfree/agents/__init__.py,sha256=KlaedJmqWcDPwj7cYlEC78rGs85ksoBEiDkQB2bNIi0,85
5
+ whenfree/agents/mcp.py,sha256=K_t8ZFuLFnkcIWgU_0NSyVHz0U2aBNipAXVd3ESmEvk,3754
6
+ whenfree/agents/tools.py,sha256=Ai_xxhoyTddsmr5G0o5unSaI_uNp3vhnTRtCLhdh2dg,9082
7
+ whenfree/calendars/__init__.py,sha256=3S-EZEIgl5ia5MK8_ZCXAvwaEE4x6QdJJtvvoO6lnak,66
8
+ whenfree/calendars/cache.py,sha256=C6B-vzXadCRUju1D3ICfVBvEvWk2SxPqJ01en6S94ls,2776
9
+ whenfree/calendars/sources.py,sha256=q6Feu8nPBjJGqj7i2TFVLSb0ncrTwib-lerZZ4RCrnc,3227
10
+ whenfree/cli/__init__.py,sha256=xXw4uYi_ZYJZgeEF8xfhkaXFo5RqD5K6rU4eeSKlMms,65
11
+ whenfree/cli/demo.py,sha256=Uvw1Jps795oUOID0pyMQH7Ei8CyurVEbnYtvGjRxnus,3361
12
+ whenfree/cli/main.py,sha256=6caW9fs9B0GHheW7GhTOyW8D2KVxMmMXuvhNBePwOds,19107
13
+ whenfree/core/__init__.py,sha256=IXuOSX7FtydUt4Z8iYpiOMzGe3HkbJJvyU7uSRJgchw,103
14
+ whenfree/core/errors.py,sha256=powCo0-KQDAr4B26dpKp1RY3i3JUpWkeaDGsTmxfV0E,184
15
+ whenfree/core/ical.py,sha256=Qmb6oSOL7w34C4cR68RsZWHKJcAM9WzZOgv3bdHrt3c,12003
16
+ whenfree/core/render.py,sha256=L1h_grBNZxWnXpKfDYK6mdTl2ZcGQ9td7XkThNrIBeg,3359
17
+ whenfree/core/slots.py,sha256=CcfDk7C8ZC0DGib51RcXVVQ7Lc-p4WUisGT3PokjUA8,3829
18
+ whenfree/core/status.py,sha256=x3mWHghRtSjvC2k12k-tOUR_hpXnyyA5lQl-WT0ihtc,3340
19
+ whenfree/devices/__init__.py,sha256=B_GyE74K3VXvEuZaFtJdlrhUuN72WdTDBXa1k7ukHo4,78
20
+ whenfree/devices/feed.py,sha256=-8CKykuV5eSJVuFayxfQ08gOOXx-HiUAk9wE8wUIVD8,2550
21
+ whenfree/devices/pairing.py,sha256=JfQeM6mztdDqKpADqEWxwvyfWfLzbioAQXUIahWB83A,3441
22
+ whenfree/devices/qr.py,sha256=eQOHBYbefJOtyuMXeM9YkM9zxAEJkhNXVLbJXV0yKN8,11287
23
+ whenfree/devices/widgets.py,sha256=0go70LgwgM0KwuvISmmz8g7UUNe6pWbYgNzDri1xq3A,2857
24
+ whenfree/devices/mobile/app.css,sha256=LVwZX7AY--Y0CSK9s9swGcHp3O8Je9pwZIaNX2CyvIQ,2617
25
+ whenfree/devices/mobile/app.js,sha256=uLZA_cqniynJKjTvdoZvXUcfapK8U9t775mywsVXWxg,4869
26
+ whenfree/devices/mobile/icon.svg,sha256=pTZvzV7JcnqUnx15GXgX59syBByqvB_qb95P9K5fzpQ,583
27
+ whenfree/devices/mobile/index.html,sha256=ZHDLU1E8PHoqBYAV5Ym2z2FQXg4i6LK7ooLGmeIuPnM,2125
28
+ whenfree/devices/mobile/manifest.webmanifest,sha256=-s1dc-fmXRmR2paWQSRL8BQimy-L0hn-W8e8qjOtIKI,347
29
+ whenfree/messages/__init__.py,sha256=3NMrU8YGC99ekGnLkekbq3kGVEYXH4IZujmSJCYZOug,113
30
+ whenfree/messages/dates.py,sha256=ffvlOYc7Wpo1JtIEgLZLLXBQFxXFWFO62QXZdSo1X7k,7815
31
+ whenfree/messages/extract.py,sha256=wnkFuAoHLWAtrtce7Eid5Efhwel2calJfSywSDEjwlk,2126
32
+ whenfree/settings/__init__.py,sha256=kF7zd2GVHPqC3nNg7JHZxAEPZAb-eQsqy2oruk-oBNE,296
33
+ whenfree/settings/config.py,sha256=FV6DlRc0NFsD9r1FDpujkEXM1vEtYAOZadhFDUSJQwU,9937
34
+ whenfree/smarthome/__init__.py,sha256=2pFDYYRxDB9myuXub_iIFooqcNSiMIfy6XrAqljFjlk,101
35
+ whenfree/smarthome/homeassistant.py,sha256=1x3MPxTLpzeCWfWU287OwVrREn1AhOoc6SH3o0vgjKc,6844
36
+ whenfree/smarthome/mqtt.py,sha256=wsfrOA3evmR6m8fQDqZ1nxp269u_lp5hbaID68x5iek,5915
37
+ whenfree/web/__init__.py,sha256=q5Gz3PErZcWEsrP1nnMCA8fGWNwGHmR8bwjp5Wor4z8,87
38
+ whenfree/web/server.py,sha256=z-nMlQD3kUa_dEDGjajY1Pzl_71HW-pq7xac4HJw7eM,16481
39
+ when_free-0.4.0.dist-info/METADATA,sha256=m-r0Bd8noIEfYyIQ88RC8URS-irSGYq2qEiLnZckuns,22789
40
+ when_free-0.4.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
41
+ when_free-0.4.0.dist-info/entry_points.txt,sha256=N4sb8vBTWn0ernmPYQEWlnUb1gC7XGK5lYcyKs_kB8c,77
42
+ when_free-0.4.0.dist-info/licenses/LICENSE,sha256=BL9TOJxUFiaGBJir8tIXK0MoMi8Hy2jjLuxak_SuMHQ,11344
43
+ when_free-0.4.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.4
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ when-free = whenfree.cli:main
3
+ whenfree = whenfree.cli:main
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Yauhen Bichel
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
whenfree/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """when-free: which days and times am I free? Answered from calendar feeds, on your own machine."""
2
+
3
+ __version__ = "0.4.0"