Skip to content

Conversation

@srnnkls
Copy link
Contributor

@srnnkls srnnkls commented Oct 26, 2025

tagline

  • Expand README with definition, proxy vs non-proxy lifecycle, examples, and guidance
  • Update project description to "Type-safe templating for python"

tagline

- Expand README with definition, proxy vs non-proxy lifecycle, examples, and guidance
- Update project description to "Type-safe templating for python"
@gemini-code-assist
Copy link

Summary of Changes

Hello @srnnkls, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily enhances the documentation for the deigma templating library by providing a comprehensive guide to its template lifecycle. It clarifies the processes involved during template definition, instantiation, and rendering, especially highlighting the differences and benefits of using the default SerializationProxy versus disabling it. Additionally, the project's high-level description has been refined across key configuration files to better reflect its purpose.

Highlights

  • Template Lifecycle Documentation: The README.md has been significantly expanded to include a detailed explanation of the template lifecycle, covering what happens at definition time, and differentiating between the behavior with and without SerializationProxy, complete with examples and use cases.
  • Project Description Refinement: The project description has been updated in both README.md and pyproject.toml for improved clarity and consistency, now stating 'Type-safe templating for python'.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request significantly improves the documentation by adding a detailed explanation of the template lifecycle, which is a great addition for users of the library. The new content is well-structured and clarifies the differences between using and not using SerializationProxy. I've provided a couple of suggestions to make the code examples in the new documentation self-contained and runnable, which should improve the user experience.

Comment on lines +305 to +306
from pydantic import PlainSerializer
from typing import Annotated

Choose a reason for hiding this comment

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

medium

This code example is missing some necessary imports (dataclass and template). To make it easier for users to copy and run the code, it's best to include all required imports.

Suggested change
from pydantic import PlainSerializer
from typing import Annotated
from dataclasses import dataclass
from deigma import template
from pydantic import PlainSerializer
from typing import Annotated

Comment on lines +359 to +379
@template("{{ user }}", use_proxy=False)
class UserTemplate:
user: User

t = UserTemplate(user=User(first_name="Li", last_name="Si"))
# At this point, nothing is serialized yet

str(t) # Serialization happens here
# If you call str(t) again, serialization runs again

# Note: In templates with loops/conditionals, you lose type info:
@template(
"""
{% for keyword in keywords %}
- {{ keyword.name }} {# keyword is now a plain dict, not SQLKeyword #}
{% endfor %}
""",
use_proxy=False
)
class ListTemplate:
keywords: list[SQLKeyword]

Choose a reason for hiding this comment

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

medium

This example uses User and SQLKeyword types without defining them, and is also missing the import for @template. This makes the example incomplete and could be confusing for readers. I suggest adding minimal definitions for these types and the necessary import to make the snippet self-contained and runnable.

from dataclasses import dataclass
from deigma import template

# Assuming User and SQLKeyword are defined as dataclasses for this example
@dataclass
class User:
    first_name: str
    last_name: str

@dataclass
class SQLKeyword:
    name: str
    description: str


@template("{{ user }}", use_proxy=False)
class UserTemplate:
    user: User

t = UserTemplate(user=User(first_name="Li", last_name="Si"))
# At this point, nothing is serialized yet

str(t)  # Serialization happens here
# If you call str(t) again, serialization runs again

# Note: In templates with loops/conditionals, you lose type info:
@template(
    """
    {% for keyword in keywords %}
    - {{ keyword.name }}  {# keyword is now a plain dict, not SQLKeyword #}
    {% endfor %}
    """,
    use_proxy=False
)
class ListTemplate:
    keywords: list[SQLKeyword]

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