Skip to content

deprecate escape_string and unescape_string for icalendar 8#1308

Merged
niccokunzmann merged 2 commits intocollective:mainfrom
mvanhorn:fix/deprecate-private-functions
Apr 4, 2026
Merged

deprecate escape_string and unescape_string for icalendar 8#1308
niccokunzmann merged 2 commits intocollective:mainfrom
mvanhorn:fix/deprecate-private-functions

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

@mvanhorn mvanhorn commented Apr 3, 2026

Summary

Renames escape_string and unescape_string to private _escape_string and _unescape_string, with deprecated public wrappers that emit DeprecationWarning.

Why this matters

Per the maintainer's request in #1011, functions not in the public API (icalendar.__all__) should be prefixed with _. External callers get a deprecation warning pointing them to contact maintainers before removal in icalendar 8.

Changes

Follows the same pattern already established for escape_char/unescape_char:

  • src/icalendar/parser/string.py: Renamed implementations to _escape_string and _unescape_string. Added deprecated wrappers. Updated __all__.
  • src/icalendar/parser/content_line.py: Updated imports and call sites to use private versions.
  • src/icalendar/parser/property.py: Updated import and call sites.
  • src/icalendar/parser/__init__.py: Added private names to imports and __all__.
  • CHANGES.rst: Added changelog entry under 7.0.4 Minor changes.

Testing

  • Internal callers use the private functions directly (no deprecation warnings in normal operation)
  • External callers using escape_string/unescape_string will see DeprecationWarning
  • The deprecated wrappers delegate to the private implementations, so behavior is unchanged

Partial fix for #1011

This contribution was developed with AI assistance (Claude Code).


📚 Documentation preview 📚: https://icalendar--1308.org.readthedocs.build/

Rename escape_string -> _escape_string and unescape_string ->
_unescape_string. Add deprecated wrappers that emit
DeprecationWarning for external callers. Update all internal
imports to use the private versions.

Follows the same pattern used for escape_char/unescape_char.

Partial fix for collective#1011
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community bot commented Apr 3, 2026

Documentation build overview

📚 icalendar | 🛠️ Build #32120224 | 📁 Comparing 5762a1e against latest (b3c7df9)

  🔍 Preview build  

Show files changed (7 files in total): 📝 7 modified | ➕ 0 added | ➖ 0 deleted
File Status
404.html 📝 modified
reference/changelog.html 📝 modified
reference/api/icalendar.parser.property.html 📝 modified
reference/api/icalendar.parser.string.html 📝 modified
_modules/icalendar/parser/content_line.html 📝 modified
_modules/icalendar/parser/property.html 📝 modified
_modules/icalendar/parser/string.html 📝 modified

Copy link
Copy Markdown
Member

@niccokunzmann niccokunzmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks perfect!

@niccokunzmann niccokunzmann enabled auto-merge April 4, 2026 17:44
@niccokunzmann niccokunzmann disabled auto-merge April 4, 2026 19:58
@niccokunzmann niccokunzmann enabled auto-merge April 4, 2026 19:59
@niccokunzmann niccokunzmann merged commit f4aaa99 into collective:main Apr 4, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants