Use import dagster as dg
in our examples and documentation
#23941
Closed
PedramNavid
started this conversation in
Ideas
Replies: 1 comment
-
Closing the loop here -- given there has not been any push back, and have had generally positive reaction to this change, we will be making this change in our new docs site. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In this PR, we've started using
dagster as dg
as an import: #23864 (comment)The main benefits of this approach vs the traditional method importing objects directly into the namespace are:
There is prior art in many libraries of this approach, notably
pandas
,sklearn
,numpy
,matplotlib
,pytest
and many other packages that export many objects.Fewer import lines in code samples/snippets. Compare the first image which is 12 lines shorter. This makes code easier for users to understand parse.
In VS Code, for example, typing
dg.sensor
and pressing Ctrl+Space provides you with all the exported Sensor-like objectsCompare to typing
sensor
instead withimport dagster
We can always revert this change in the future by searching the examples for
dg.
if we decide this approach is fundamentally broken.Easier to write docs/examples as you do not need to constantly add/remove imports from your code blocks as you develop.
We have also seen some slight positive community feedback.
Some risks include:
There may be other benefits and risks I have missed. Opening this up for discussion before we fully commit to making this change.
Beta Was this translation helpful? Give feedback.
All reactions