Skip to content

Support Python 3.14 template strings in formatter#1923

Draft
alexmojaki wants to merge 2 commits into
mainfrom
codex/python314-template-lint
Draft

Support Python 3.14 template strings in formatter#1923
alexmojaki wants to merge 2 commits into
mainfrom
codex/python314-template-lint

Conversation

@alexmojaki
Copy link
Copy Markdown
Collaborator

Summary

  • run the lint job with Python 3.14 so pyright can resolve string.templatelib
  • add guarded runtime support for Python 3.14 template strings in the formatter
  • cover template string formatting and conversion errors

Tests

  • uv run --python 3.14 pyright
  • uv run --python 3.14 pytest tests/test_formatter.py -q
  • uv run --python 3.14 pre-commit run --files .github/workflows/main.yml logfire/_internal/formatter.py tests/test_formatter.py

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 12, 2026

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: aae9c86
Status: ✅  Deploy successful!
Preview URL: https://3fa3e451.logfire-docs.pages.dev
Branch Preview URL: https://codex-python314-template-lin.logfire-docs.pages.dev

View logs

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 0 potential issues.

View 2 additional findings in Devin Review.

Open in Devin Review

spec: NotRequired[str]


def is_template_string(format_string: object) -> TypeGuard[Template]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should then be able to drop the assert isinstance(format_string, str) call below:

Suggested change
def is_template_string(format_string: object) -> TypeGuard[Template]:
def is_template_string(format_string: object) -> TypeIs[Template]:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is ai slop, ignore for now

@alexmojaki alexmojaki marked this pull request as draft May 12, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants