{"id":5086,"library":"types-dataclasses","title":"Typing Stubs for Dataclasses","description":"This package provides PEP 561 compliant type stubs for the standard library's `dataclasses` module. It enables static type checkers like MyPy, PyCharm, or pytype to correctly analyze code that utilizes dataclasses by providing type definitions. The current version is 0.6.6. It is important to note that this specific `types-dataclasses` package is unmaintained and will not receive further updates; all fixes and contributions for `dataclasses` stubs are now managed directly within the `typeshed` project.","status":"deprecated","version":"0.6.6","language":"python","source_language":"en","source_url":"https://github.com/python/typeshed","tags":["typing","stubs","dataclasses","typeshed","static analysis"],"install":[{"cmd":"pip install types-dataclasses","lang":"bash","label":"Install types-dataclasses (Deprecated)"}],"dependencies":[],"imports":[{"note":"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.","symbol":"dataclass","correct":"from dataclasses import dataclass"},{"note":"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.","symbol":"field","correct":"from dataclasses import field"}],"quickstart":{"code":"from dataclasses import dataclass\nfrom typing import List\n\n@dataclass\nclass Point:\n    x: int\n    y: int\n\n@dataclass\nclass TaggedItem:\n    name: str\n    tags: List[str]\n\ndef process_point(p: Point):\n    print(f\"Processing point: ({p.x}, {p.y})\")\n\np = Point(10, 20)\nprocess_point(p)\n\nitem = TaggedItem(name=\"Book\", tags=[\"fiction\", \"novel\"])\nprint(f\"Item: {item.name}, Tags: {', '.join(item.tags)}\")\n","lang":"python","description":"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."},"warnings":[{"fix":"Remove `types-dataclasses` from your project's dependencies. Rely on your type checker's built-in `typeshed` integration for standard library stubs.","message":"The `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.","severity":"deprecated","affected_versions":"All versions"},{"fix":"Review 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.","message":"Python 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.","severity":"breaking","affected_versions":"Python 3.13+"},{"fix":"For 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.","message":"When 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.","severity":"gotcha","affected_versions":"Python 3.7.x (before 3.7.6), Python 3.8.x (before 3.8.1)"},{"fix":"Always 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.","message":"In 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.","severity":"gotcha","affected_versions":"Python 3.9"}],"env_vars":null,"search_vec":"'0.6.6':45 '561':9 'analysi':86 'analyz':32 'checker':24 'code':33 'compliant':10 'contribut':69 'correct':31 'current':42 'dataclass':4,18,36,56,71,83 'definit':40 'direct':76 'enabl':21 'fix':67 'import':48 'librari':16 'like':25 'manag':75 'modul':19 'mypi':26 'note':50 'packag':6,57 'pep':8 'project':80 'provid':7,38 'pycharm':27 'pytyp':29 'receiv':63 'specif':53 'standard':15 'static':22,85 'stub':2,12,72,82 'type':1,11,23,39,55,81 'types-dataclass':54 'typesh':79,84 'unmaintain':59 'updat':65 'util':35 'version':43 'within':77","created_at":"2026-04-12T16:53:29.245370+00:00","updated_at":"2026-04-16T23:34:36.538629+00:00","problems":[{"fix":"The `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`","cause":"Users are encountering information or warnings indicating that the `types-dataclasses` package is no longer actively maintained.","error":"types-dataclasses unmaintained"},{"fix":"Uninstall 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`","cause":"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.","error":"error: Module 'dataclasses' has no attribute 'KW_ONLY'"},{"fix":"No, 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`","cause":"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.","error":"do I need types-dataclasses"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.6.6","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/typeshed-internal/stub_uploader","docs":null,"changelog":"https://github.com/typeshed-internal/stub_uploader/blob/main/data/changelogs/dataclasses.md","pypi":"https://pypi.org/project/types-dataclasses/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}