Skip to content

Commit d935e62

Browse files
Merge pull request #42 from pycalendar/docs/rtd-design-and-funding
docs: restructure around Diataxis, add funding acknowledgment, prep release metadata
2 parents 4bf62e2 + 2268fdd commit d935e62

28 files changed

Lines changed: 584 additions & 277 deletions

‎README.md‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
Calendar operations over JMAP (RFC 8620 + draft-ietf-jmap-calendars).
77

8+
Part of the [Python Calendaring Ecosystem](https://pycal.org).
9+
810
[![Documentation](https://readthedocs.org/projects/calendaring-jmap/badge/?version=stable)](https://calendaring-jmap.readthedocs.io/en/stable/)
911
[![Tests](https://github.com/pycalendar/calendaring-jmap/actions/workflows/tests.yml/badge.svg)](https://github.com/pycalendar/calendaring-jmap/actions/workflows/tests.yml)
1012
[![codecov](https://codecov.io/gh/pycalendar/calendaring-jmap/branch/main/graph/badge.svg)](https://codecov.io/gh/pycalendar/calendaring-jmap)
@@ -35,7 +37,7 @@ with get_jmap_client(
3537
print(cal.name)
3638
```
3739

38-
See the [quickstart](https://calendaring-jmap.readthedocs.io/en/latest/usage/quickstart.html) for authentication options, error handling, and configuration from environment variables or a YAML file.
40+
See the [quickstart](https://calendaring-jmap.readthedocs.io/en/latest/tutorials/quickstart.html) for authentication options, error handling, and configuration from environment variables or a YAML file.
3941

4042
## Documentation
4143

@@ -49,7 +51,14 @@ Full documentation: https://calendaring-jmap.readthedocs.io/
4951

5052
## Contributing
5153

52-
See [CONTRIBUTING.md](CONTRIBUTING.md).
54+
See the [contributing guide](https://calendaring-jmap.readthedocs.io/en/latest/contribute.html).
55+
56+
## Funding
57+
58+
This project is funded through [NGI0 Commons Fund](https://nlnet.nl/commonsfund), a fund established by [NLnet](https://nlnet.nl) with financial support from the European Commission's [Next Generation Internet](https://ngi.eu) program. Learn more at the [NLnet project page](https://nlnet.nl/project/Python-Webcalendaring).
59+
60+
[<img src="https://nlnet.nl/logo/banner.png" alt="NLnet foundation logo" width="20%" />](https://nlnet.nl)
61+
[<img src="https://nlnet.nl/image/logos/NGI0_tag.svg" alt="NGI Zero Logo" width="20%" />](https://nlnet.nl/commonsfund)
5362

5463
## License
5564

‎docs/_static/js/custom-icons.js‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// SPDX-FileCopyrightText: 2026 calendaring-jmap contributors
2+
// SPDX-License-Identifier: AGPL-3.0-or-later
3+
4+
FontAwesome.library.add(
5+
/**
6+
* Custom icon definitions
7+
*
8+
* see https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/header-links.html#svg-image-icons
9+
*/
10+
{
11+
prefix: "fa-custom",
12+
iconName: "pypi",
13+
icon: [
14+
17.313,
15+
19.807,
16+
[],
17+
"e001",
18+
// https://simpleicons.org/icons/pypi.svg
19+
"m10.383 0.2-3.239 1.1769 3.1883 1.1614 3.239-1.1798zm-3.4152 1.2411-3.2362 1.1769 3.1855 1.1614 3.2369-1.1769zm6.7177 0.00281-3.2947 1.2009v3.8254l3.2947-1.1988zm-3.4145 1.2439-3.2926 1.1981v3.8254l0.17548-0.064132 3.1171-1.1347zm-6.6564 0.018325v3.8247l3.244 1.1805v-3.8254zm10.191 0.20931v2.3137l3.1777-1.1558zm3.2947 1.2425-3.2947 1.1988v3.8254l3.2947-1.1988zm-8.7058 0.45739c0.00929-1.931e-4 0.018327-2.977e-4 0.027485 0 0.25633 0.00851 0.4263 0.20713 0.42638 0.49826 1.953e-4 0.38532-0.29327 0.80469-0.65542 0.93662-0.36226 0.13215-0.65608-0.073306-0.65613-0.4588-6.28e-5 -0.38556 0.2938-0.80504 0.65613-0.93662 0.068422-0.024919 0.13655-0.038114 0.20156-0.039466zm5.2913 0.78369-3.2947 1.1988v3.8247l3.2947-1.1981zm-10.132 1.239-3.2362 1.1769 3.1883 1.1614 3.2362-1.1769zm6.7177 0.00213-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4124 1.2439-3.2947 1.1988v3.8254l3.2947-1.1988zm-6.6585 0.016195v3.8275l3.244 1.1805v-3.8254zm16.9 0.21143-3.2947 1.1988v3.8247l3.2947-1.1981zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4124 1.2432-3.2947 1.1988v3.8254l3.2947-1.1988zm-6.6585 0.019027v3.8247l3.244 1.1805v-3.8254zm13.485 1.4497-3.2947 1.1988v3.8247l3.2947-1.1981zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm2.4018 0.38127c0.0093-1.83e-4 0.01833-3.16e-4 0.02749 0 0.25633 0.0085 0.4263 0.20713 0.42638 0.49826 1.97e-4 0.38532-0.29327 0.80469-0.65542 0.93662-0.36188 0.1316-0.65525-0.07375-0.65542-0.4588-1.95e-4 -0.38532 0.29328-0.80469 0.65542-0.93662 0.06842-0.02494 0.13655-0.03819 0.20156-0.03947zm-5.8142 0.86403-3.244 1.1805v1.4201l3.244 1.1805z",
20+
],
21+
},
22+
);

‎docs/_templates/404.html‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--- SPDX-FileCopyrightText: 2026 calendaring-jmap contributors -->
2+
<!--- SPDX-License-Identifier: AGPL-3.0-or-later -->
3+
{% extends "!page.html" %}
4+
5+
{%- block htmltitle %}
6+
<title>{{ title|striptags|e }}{%- for parent in parents %} – {{ parent.title }}{%- endfor %}{{ titlesuffix }}</title>
7+
{%- endblock %}
8+
9+
{% block body %}
10+
<div>
11+
<h1>Page not found</h1>
12+
<p>We could not find the page you requested in the calendaring-jmap documentation.</p>
13+
<p>You can <a href="search.html">search</a> the calendaring-jmap documentation.</p>
14+
<h2>Why is this happening?</h2>
15+
<p>
16+
The link you followed may be outdated, or the page may have moved.
17+
If you would like to report an issue or request a redirect be set up, you can <a href="https://github.com/pycalendar/calendaring-jmap/issues/new" rel="external">create a new issue in the GitHub issue tracker</a>.
18+
</p>
19+
</div>
20+
21+
{% endblock %}

‎docs/_templates/nlnet.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<!--- SPDX-FileCopyrightText: 2026 calendaring-jmap contributors -->
2+
<!--- SPDX-License-Identifier: AGPL-3.0-or-later -->
3+
<p>calendaring-jmap is supported through a generous grant from the <a href="https://nlnet.nl/" target="_blank">NLnet Foundation</a>.</p>

‎docs/conf.py‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""Sphinx configuration for calendaring-jmap documentation."""
55

66
import datetime
7+
import os
78

89
project = "calendaring-jmap"
910
this_year = datetime.date.today().year # noqa: DTZ011
@@ -12,13 +13,19 @@
1213

1314
# Extensions
1415
extensions = [
16+
"notfound.extension",
1517
"sphinx.ext.autodoc",
1618
"sphinx.ext.napoleon",
1719
"sphinx.ext.viewcode",
1820
"sphinx.ext.intersphinx",
1921
"sphinx_copybutton",
22+
"sphinx_design",
23+
"sphinx_issues",
2024
]
2125

26+
# sphinx_issues configuration: enables :issue:`N`, :pr:`N`, :user:`name` roles
27+
issues_github_path = "pycalendar/calendaring-jmap"
28+
2229
# Theme configuration
2330
html_theme = "pydata_sphinx_theme"
2431
html_theme_options = {
@@ -28,20 +35,26 @@
2835
"url": "https://github.com/pycalendar/calendaring-jmap",
2936
"icon": "fa-brands fa-square-github",
3037
"type": "fontawesome",
38+
"attributes": {"target": "_blank", "rel": "noopener me"},
3139
},
3240
{
3341
"name": "PyPI",
3442
"url": "https://pypi.org/project/calendaring-jmap",
3543
"icon": "fa-custom fa-pypi",
3644
"type": "fontawesome",
45+
"attributes": {"target": "_blank", "rel": "noopener me"},
3746
},
3847
],
39-
"footer_start": ["copyright"],
48+
"footer_start": ["nlnet", "copyright"],
4049
"footer_end": ["theme-version", "sphinx-version"],
4150
"logo": {"text": "calendaring-jmap"},
4251
"use_edit_page_button": True,
4352
"show_toc_level": 2,
53+
"navbar_align": "content",
54+
"show_nav_level": 1,
4455
"navigation_with_keys": True,
56+
"collapse_navigation": False,
57+
"search_bar_text": "Search documentation",
4558
}
4659

4760
html_context = {
@@ -52,6 +65,18 @@
5265
}
5366

5467
templates_path = ["_templates"]
68+
html_static_path = ["_static"]
69+
# Custom fa-custom/fa-pypi icon used in icon_links above
70+
html_js_files = [("js/custom-icons.js", {"defer": "defer"})]
71+
72+
# notfound.extension configuration
73+
notfound_template = "404.html"
74+
# Defaults to READTHEDOCS_CANONICAL_URL's path on RTD; outside RTD that env
75+
# var isn't set and the extension falls back to a hardcoded "/en/latest/",
76+
# which 404s every asset on a local build. Use root-relative paths instead
77+
# when not building on RTD.
78+
if not os.environ.get("READTHEDOCS"):
79+
notfound_urls_prefix = "/"
5580

5681
# Intersphinx mapping
5782
intersphinx_mapping = {

‎docs/contribute.rst‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ Integration tests, against Cyrus IMAP and Stalwart via Docker:
3636
tests/docker/stalwart/start.sh
3737
pytest src/calendaring_jmap/tests/test_jmap_integration.py
3838
39+
Previewing docs
40+
===============
41+
42+
.. code-block:: bash
43+
44+
pip install -e ".[docs]"
45+
sphinx-autobuild docs docs/_build/html
46+
47+
Opens a local server that rebuilds and reloads the browser tab automatically as you edit files under ``docs/``.
48+
3949
.. _artificial-intelligence-policy:
4050

4151
Artificial intelligence policy
@@ -56,7 +66,7 @@ If your PR changes behavior, add a news fragment. CI-only and internal-refactor
5666
5767
Where ``<type>`` is one of: ``breaking``, ``removal``, ``feature``, ``bugfix``, ``documentation``, ``deps``, ``internal``, ``chore``, ``security``.
5868

59-
Write a short, user-facing description of the change inside the file. Fragments are collected into ``CHANGES.rst`` at release time. Don't edit that file directly.
69+
Write a short, user-facing description of the change inside the file. Reference the issue it closes with the ``:issue:`` role, which links directly to it: :issue:`9` renders as a link to issue 9. Fragments are collected into ``CHANGES.rst`` at release time. Don't edit that file directly.
6070

6171
If you used AI to help write the change, briefly disclose it in the fragment, per the :ref:`artificial-intelligence-policy`.
6272

‎docs/explanation/design.rst‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.. SPDX-FileCopyrightText: 2026 calendaring-jmap contributors
2+
.. SPDX-License-Identifier: AGPL-3.0-or-later
3+
4+
======
5+
Design
6+
======
7+
8+
Why JMAP identity is opaque
9+
===========================
10+
11+
JMAP identifies calendars, events, and tasks by opaque server-assigned IDs, not URLs. This is a real difference from CalDAV, which is URL-addressed: a CalDAV client's identity for an object is the URL it lives at, and moving or renaming a resource can change that URL. A JMAP object's ID stays the same for its lifetime regardless of where the server chooses to store it.
12+
13+
This shapes the client's API: :meth:`~calendaring_jmap.client.JMAPClient.create_event` and similar methods return an ID string, not a URL, and every subsequent lookup, update, or delete uses that ID. There's no separate "fetch the URL, then act on it" step.
14+
15+
Why there's a sync and an async client
16+
======================================
17+
18+
:class:`~calendaring_jmap.async_client.AsyncJMAPClient` mirrors every public method of :class:`~calendaring_jmap.client.JMAPClient` as a coroutine, rather than the library offering only one and asking callers to wrap it. Both share their parsing and request-building logic through a common base class (``_JMAPClientBase``), so the two clients don't duplicate that logic, only the transport call itself differs (blocking request vs. ``await``).
19+
20+
:class:`~calendaring_jmap.objects.calendar.JMAPCalendar` and :class:`~calendaring_jmap.objects.calendar_object.JMAPCalendarObject` need to support both: the same calendar object type is returned whether it came from the sync or the async client, and its methods (``search``, ``add_event``, and similar) need to return a plain value in the sync case and a coroutine in the async case. Python's type system can't narrow a return type based on a runtime flag, so calendaring-jmap uses a generic type parameter on ``JMAPCalendar`` purely for static typing: it lets type checkers give a correctly-typed result depending on whether the calendar came from :meth:`~calendaring_jmap.client.JMAPClient.get_calendars` or :meth:`~calendaring_jmap.async_client.AsyncJMAPClient.get_calendars`, without changing anything at runtime.
21+
22+
Why there's a fixup step
23+
========================
24+
25+
Servers can return iCalendar data that doesn't fully comply with :rfc:`5545`: a missing ``DTSTAMP``, a duplicated line, a date field out of the valid range. calendaring-jmap corrects a small, fixed set of known issues before handing iCalendar strings back to callers, rather than surfacing a parse error for data a real server actually sent. See :doc:`../security` for why these corrections are implemented as simple, non-backtracking regular expressions.

‎docs/how-to/authenticate.rst‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
.. SPDX-FileCopyrightText: 2026 calendaring-jmap contributors
2+
.. SPDX-License-Identifier: AGPL-3.0-or-later
3+
4+
============
5+
Authenticate
6+
============
7+
8+
:func:`~calendaring_jmap.get_jmap_client` reads configuration from, in order: explicit keyword arguments, the ``JMAP_URL``/``JMAP_USERNAME``/``JMAP_PASSWORD`` environment variables, then a YAML config file. If none of those are set, it returns ``None``.
9+
10+
Use environment variables or a config file
11+
==========================================
12+
13+
Environment variables:
14+
15+
.. code-block:: bash
16+
17+
export JMAP_URL=https://jmap.example.com/.well-known/jmap
18+
export JMAP_USERNAME=alice
19+
export JMAP_PASSWORD=secret
20+
21+
Or a YAML config file, at ``~/.config/calendaring-jmap/calendar.yaml`` by default, or a path passed as ``config_file``:
22+
23+
.. code-block:: yaml
24+
25+
url: https://jmap.example.com/.well-known/jmap
26+
username: alice
27+
password: secret
28+
29+
With either in place, no arguments are needed:
30+
31+
.. code-block:: python
32+
33+
client = get_jmap_client()
34+
35+
Use Basic or Bearer auth explicitly
36+
===================================
37+
38+
HTTP Basic auth is used when a ``username`` is supplied alongside a ``password``. Bearer token auth is used when only a ``password`` (token) is given and no username.
39+
40+
.. code-block:: python
41+
42+
# Basic auth
43+
client = get_jmap_client(
44+
url="https://jmap.example.com/.well-known/jmap",
45+
username="alice",
46+
password="secret",
47+
)
48+
49+
# Bearer token (password argument holds the token, no username supplied)
50+
client = get_jmap_client(
51+
url="https://jmap.example.com/.well-known/jmap",
52+
password="my-bearer-token",
53+
)
54+
55+
Use a pre-built auth object
56+
===========================
57+
58+
Pass any ``requests``-compatible auth object directly via the ``auth`` parameter (niquests is API-compatible with requests):
59+
60+
.. code-block:: python
61+
62+
try:
63+
from niquests.auth import HTTPBasicAuth
64+
except ImportError:
65+
from requests.auth import HTTPBasicAuth
66+
client = get_jmap_client(
67+
url="https://jmap.example.com/.well-known/jmap",
68+
auth=HTTPBasicAuth("alice", "secret"),
69+
)
70+
71+
Unlike CalDAV, JMAP does not use a 401 challenge and retry. Credentials are sent on every request, and a 401 or 403 is a hard :class:`~calendaring_jmap.error.JMAPAuthError`.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
.. SPDX-FileCopyrightText: 2026 calendaring-jmap contributors
22
.. SPDX-License-Identifier: AGPL-3.0-or-later
33
4-
=========
5-
Calendars
6-
=========
4+
==============
5+
List calendars
6+
==============
77

88
.. code-block:: python
99
1010
calendars = client.get_calendars()
1111
for cal in calendars:
1212
print(cal.id, cal.name, cal.color)
1313
14-
Each item is a :class:`~calendaring_jmap.objects.calendar.JMAPCalendar` dataclass. The fields are ``id``, ``name``, ``description``, ``color`` (a CSS string or ``None``), ``is_subscribed``, ``my_rights`` (a dict), ``sort_order``, and ``is_visible``.
14+
Each item is a :class:`~calendaring_jmap.objects.calendar.JMAPCalendar`; see :doc:`../reference/objects` for its fields.

‎docs/how-to/errors.rst‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.. SPDX-FileCopyrightText: 2026 calendaring-jmap contributors
2+
.. SPDX-License-Identifier: AGPL-3.0-or-later
3+
4+
=============
5+
Handle errors
6+
=============
7+
8+
All calendaring-jmap errors extend :class:`~calendaring_jmap.error.JMAPBaseError`, and the JMAP-specific ones extend :class:`~calendaring_jmap.error.JMAPError`, which adds an ``error_type`` string. See :doc:`../explanation/design` for why the hierarchy is shaped this way.
9+
10+
Catch specific error types
11+
==========================
12+
13+
.. code-block:: python
14+
15+
from calendaring_jmap.error import (
16+
JMAPAuthError,
17+
JMAPCapabilityError,
18+
JMAPError,
19+
JMAPMethodError,
20+
)
21+
22+
try:
23+
event_id = client.create_event(calendar_id, ical)
24+
except JMAPAuthError:
25+
print("Authentication failed (401/403)")
26+
except JMAPCapabilityError:
27+
print("Server does not support urn:ietf:params:jmap:calendars")
28+
except JMAPMethodError as e:
29+
print(f"Server rejected the request: {e.error_type}, {e.reason}")
30+
except JMAPError as e:
31+
print(f"Protocol error: {e}")
32+
33+
See :doc:`../reference/errors` for what each error class means and the full list of JMAP method error types.

0 commit comments

Comments
 (0)