Skip to content
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] Add source control code references docs #22319

Merged
merged 8 commits into from
Jul 9, 2024

Conversation

benpankow
Copy link
Member

Summary

Expands the code references guide to include info on attaching references to git source control on cloud and OSS.

Test Plan

Vercel.

@graphite-app graphite-app bot requested a review from erinkcochran87 June 6, 2024 15:05
@graphite-app graphite-app bot added the area: docs Related to documentation in general label Jun 6, 2024
@benpankow
Copy link
Member Author

benpankow commented Jun 6, 2024

@benpankow benpankow force-pushed the benpankow/guide-code-references-dbt branch from 305e92c to 918f3c4 Compare June 6, 2024 15:11
@benpankow benpankow force-pushed the benpankow/code-references-git branch from 9e225d2 to 7f93139 Compare June 6, 2024 15:11
@benpankow benpankow requested a review from sryza June 6, 2024 15:12
@benpankow benpankow force-pushed the benpankow/code-references-git branch from 7f93139 to cebed80 Compare June 6, 2024 15:22
@benpankow benpankow force-pushed the benpankow/guide-code-references-dbt branch from 875b084 to ac47dcd Compare June 7, 2024 17:30
@benpankow benpankow force-pushed the benpankow/code-references-git branch 2 times, most recently from 3a9a88a to 29b779b Compare June 7, 2024 17:38
@benpankow benpankow force-pushed the benpankow/guide-code-references-dbt branch from f4e6d8e to 6ce81f3 Compare June 7, 2024 22:06
@benpankow benpankow force-pushed the benpankow/code-references-git branch from 29b779b to e9156bb Compare June 7, 2024 22:06
@benpankow benpankow force-pushed the benpankow/guide-code-references-dbt branch from 6ce81f3 to 0cac947 Compare July 2, 2024 18:13
@benpankow benpankow force-pushed the benpankow/code-references-git branch from e9156bb to 12f6271 Compare July 2, 2024 18:13
@benpankow benpankow force-pushed the benpankow/guide-code-references-dbt branch from 0cac947 to acff923 Compare July 2, 2024 20:04
@benpankow benpankow force-pushed the benpankow/code-references-git branch from 12f6271 to 89eb430 Compare July 2, 2024 20:05
@benpankow benpankow force-pushed the benpankow/guide-code-references-dbt branch from acff923 to 2f34c5b Compare July 3, 2024 20:46
@benpankow benpankow force-pushed the benpankow/code-references-git branch 2 times, most recently from 021df7a to 080127d Compare July 3, 2024 20:54
@benpankow benpankow force-pushed the benpankow/guide-code-references-dbt branch 2 times, most recently from ae49538 to 87722d6 Compare July 8, 2024 20:47
Base automatically changed from benpankow/guide-code-references-dbt to master July 8, 2024 20:49
@benpankow benpankow force-pushed the benpankow/code-references-git branch 3 times, most recently from eb645c2 to b774d69 Compare July 8, 2024 23:01
@benpankow benpankow force-pushed the benpankow/code-references-git branch from b774d69 to 348d2c2 Compare July 9, 2024 19:15
Copy link
Contributor

@sryza sryza left a comment

Choose a reason for hiding this comment

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

Two comments - otherwise looks good to go!

docs/content/guides/dagster/code-references.mdx Outdated Show resolved Hide resolved

### In Dagster Plus

If using Dagster Plus, you can use the `link_code_references_to_git_if_cloud` utility to conditionally convert local file code references to source control links. This utility will automatically detect if your code is running in a Dagster Cloud environment and convert local file code references to source control links, pointing at the commit hash of the code running in the current deployment.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use PyObject to link to the API doc?

Copy link
Member Author

Choose a reason for hiding this comment

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

As below - cloud packages aren't worked into the docs build


If using Dagster Plus, you can use the `link_code_references_to_git_if_cloud` utility to conditionally convert local file code references to source control links. This utility will automatically detect if your code is running in a Dagster Cloud environment and convert local file code references to source control links, pointing at the commit hash of the code running in the current deployment.

```python
Copy link
Contributor

Choose a reason for hiding this comment

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

This snippet should go in a .py file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right now our docs build doesn't include cloud packages, so this won't work in a snippet file. Can file as a todo?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah - worth adding a comment to explain why we're doing this.

Copy link
Contributor

@sryza sryza left a comment

Choose a reason for hiding this comment

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

Looks good, but heed final comments.

Also, do we have these in an rst file?

docs/content/guides/dagster/code-references.mdx Outdated Show resolved Hide resolved
docs/content/guides/dagster/code-references.mdx Outdated Show resolved Hide resolved
@@ -27,7 +27,7 @@ To complete the steps in this guide, you'll need:

---

## Automatically attaching code references to asset definitions
## Automatically attaching local file code references to asset definitions

### Assets defined in Python

Copy link
Contributor

Choose a reason for hiding this comment

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

I can't comment on the line below, but we should use PyObject and avoid an import that goes through a private path.

Copy link
Contributor

@sryza sryza left a comment

Choose a reason for hiding this comment

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

Oops, meant to approve on that last one (but heed final comments)

@benpankow benpankow force-pushed the benpankow/code-references-git branch from 5c16d82 to 9615f76 Compare July 9, 2024 21:11
@benpankow benpankow merged commit b6b57e0 into master Jul 9, 2024
1 of 2 checks passed
@benpankow benpankow deleted the benpankow/code-references-git branch July 9, 2024 21:53
benpankow added a commit that referenced this pull request Jul 9, 2024
## 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]>
Copy link
Contributor

@PedramNavid PedramNavid left a comment

Choose a reason for hiding this comment

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

Late to the game but these docs still need work before we can publish 1.8 I think? None of the API links work.


### Assets defined in Python

To automatically attach code references to Python assets' function definitions, you can use the `dagster._core.definitions.metadata.with_source_code_references` utility. Any asset definitions passed to the utility will have their source file attached as metadata.
To automatically attach code references to Python assets' function definitions, you can use the <PyObject module="dagster" object="with_source_code_references"/> utility. Any asset definitions passed to the utility will have their source file attached as metadata.
Copy link
Contributor

Choose a reason for hiding this comment

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

This PyObject link doesn't work

@@ -65,7 +65,7 @@ Dagster's dbt integration can automatically attach references to the SQL files b

Copy link
Contributor

Choose a reason for hiding this comment

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

A link to the asset's source in `with_source_code_references.py` will then be visible in the **Asset Catalog** view in the Dagster UI:

There's no reference to with_source_code_references.py in the above prose/code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also that image is way too big


### In any Dagster environment

The <PyObject module="dagster" object="link_code_references_to_git"/> utility allows you to convert local file code references to source control links. You'll need to provide the base URL of your git repository, the branch or commit hash, and a path to the repository root locally.
Copy link
Contributor

Choose a reason for hiding this comment

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

This PyObject also doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Related to documentation in general
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants