You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import Preview from '@site/docs/partials/\_Preview.md';
7
+
8
+
<Preview />
9
+
10
+
`dg` is primarily configured using
11
+
12
+
13
+
14
+
## Default `dg` behavior (`uv run`)
15
+
16
+
`dg` itself is installed globally and always executes in an isolated environment. However, many `dg` commands need to spawn subprocesses in environments scoped to specific projects. For example, when you run `dg list component-type` in a project directory, `dg` only lists the component types available in that project.
17
+
18
+
When using `dg` with default settings, the Python subprocess is spawned after detecting a virtual environment in the project directory. This means that, rather than finding the first `python` executable on your shell `PATH`, it will instead use the Python executable from a locally detected virtual environment even if that virtual environment is not currently activated.
19
+
20
+
By default, `dg` uses a special `uv` command called `uv run` for environment detection and command execution. `uv run` resolves a local virtual environment (`.venv` in an ancestor directory) before running a command, and additionally makes sure that the environment is up to date with the project's specified dependencies before running the command.
21
+
22
+
`dg`'s use of `uv run` means you don't need to manage global shell state by activating and deactivating virtual environments during development. Instead, `dg` expects (and will scaffold for you) a `.venv` directory in the root of each project, and will use that virtual environment when executing commands (such as `dg scaffold defs` or `dg list component-type`) against that project.
23
+
24
+
## Disabling use of `uv run`
25
+
26
+
You can disable `dg`'s use of `uv run` by passing the `--no-use-dg-managed-environment` flag to `dg` commands. This will cause `dg` to still try to resolve local virtual environments by looking up the ancestor tree for `.venv`, but instead launch Python processes directly rather than going through `uv run`.
27
+
28
+
If you want to opt out of virtual environment detection entirely and just use your ambient Python environment (system Python or an activated virtual env), you should also (a) set `--no-require-local-venv`, and (b) ensure there are no `.venv` directories in
29
+
the ancestor tree of your project.
30
+
31
+
:::info
32
+
33
+
Disabling `uv` integration with `--no-use-dg-managed-environment` will
34
+
currently disable the `dg cache`. This will make some operations noticeably slower.
Copy file name to clipboardExpand all lines: examples/docs_snippets/docs_snippets/guides/components/shell-script-component/3-dg-list-component-types.txt
+1-1
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ dg list component-type
2
2
3
3
Using /.../my-component-library/.venv/bin/dagster-components
0 commit comments