Skip to content

DeprecationWarning: codecs.open() deprecated in Python 3.14 #429

@kwag93

Description

@kwag93

Context

When building a Zensical site with Python 3.14, a DeprecationWarning is emitted from the emoji extension on every icon load.

Bug description

codecs.open() was deprecated in CPython 3.14 (python/cpython#133036, merged 2025-04-30). The _load() function in python/zensical/extensions/emoji.py uses codecs.open(file, encoding="utf-8"), which triggers a DeprecationWarning on every SVG icon load:

python/zensical/extensions/emoji.py:83: DeprecationWarning: codecs.open() is deprecated. Use open() instead.

The fix is to replace codecs.open() with the built-in open(), which has supported the encoding parameter since Python 3.0 and is safe for the full supported range (>=3.10).

References:

Related links

Reproduction

No .zip needed — this is reproducible with any Zensical project that uses emoji/icons on Python 3.14.

  1. Install Python 3.14
  2. pip install zensical==0.0.25
  3. Run python -W all -c "from zensical.extensions.emoji import _load; _load('any_svg_file.svg')"
  4. Observe DeprecationWarning

Steps to reproduce

  1. Install Python 3.14.3
  2. Install zensical 0.0.25: pip install zensical
  3. Create or use any zensical project with icons/emojis
  4. Run zensical build with warnings enabled (python -W all)
  5. Observe: DeprecationWarning: codecs.open() is deprecated. Use open() instead. from emoji.py:83

Browser

No response

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    change requestIssue requests a new feature or improvementresolvedIssue is resolved, yet unreleased if open

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions