Frozen dataclasses: sealable

Open
#589 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

No files, tests, or entry points are named in the issue. Start by locating the project's dataclass-related implementation and test conventions, then assess how the requested Python 3.9 behavior and sealable-field semantics can be specified and verified.

Written by the indexing model from the issue text.

Description

Task:
Provide a structured summary and action plan for implementing a Python 3.9-compatible function, frozen_dataclass_sealable(). This function should emulate frozen dataclasses but uniquely allow inheritance between frozen and non-frozen dataclasses. Ensure the proposed implementation explicitly addresses the provided test requirements.

Constraints and Clarifications:

  • Clearly indicate complexity or feasibility concerns (rated on a scale from 1 to 10) if certain test requirements—such as implementing __slots__—are too complex or impractical to satisfy.
  • Simplicity and practicality are prioritized. It is acceptable to impose limitations, such as not achieving complete immutability (true freezing), particularly regarding mutable attributes like lists.

Non-negotiable Requirements:

# Requirement Clarification
1 Field inheritance between frozen and non-frozen dataclasses must be supported Derived classes should inherit and extend fields without restriction from frozen parents
2 Full compatibility with type annotations and static type analysis (auto-completion, IDE support) Type hints and static checks (e.g., mypy) must remain fully accurate and reliable
3 Python 3.9+ compatibility required No backward compatibility below Python 3.9 necessary

Concept Explanation: "Sealable Fields":
A "sealable field" is temporarily mutable during initialization, specifically within the context of __post_init__(). After initialization (seal()), these fields become effectively immutable. Static type checkers and IDE tools should treat these fields as read-only outside the initialization phase.
The rationale is to allow complex object graphs and circular or bi-directional dependencies to be resolved naturally during __post_init__() initialization.

Dominant language
Python
Stars
1.2k
Forks
127
Avg merge
2h 13m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tmux-python/libtmux

All issues in tmux-python/libtmux

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.