Skip to content

Modernize type hints in core/ module to Python 3.12+ syntax #44

@davidpoblador

Description

@davidpoblador

Summary

The core module uses legacy typing imports that can be replaced with Python 3.12+ built-in syntax.

Files to update

  • src/blogtuner/core/post.py
  • src/blogtuner/core/blog.py

Current imports

from typing import Any, Dict, List, Optional, Self

Proposed changes

Replace:

  • Dict[str, Any]dict[str, Any]
  • List[str]list[str]
  • Optional[str]str | None
  • Keep Self from typing (still required)
  • Keep Any from typing (still required)

Example change

# Before
from typing import Any, Dict, List, Optional, Self
DEFAULT_POST_METADATA: Dict[str, Any] = {}

# After
from typing import Any, Self
DEFAULT_POST_METADATA: dict[str, Any] = {}

Priority

Medium

Note

Self still requires import from typing module in Python 3.12+. The project already uses Self correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions