Skip to content

[docs] updates docs to favor @dataclass for component authoring #28900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 4, 2025

Conversation

cmpadden
Copy link
Contributor

Summary & Motivation

Current docs promote __init__ methods for defining YAML schema. This updates the tutorial to use data classes.

How I Tested These Changes

yarn start

Changelog

NOCHANGELOG

@cmpadden cmpadden requested review from neverett and schrockn March 31, 2025 21:15
@cmpadden cmpadden requested a review from OwenKephart April 2, 2025 17:00
Copy link
Contributor

should we add a little bit of docs explanation for the dataclass usage? like make it clear that dataclass usage is optional but gets rid of boilerplate

@schrockn
Copy link
Member

schrockn commented Apr 2, 2025

So I think we should scaffold @dataclass by default (because I don't think most people will care they just want to be able add attributes easily) but then have a flag to opt-out for people who use another system.

@@ -9,17 +9,12 @@
import dagster as dg


@dataclass
@dataclass(frozen=True)
Copy link
Member

Choose a reason for hiding this comment

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

although we use frozen internally our scaffolding does not product it so it might just be confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rebased your changes, and removed the frozen=True.

@OwenKephart I also included a note that this is opt-in, with the ability to pass --no-dataclass.

Copy link
Member

@schrockn schrockn left a comment

Choose a reason for hiding this comment

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

Let's drop frozen and I think you should rebase on my changes

Copy link

github-actions bot commented Apr 4, 2025

Deploy preview for dagit-storybook ready!

✅ Preview
https://dagit-storybook-rfttqgxan-elementl.vercel.app
https://colton-docs-favor-dataclasses-component-authoring.components-storybook.dagster-docs.io

Built with commit 9b1b985.
This pull request is being automatically deployed with vercel-action

Copy link

github-actions bot commented Apr 4, 2025

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-kxmc865hu-elementl.vercel.app
https://colton-docs-favor-dataclasses-component-authoring.core-storybook.dagster-docs.io

Built with commit 9b1b985.
This pull request is being automatically deployed with vercel-action

@cmpadden cmpadden force-pushed the colton/docs/favor-dataclasses-component-authoring branch from 9b1b985 to 97c5683 Compare April 4, 2025 02:46
@cmpadden cmpadden force-pushed the colton/docs/favor-dataclasses-component-authoring branch from 45cf6e1 to 81df8b0 Compare April 4, 2025 02:50
@cmpadden cmpadden requested a review from schrockn April 4, 2025 02:51
Copy link
Member

@schrockn schrockn left a comment

Choose a reason for hiding this comment

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

👍🏻

@cmpadden cmpadden merged commit 9537646 into master Apr 4, 2025
7 checks passed
@cmpadden cmpadden deleted the colton/docs/favor-dataclasses-component-authoring branch April 4, 2025 15:11
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.

3 participants