-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[docs] Update recommended structure to remove Dagster code from __init__.py
#23316
[docs] Update recommended structure to remove Dagster code from __init__.py
#23316
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @maximearmstrong and the rest of your teammates on Graphite |
__init__.py
__init__.py
a6e9d94
to
44b1d45
Compare
44b1d45
to
c9cd6e3
Compare
5485c9d
to
009d0bb
Compare
@@ -131,7 +132,7 @@ In this example, we grouped resources (e.g., database connections, Spark session | |||
|
|||
In complex projects, we find it helpful to make resources reusable and configured with pre-defined values via <PyObject object="configured" />. This approach allows your teammates to use a pre-defined resource set or make changes to shared resources, thus enabling more efficient project development. | |||
|
|||
This pattern also helps you easily execute jobs in different environments without code changes. In this example, we dynamically defined a code location based on the deployment in [`__init__.py`](https://github.com/dagster-io/dagster/blob/master/examples/project_fully_featured/project_fully_featured/\__init\_\_.py) and can keep all code the same across testing, local development, staging, and production. Read more about our recommendations in the [Transitioning data pipelines from Development to Production](/guides/dagster/transitioning-data-pipelines-from-development-to-production) guide. | |||
This pattern also helps you easily execute jobs in different environments without code changes. In this example, we dynamically defined a code location based on the deployment in [`definitions.py`](https://github.com/dagster-io/dagster/blob/master/examples/project_fully_featured/project_fully_featured/\__init\_\_.py) and can keep all code the same across testing, local development, staging, and production. Read more about our recommendations in the [Transitioning data pipelines from Development to Production](/guides/dagster/transitioning-data-pipelines-from-development-to-production) guide. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maximearmstrong linked PR has been approved if you want to merge / update URL.
fbf7d39
to
df8e566
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left two suggestions, but it's looking good!
@@ -20,20 +20,20 @@ dagster dev -f my_file.py -f my_second_file.py | |||
</TabItem> | |||
<TabItem name="From a module"> | |||
|
|||
Dagster can also load Python modules as [code locations](/concepts/code-locations). When this approach is used, Dagster loads the definitions defined at the top-level of the module, in a variable containing the <PyObject object="Definitions" /> object of its root `__init__.py` file. As this style of development eliminates an entire class of Python import errors, we strongly recommend it for Dagster projects deployed to production. | |||
Dagster can also load Python modules as [code locations](/concepts/code-locations). When this approach is used, Dagster loads the definitions defined in the module passed to the command line. It is recommended to define a variable containing the <PyObject object="Definitions" /> object in a submodule named `definitions` inside the Python module. In practice, the submodule can be created by adding a file named `definitions.py` at the root level of the Python module. As this style of development eliminates an entire class of Python import errors, we strongly recommend it for Dagster projects deployed to production. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dagster can also load Python modules as [code locations](/concepts/code-locations). When this approach is used, Dagster loads the definitions defined in the module passed to the command line. It is recommended to define a variable containing the <PyObject object="Definitions" /> object in a submodule named `definitions` inside the Python module. In practice, the submodule can be created by adding a file named `definitions.py` at the root level of the Python module. As this style of development eliminates an entire class of Python import errors, we strongly recommend it for Dagster projects deployed to production. | |
Dagster can also load Python modules as [code locations](/concepts/code-locations). When this approach is used, Dagster loads the definitions defined in the module passed to the command line. | |
We recommend defining a variable containing the <PyObject object="Definitions" /> object in a submodule named `definitions` inside the Python module. In practice, the submodule can be created by adding a file named `definitions.py` at the root level of the Python module. | |
As this style of development eliminates an entire class of Python import errors, we strongly recommend it for Dagster projects deployed to production. |
Let's break this up a bit - the paragraph is pretty visually dense and there's a lot to take in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 32844cf
df8e566
to
32844cf
Compare
## Summary & Motivation This PR updates the URL to the file containing Definitions in project-fully-featured. That was moved from #23316 to this PR to avoid failure when running the doc tests - the file must exist before being referenced, and it is updated in #23345. ## How I Tested These Changes BK
…it__.py` (#23316) ## Summary & Motivation This PR updates the recommended folder structure to include the Definitions object in `definitions.py` instead of `__init__.py`. It also updates related guides and references. Tutorials in the docs are not yet updated. Will open more PRs: - Update the project in examples/ - Update the tutorials in examples/ - Update tutorials in docs - Update Dag Uni content - Update Dag Uni starter projects once we have a PR for Dag Uni content ## How I Tested These Changes make mdx-full-format
## Summary & Motivation This PR updates the URL to the file containing Definitions in project-fully-featured. That was moved from #23316 to this PR to avoid failure when running the doc tests - the file must exist before being referenced, and it is updated in #23345. ## How I Tested These Changes BK
Summary & Motivation
This PR updates the recommended folder structure to include the Definitions object in
definitions.py
instead of__init__.py
. It also updates related guides and references.Tutorials in the docs are not yet updated. Will open more PRs:
How I Tested These Changes
make mdx-full-format