Install & Compatibility
Where this runs
tested against v0.6.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.026s · 17.8MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.026s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
dataclass
✓ from dataclasses import dataclass
The `types-dataclasses` package provides type stubs for the standard library's `dataclasses` module. User code should import directly from `dataclasses` at runtime. The stub package is consumed by type checkers for static analysis.
field
✓ from dataclasses import field
The `types-dataclasses` package provides type stubs for the standard library's `dataclasses` module. User code should import directly from `dataclasses` at runtime. The stub package is consumed by type checkers for static analysis.
This quickstart demonstrates the standard usage of `dataclasses` with type hints. The `types-dataclasses` package provides the necessary type definitions for static analysis tools to correctly validate such code. No direct import from `types_dataclasses` is required in user code.
from dataclasses import dataclass
from typing import List
@dataclass
class Point:
x: int
y: int
@dataclass
class TaggedItem:
name: str
tags: List[str]
def process_point(p: Point):
print(f"Processing point: ({p.x}, {p.y})")
p = Point(10, 20)
process_point(p)
item = TaggedItem(name="Book", tags=["fiction", "novel"])
print(f"Item: {item.name}, Tags: {', '.join(item.tags)}")
Debug
Known issues
deprecatedThe `types-dataclasses` PyPI package is explicitly marked as unmaintained and will not receive further updates. Stubs for `dataclasses` are now managed directly within the `typeshed` project and are typically bundled with or accessed by modern type checkers (e.g., MyPy, Pyright) automatically, making this separate package redundant.fixRemove `types-dataclasses` from your project's dependencies. Rely on your type checker's built-in `typeshed` integration for standard library stubs.
affects: All versions
breakingPython 3.13 introduces a breaking change in the comparison semantics for `dataclasses.dataclass` instances, specifically concerning the `__eq__` method's implementation. This change may affect code that relies on the exact comparison behavior of dataclasses, particularly when objects are identical in memory.fixReview any custom `__eq__` implementations or code that relies on specific `dataclasses` comparison behavior. Test your code with Python 3.13+ and adjust comparison logic if necessary. Refer to Python's official `dataclasses` documentation and `typeshed` for updated stub behavior.
affects: Python 3.13+
gotchaWhen using `from __future__ import annotations` (which became default in Python 3.10) with earlier Python versions (pre-3.7.6 or pre-3.8.1), inspecting type parameters of `dataclasses`' `__init__` methods could yield unexpected string representations instead of resolved types, hindering introspection-based tools.fixFor older Python versions, ensure you are on a patch release that includes the fix (e.g., 3.7.6+ or 3.8.1+). For modern Python (3.10+), this is no longer an issue as deferred evaluation of annotations is the default and well-supported.
affects: Python 3.7.x (before 3.7.6), Python 3.8.x (before 3.8.1)
gotchaIn Python 3.9, using unparameterized generic types from the `typing` module (e.g., `List` instead of `List[str]`) within `dataclasses` could lead to runtime errors when processed by certain libraries that introspect these types. While `types-dataclasses` provides stubs, the runtime behavior can still be problematic.fixAlways parameterize generic types from the `typing` module in your dataclass definitions (e.g., use `List[str]` instead of `List`). This practice is good for clarity and robustness across Python versions.
affects: Python 3.9
Errors
Common errors & fixes
types-dataclasses unmaintained
Users are encountering information or warnings indicating that the `types-dataclasses` package is no longer actively maintained.
fixThe `types-dataclasses` package is obsolete; its functionality is now provided directly by the `typeshed` project, which is integrated into modern type checkers like MyPy. You should uninstall `types-dataclasses` if it's present in your environment: `pip uninstall types-dataclasses`
error: Module 'dataclasses' has no attribute 'KW_ONLY'
The installed `types-dataclasses` package provides outdated type stubs that do not include definitions for newer `dataclasses` features, such as `KW_ONLY` introduced in Python 3.10, causing type checkers like MyPy to report errors.
fixUninstall the unmaintained `types-dataclasses` package. Modern type checkers rely on the `typeshed` project for up-to-date standard library stubs, which are typically bundled with the type checker itself: `pip uninstall types-dataclasses`
do I need types-dataclasses
Developers are querying whether they should install or keep the `types-dataclasses` package, often after encountering it in older project dependencies or when setting up a new environment, given its unmaintained status.
fixNo, you generally do not need `types-dataclasses`. Type checkers like MyPy, Pyright, and Pylance get their `dataclasses` stubs from the `typeshed` project, which is automatically installed or bundled with them. You should uninstall `types-dataclasses` if it's currently installed: `pip uninstall types-dataclasses`
Upgrade
Version history
0.6.6latest on PyPI · released Jun 30, 2022
Audit
Dependencies
No dependency data recorded yet.