Skip to content

Commit 8b12140

Browse files
committed
[dg] Update "Creating a library of components" doc (BUILD-930) (#29058)
## Summary & Motivation Update the "Creating a library of components" doc to reflect the current state of the codebase (e.g. removing old config specification). This will be followed by another update to this doc when `dg list plugins` is released.
1 parent e357b30 commit 8b12140

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

Diff for: docs/docs/guides/labs/components/creating-new-component-types/creating-a-library-of-components.md

+24-14
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,29 @@ import Preview from '@site/docs/partials/\_Preview.md';
77

88
<Preview />
99

10-
To let the `dg` CLI know that your Python package contains component types, update your `pyproject.toml` file with the following configuration:
10+
`dg` is able to discover declared component types in packages installed in your Python environment. These may come from either your Dagster project or a third-party package. In either case, the mechanism for declaring component types is the same. A package must declare an [entry point](https://packaging.python.org/en/latest/specifications/entry-points/) in the `dagster-dg.library` group in its package metadata. The entry point value is the name of a Python module containing component type definitions. By convention, this usually specifies the top-level module of a package, though any submodule may be specified. The entry point name is arbitrary and does not affect component type detection, but by convention should be set to the same string as the value (i.e. the module name):
1111

12-
```toml
13-
[tool.dg]
14-
is_component_lib = true
15-
```
12+
<Tabs>
13+
<TabItem value="pyproject.toml" label="pyproject.toml">
14+
```
15+
[project.entry-points]
16+
dagster-dg.library = [
17+
"my_library = my_library",
18+
]
19+
```
20+
</TabItem>
21+
<TabItem value="setup.py" label="setup.py">
22+
```
23+
setup(
24+
# ...
25+
entry_points={
26+
"dagster_dg.library": [
27+
"my_library = my_library",
28+
],
29+
},
30+
)
31+
```
32+
</TabItem>
33+
</Tabs>
1634

17-
By default, it is assumed that all component types will be defined in `your_package.lib`. If you'd like to define your components in a different directory, you can specify this in your `pyproject.toml` file:
18-
19-
```toml
20-
[tool.dg]
21-
is_component_lib = true
22-
component_lib_package="your_package.other_module"
23-
```
24-
25-
Once this is done, as long as this package is installed in your environment, you'll be able to use the `dg` command-line utility to interact with your component types.
35+
Note that scaffolded projects declare `<project_name>.lib` as the entry point by default.

0 commit comments

Comments
 (0)