Skip to content

Read the config file through calendaring-config - #804

Merged
tobixen merged 4 commits into
masterfrom
test-key-prefix-786
Oct 20, 2026
Merged

tobixen merged 4 commits into
masterfrom
test-key-prefix-786

Conversation

@tobixen

@tobixen tobixen commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Disclaimer: AI-generated code and text below the line, generated by Claude Opus 5.5, from the prompts:

Fix issue #786 [https://github.com//issues/786]
Wasn't the main thing in issue #786 to drop the configuration parsing from the caldav library and take in the new calendaring-config as a dependency?
The changes a, b, c, d, e listed above is minor and/or to be regarded as bugfixed, isn't it? The difference f needs to be explained better. This will be 3.6, not 3.5.x. [a-e: empty file used, unmatched contains warns, unmatched glob or missing/disabled named section is an error, disabled meta-section drops its members, * means leaf sections; f: fewer CALDAV_* variables read]
go for A [drop the CALDAV_* variables the spec does not list]. Why not browse through the environment for CALDAV_* and populate the configuration with it? All of those are valid configuration settings and it should be possible to override them through the environment. Except CALDAV_AUTH, since auth is an object and not a string.
Releasing calendaring-config v0.2 is cheap. Scanning the environment for CALDAV_-parameters is a cheap operation, isn't it? Passing CALDAV_PASWORD should be equivalent of setting pasword in the configuration file, and the caldav library should probably give an error if there are things in the config it doesn't understand? Even if calendaring-config reads and parses the configuration file, I think it's up to the backend to validate it?
Warn is better than error indeed, and allowing x_
to pass is a good idea.


For caldav 3.6. The config file is shared with plann and calendaring, and its format now lives in calendaring-config; caldav reads it through that package instead of its own parser. Users get kind: caldav sections, password_command / password_keyring, ~/.config/pycal/calendar.yaml, and CALDAV_* variables that override the file key by key (which also fixes #780). Keys starting with test_ are reserved for test tooling, so testing_allowed and priority become test_allowed and test_priority, with the old names deprecated. The behaviour changes for existing files are listed in changes/+calendaring-config.changed.md.

Closes #786

Closes #780
Closes #704

Comment thread caldav/config.py Dismissed
Programs sharing the caldav config file (like calendaring) drop keys
starting with test_, so the test-server selection now reads
test_allowed and test_priority.  testing_allowed and priority still
work with a DeprecationWarning, which pytest shows but does not fail
on.  A priority set in the main config file was silently ignored
before; it is now honoured.

#786

Prompt: Fix issue #786 [#786]

Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
The config file is shared with plann and calendaring, and its format now
lives in calendaring-config, so caldav reads it through that package.
kind: sections, password_command/keyring and the pycal path come for
free, and CALDAV_* variables override keys one by one, fixing
#780.  plann's helper
extract_conn_params_from_section and the test-server lookup read the new
format too.  Unknown keys are warned about; expand_config_section now
raises for a missing or disabled section named explicitly.

#786

Prompt: Wasn't the main thing in issue #786 [#786] to drop the configuration parsing from the caldav library and take in the new calendaring-config as a dependency?
Followup-Prompt: The changes a, b, c, d, e listed above is minor and/or to be regarded as bugfixed, isn't it?  The difference f needs to be explained better.  This will be 3.6, not 3.5.x. [a-e: empty file used, unmatched contains warns, unmatched glob or missing/disabled named section is an error, disabled meta-section drops its members, * means leaf sections; f: fewer CALDAV_* variables read]
Followup-Prompt: go for A [drop the CALDAV_* variables the spec does not list].  Why not browse through the environment for CALDAV_* and populate the configuration with it?  All of those are valid configuration settings and it should be possible to override them through the environment.  Except CALDAV_AUTH, since auth is an object and not a string.
Followup-Prompt: Releasing calendaring-config v0.2 is cheap.  Scanning the environment for CALDAV_*-parameters is a cheap operation, isn't it?  Passing CALDAV_PASWORD should be equivalent of setting pasword in the configuration file, and the caldav library should probably give an error if there are things in the config it doesn't understand?  Even if calendaring-config reads and parses the configuration file, I think it's up to the backend to validate it?
Followup-Prompt: Warn is better than error indeed, and allowing x_* to pass is a good idea.

Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
test_get_davclient_missing_url cleared the environment to get "no
configuration", which worked while caldav's own parser fell back to /
without HOME.  calendaring-config finds the home directory through
Path.home(), which does not need HOME, so the test read the developer's
own config file and failed.  A shared no_config_files fixture now points
HOME and the system paths at an empty directory and clears the config
variables; the issue 786 unit tests use it too.

Prompt: Please fix the test_get_davclient_missing_url, it reads my personal calendar config file and fails because of it

Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
Merging the switch to calendaring-config with the async factory rework
left the two modes apart: a named section that is missing, a glob that
matches nothing, or a section with bad headers raised in sync
get_calendars() but was logged and skipped by the async one under
raise_errors=False.  Resolving the targets does not connect, so what
fails there is the configuration, not a server: async now lets it
through, as sync always did.

Prompt: [fix issues found during the review process of merging #804]

Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
@tobixen
tobixen force-pushed the test-key-prefix-786 branch from 3098a6c to 0956619 Compare October 20, 2026 00:28
@tobixen
tobixen merged commit c5bed91 into master Oct 20, 2026
19 checks passed
@tobixen
tobixen deleted the test-key-prefix-786 branch October 20, 2026 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant