Skip to content

Commit c8956d9

Browse files
Remove raw requirements references and point to workspace dependencies (#1187)
* fix Signed-off-by: pyranota <pyra@duck.com> * change the rest Signed-off-by: pyranota <pyra@duck.com> --------- Signed-off-by: pyranota <pyra@duck.com> Co-authored-by: pyranota <pyra@duck.com> Co-authored-by: Pyra <92104930+pyranota@users.noreply.github.com>
1 parent 6509fad commit c8956d9

File tree

9 files changed

+28
-159
lines changed

9 files changed

+28
-159
lines changed

docs/advanced/14_dependencies_in_typescript/index.mdx

Lines changed: 8 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Both of these runtimes allow you to include dependencies directly in the script,
88

99
There are however methods to have more control on your dependencies:
1010

11+
- Using [workspace dependencies](../../core_concepts/55_workspace_dependencies/index.mdx) for centralized dependency management at the workspace level.
1112
- Leveraging [standard mode](#lockfile-per-script-inferred-from-imports-standard) on [web IDE](#web-ide) or [locally](#cli).
12-
- Overriding dependencies [providing a package.json](#lockfile-per-script-inferred-from-a-packagejson).
1313
- [Bundling](#bundle-per-script-built-by-cli) per script with CLI, more powerful and local only.
1414

1515
Moreover, there are other tricks, compatible with the methodologies mentioned above:
@@ -19,9 +19,13 @@ Moreover, there are other tricks, compatible with the methodologies mentioned ab
1919

2020
To learn more about how dependencies from other languages are handled, see [Dependency management & imports](../../advanced/6_imports/index.mdx).
2121

22-
![Dependency management & imports](../6_imports/dependency_management.png 'Dependency management & imports')
2322

2423
<div className="grid grid-cols-2 gap-6 mb-4">
24+
<DocCard
25+
title="Workspace dependencies"
26+
description="Manage dependencies centrally at the workspace level for consistent environments."
27+
href="/docs/core_concepts/workspace_dependencies"
28+
/>
2529
<DocCard
2630
title="Dependency management & imports"
2731
description="Windmill's strength lies in its ability to run scripts without having to manage a package.json directly."
@@ -36,7 +40,7 @@ To learn more about how dependencies from other languages are handled, see [Depe
3640

3741
## Lockfile per script inferred from imports (Standard)
3842

39-
In Windmill, you can run scripts without having to [manage a package.json](#lockfile-per-script-inferred-from-a-packagejson) directly. This is achieved by automatically parsing the imports and resolving the dependencies.
43+
In Windmill, you can run scripts without having to manage dependency files directly. This is achieved by automatically parsing the imports and resolving the dependencies. For more control, you can use [workspace dependencies](../../core_concepts/55_workspace_dependencies/index.mdx).
4044

4145
When using Bun as the runtime for TypeScript in Windmill, dependencies are resolved directly from the script imports and their imports when using [sharing common logic](../5_sharing_common_logic/index.mdx). The TypeScript runtime Bun ensures 100% compatibility with Node.js without requiring any code modifications.
4246

@@ -86,7 +90,7 @@ You can get those 3 files for each script by pulling your workspace with command
8690

8791
Editing a script is as simple as editing its content. The code can be edited freely in your IDE, and there are possibilities to even run it locally if you have the correct development environment setup for the script language.
8892

89-
Using [wmill CLI](../3_cli/index.mdx) command [`wmill script generate-metadata`](../3_cli/script.md#re-generating-a-script-metadata-file), lockfiles can be generated and updated as files. The CLI asks the Windmill servers to run dependency job, using either the [package.json (if present)](#lockfile-per-script-inferred-from-a-packagejson) or asking Windmill to automatically resolve it from the script's code as input, and from the output of those jobs, create the lockfiles.
93+
Using [wmill CLI](../3_cli/index.mdx) command [`wmill script generate-metadata`](../3_cli/script.md#re-generating-a-script-metadata-file), lockfiles can be generated and updated as files. The CLI asks the Windmill servers to run dependency job, using either [workspace dependencies](../../core_concepts/55_workspace_dependencies/index.mdx) (if configured) or automatically resolving from the script's imports, and from the output of those jobs, create the lockfiles.
9094
When a lockfile is present alongside a script at time of deployment by the CLI, no dependency job is run and the present lockfile is used instead.
9195

9296
<div className="grid grid-cols-2 gap-6 mb-4">
@@ -102,68 +106,6 @@ When a lockfile is present alongside a script at time of deployment by the CLI,
102106
/>
103107
</div>
104108

105-
## Lockfile per script inferred from a package.json
106-
107-
Although Windmill can [automatically resolve imports](#lockfile-per-script-inferred-from-imports-standard). It is possible to override the dependencies by providing a `package.json` file in the same directory as the script as you would do in a standard Node.js project, building and maintaining a package.json to declare dependencies.
108-
109-
<iframe
110-
style={{ aspectRatio: '16/9' }}
111-
src="https://www.youtube.com/embed/T8jMjpNvC2g"
112-
title="Override Inferred Dependencies with Custom Dependency Files"
113-
frameBorder="0"
114-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
115-
allowFullScreen
116-
className="border-2 rounded-lg object-cover w-full dark:border-gray-800"
117-
></iframe>
118-
119-
<br />
120-
121-
When doing [`wmill script generate-metadata`](../3_cli/script.md#re-generating-a-script-metadata-file), if a package.json is discovered, the closest one will be used as source-of-truth instead of being discovered from the imports in the script directly to generate the lockfile from the server.
122-
123-
You can write those package.json manually or through a standar `npm install <X>`.
124-
125-
Several package.json files can therefore coexist, each having authority over the scripts closest to it:
126-
127-
```
128-
└── windmill_folder/
129-
├── package.json
130-
├── f/foo/
131-
│ ├── package.json
132-
│ ├── script1.ts
133-
│ ├── # script1.ts will use the dependencies from windmill_folder/f/foo/package.json
134-
│ └── /bar/
135-
│ ├── package.json
136-
│ ├── script2.ts
137-
│ └── # script2.ts will use the dependencies from windmill_folder/f/foo/bar/package.json
138-
└── f/baz/
139-
├── script3.ts
140-
└── # script3.ts will use the dependencies from windmill_folder/package.json
141-
```
142-
143-
The Windmill [VS Code extension](../../cli_local_dev/1_vscode-extension/index.mdx) has a toggle "Infer lockfile" / "Use current lockfile".
144-
145-
With this toggle, you can choose to use the metadata lockfile (derived from package.json after `wmill script generate-metadata`) instead of inferring them directly from the script.
146-
147-
![Toggle Lockfile](../../cli_local_dev/1_vscode-extension/toggle_lockfile.png 'Toggle Lockfile')
148-
149-
<div className="grid grid-cols-2 gap-6 mb-4">
150-
<DocCard
151-
title="Local development"
152-
description="Develop locally, push to git and deploy automatically to Windmill."
153-
href="/docs/advanced/local_development"
154-
/>
155-
<DocCard
156-
title="Command-line interface (CLI)"
157-
description="The Windmill CLI, `wmill` allows you to interact with Windmill instances right from your terminal."
158-
href="/docs/advanced/cli"
159-
/>
160-
<DocCard
161-
title="VS Code extension"
162-
description="Build scripts and flows in the comfort of your VS Code editor, while leveraging Windmill UIs for test & flows edition."
163-
href="/docs/cli_local_dev/vscode-extension"
164-
/>
165-
</div>
166-
167109
## Bundle per script built by CLI
168110

169111
This method can only be deployed from the [CLI](../3_cli/index.mdx), on [local development](../4_local_development/index.mdx).

docs/advanced/15_dependencies_in_python/index.mdx

Lines changed: 8 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ In Windmill [standard mode](#lockfile-per-script-inferred-from-imports-standard)
66
From the import lines, Windmill automatically handles the resolution and caching of the script dependencies to ensure fast and consistent execution (this is standard mode).
77

88
There are however methods to have more control on your dependencies:
9+
- Using [workspace dependencies](../../core_concepts/55_workspace_dependencies/index.mdx) for centralized dependency management at the workspace level.
910
- Leveraging [standard mode](#lockfile-per-script-inferred-from-imports-standard) on [web IDE](#web-ide) or [locally](#cli).
1011
- Using [PEP-723 inline script metadata](#pep-723-inline-script-metadata) for standardized dependency specification.
11-
- Overriding dependencies [providing a requirements.txt](#lockfile-per-script-inferred-from-a-requirementstxt).
1212

1313
Moreover, there are other tricks, compatible with the methodologies mentioned above:
1414
- [Sharing common logic with Relative Imports](#sharing-common-logic-with-relative-imports).
@@ -18,9 +18,13 @@ Moreover, there are other tricks, compatible with the methodologies mentioned ab
1818

1919
To learn more about how dependencies from other languages are handled, see [Dependency management & imports](../../advanced/6_imports/index.mdx).
2020

21-
![Dependency management & imports](../6_imports/dependency_management.png "Dependency management & imports")
2221

2322
<div className="grid grid-cols-2 gap-6 mb-4">
23+
<DocCard
24+
title="Workspace dependencies"
25+
description="Manage dependencies centrally at the workspace level for consistent environments."
26+
href="/docs/core_concepts/workspace_dependencies"
27+
/>
2428
<DocCard
2529
title="Dependency management & imports"
2630
description="Windmill's strength lies in its ability to run scripts without having to manage a requirements.txt directly."
@@ -35,7 +39,7 @@ To learn more about how dependencies from other languages are handled, see [Depe
3539

3640
## Lockfile per script inferred from imports (Standard)
3741

38-
In Windmill, you can run scripts without having to [manage a requirements.txt](#lockfile-per-script-inferred-from-a-requirementstxt) directly. This is achieved by automatically parsing the top-level imports and resolving the dependencies. For automatic dependency installation, Windmill will only consider these top-level imports.
42+
In Windmill, you can run scripts without having to manage a requirements.txt directly. This is achieved by automatically parsing the top-level imports and resolving the dependencies. For automatic dependency installation, Windmill will only consider these top-level imports.
3943

4044
In Python, the top-level imports are automatically parsed on saving of the script and a list of imports is generated. For automatic dependency installation, Windmill will only consider these top-level imports.
4145

@@ -74,7 +78,7 @@ You can get those 3 files for each script by pulling your workspace with command
7478

7579
Editing a script is as simple as editing its content. The code can be edited freely in your IDE, and there are possibilities to even run it locally if you have the correct development environment setup for the script language.
7680

77-
Using [wmill CLI](../3_cli/index.mdx) command [`wmill script generate-metadata`](../3_cli/script.md#re-generating-a-script-metadata-file), lockfiles can be generated and updated as files. The CLI asks the Windmill servers to run dependency job, using either the [requirements.txt (if present)](#lockfile-per-script-inferred-from-a-requirementstxt) or asking Windmill to automatically resolve it from the script's code as input, and from the output of those jobs, create the lockfiles.
81+
Using [wmill CLI](../3_cli/index.mdx) command [`wmill script generate-metadata`](../3_cli/script.md#re-generating-a-script-metadata-file), lockfiles can be generated and updated as files. The CLI asks the Windmill servers to run dependency job, asking Windmill to automatically resolve it from the script's code as input, and from the output of those jobs, create the lockfiles.
7882
When a lockfile is present alongside a script at time of deployment by the CLI, no dependency job is run and the present lockfile is used instead.
7983

8084
<div className="grid grid-cols-2 gap-6 mb-4">
@@ -88,63 +92,6 @@ When a lockfile is present alongside a script at time of deployment by the CLI,
8892
description="Develop locally, push to git and deploy automatically to Windmill."
8993
href="/docs/advanced/local_development"
9094
/>
91-
</div>
92-
93-
## Lockfile per script inferred from a requirements.txt
94-
95-
Although Windmill can [automatically resolve imports](#lockfile-per-script-inferred-from-imports-standard). It is possible to override the dependencies by providing a `requirements.txt` file in the same directory as the script as you would do in a standard Python project, building and maintaining a requirements.txt to declare dependencies.
96-
97-
<iframe
98-
style={{ aspectRatio: '16/9' }}
99-
src="https://www.youtube.com/embed/T8jMjpNvC2g"
100-
title="Override Inferred Dependencies with Custom Dependency Files"
101-
frameBorder="0"
102-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
103-
allowFullScreen
104-
className="border-2 rounded-lg object-cover w-full dark:border-gray-800"
105-
></iframe>
106-
107-
<br/>
108-
109-
When doing [`wmill script generate-metadata`](../3_cli/script.md#re-generating-a-script-metadata-file), if a requirements.txt is discovered, the closest one will be used as source-of-truth instead of being discovered from the imports in the script directly to generate the lockfile from the server.
110-
111-
You can write those requirements.txt manually or through a standard `pip install package_name`.
112-
113-
Several requirements.txt files can therefore coexist, each having authority over the scripts closest to it:
114-
115-
```
116-
└── windmill_folder/
117-
├── requirements.txt
118-
├── f/foo/
119-
│ ├── requirements.txt
120-
│ ├── script1.py
121-
│ ├── # script1.py will use the dependencies from windmill_folder/f/foo/requirements.txt
122-
│ └── /bar/
123-
│ ├── requirements.txt
124-
│ ├── script2.py
125-
│ └── # script2.py will use the dependencies from windmill_folder/f/foo/bar/requirements.txt
126-
└── f/baz/
127-
├── script3.py
128-
└── # script3.py will use the dependencies from windmill_folder/requirements.txt
129-
```
130-
131-
The Windmill [VS Code extension](../../cli_local_dev/1_vscode-extension/index.mdx) has a toggle "Infer lockfile" / "Use current lockfile".
132-
133-
With this toggle, you can choose to use the metadata lockfile (derived from requirements.txt after `wmill script generate-metadata`) instead of inferring them directly from the script.
134-
135-
![Toggle Lockfile](../../cli_local_dev/1_vscode-extension/toggle_lockfile.png 'Toggle Lockfile')
136-
137-
<div className="grid grid-cols-2 gap-6 mb-4">
138-
<DocCard
139-
title="Local development"
140-
description="Develop locally, push to git and deploy automatically to Windmill."
141-
href="/docs/advanced/local_development"
142-
/>
143-
<DocCard
144-
title="Command-line interface (CLI)"
145-
description="The Windmill CLI, `wmill` allows you to interact with Windmill instances right from your terminal."
146-
href="/docs/advanced/cli"
147-
/>
14895
<DocCard
14996
title="VS Code extension"
15097
description="Build scripts and flows in the comfort of your VS Code editor, while leveraging Windmill UIs for test & flows edition."

docs/advanced/3_cli/script.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,7 @@ Note that you can explicitly exclude (or include) specific files or folders to b
8585
wmill flow generate-locks
8686
```
8787

88-
### package.json & requirements.txt
89-
90-
When doing `wmill script generate-metadata`, if a `package.json` or `requirements.txt` is discovered, the closest one will be used as source-of-truth instead of being discovered from the imports in the script directly to generate the lockfile from the server.
91-
92-
Below is a video on how to override Windmill inferred dependencies by [providing custom package.json](../14_dependencies_in_typescript/index.mdx#lockfile-per-script-inferred-from-a-packagejson) or requirements.txt.
93-
94-
<iframe
95-
style={{ aspectRatio: '16/9' }}
96-
src="https://www.youtube.com/embed/T8jMjpNvC2g"
97-
title="Override Inferred Dependencies with Custom Dependency Files"
98-
frameBorder="0"
99-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
100-
allowFullScreen
101-
className="border-2 rounded-lg object-cover w-full dark:border-gray-800"
102-
></iframe>
88+
For centralized dependency management, see [workspace dependencies](../../core_concepts/55_workspace_dependencies/index.mdx).
10389

10490
### Arguments
10591

-62.2 KB
Binary file not shown.

docs/advanced/4_local_development/index.mdx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,7 @@ Locally, the lockfile is respected. It "wins" over the dependencies pinned via t
168168

169169
Locally, flows and apps are stored in a folder ending with `.flow` and `.app` respectively. They include a `flow.yaml` and `app.yaml` file respectively, and the 3 files mentioned [above](#editing-and-creating-scripts-locally) for each inline script they contain.
170170

171-
### Package.json & requirements.txt
172-
173-
If you have a `package.json` or `requirements.txt` file in the same or parent directory as your script, the `wmill script generate-metadata` command will automatically include the dependencies in the metadata file.
174-
175-
The lockfile for a file generated with generated-metadata will be overriden by the closest package.json from a parent or current folder if there is one.
176-
177-
![Generate Metadata Path](./generate_metadata_path.png 'Generate Metadata Path')
171+
For centralized dependency management, see [workspace dependencies](../../core_concepts/55_workspace_dependencies/index.mdx).
178172

179173
But what if you want to create a new script from scratch? It's also easy, just create a file with the correct extension (or run `wmill script bootstrap <path> <language>`), and simply run `generate-metadata` command to generate the metadata file. The name of the file and its location in the folder will become the script path in Windmill.
180174

-2.24 MB
Binary file not shown.

0 commit comments

Comments
 (0)