-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Add source control code references docs (#22319)
## Summary Expands the code references guide to include info on attaching references to git source control on cloud and OSS. ## Test Plan Vercel. --------- Co-authored-by: Sandy Ryza <[email protected]>
- Loading branch information
Showing
8 changed files
with
193 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
30 changes: 30 additions & 0 deletions
30
...ples/docs_snippets/docs_snippets/guides/dagster/code_references/link_to_source_control.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from pathlib import Path | ||
|
||
from dagster import ( | ||
AnchorBasedFilePathMapping, | ||
Definitions, | ||
asset, | ||
link_code_references_to_git, | ||
with_source_code_references, | ||
) | ||
|
||
|
||
@asset | ||
def my_asset(): ... | ||
|
||
|
||
@asset | ||
def another_asset(): ... | ||
|
||
|
||
defs = Definitions( | ||
assets=link_code_references_to_git( | ||
assets_defs=with_source_code_references([my_asset, another_asset]), | ||
git_url="https://github.com/dagster-io/dagster", | ||
git_branch="main", | ||
file_path_mapping=AnchorBasedFilePathMapping( | ||
local_file_anchor=Path(__file__), | ||
file_anchor_path_in_repository="src/repo.py", | ||
), | ||
) | ||
) |
35 changes: 35 additions & 0 deletions
35
...ippets/docs_snippets/guides/dagster/code_references/link_to_source_control_conditional.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
from dagster import ( | ||
AnchorBasedFilePathMapping, | ||
Definitions, | ||
asset, | ||
link_code_references_to_git, | ||
with_source_code_references, | ||
) | ||
|
||
|
||
@asset | ||
def my_asset(): ... | ||
|
||
|
||
@asset | ||
def another_asset(): ... | ||
|
||
|
||
assets = with_source_code_references([my_asset, another_asset]) | ||
|
||
defs = Definitions( | ||
assets=link_code_references_to_git( | ||
assets_defs=assets, | ||
git_url="https://github.com/dagster-io/dagster", | ||
git_branch="main", | ||
file_path_mapping=AnchorBasedFilePathMapping( | ||
local_file_anchor=Path(__file__), | ||
file_anchor_path_in_repository="src/repo.py", | ||
), | ||
) | ||
if bool(os.getenv("IS_PRODUCTION")) | ||
else assets | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5778eb7
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.
Deploy preview for dagster-docs ready!
✅ Preview
https://dagster-docs-55rsaazvp-elementl.vercel.app
https://release-1-7-13.dagster.dagster-docs.io
Built with commit 5778eb7.
This pull request is being automatically deployed with vercel-action