Skip to content

Commit 8f3a28e

Browse files
pythonExtension and python runtime improvements (#1734)
* pythonExtension and python runtime improvements * Adding streaming support * Use writeFileSync * Restructure extension docs and add python extension docs * Fix broken link * Update docs/config/extensions/overview.mdx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update docs/config/extensions/aptGet.mdx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update docs/config/extensions/custom.mdx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Add environment variable support --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent bbd82ad commit 8f3a28e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2060
-1077
lines changed

docs/config/config-file.mdx

Lines changed: 9 additions & 452 deletions
Large diffs are not rendered by default.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: "Additional Files"
3+
sidebarTitle: "additionalFiles"
4+
description: "Use the additionalFiles build extension to copy additional files to the build directory"
5+
---
6+
7+
Import the `additionalFiles` build extension and use it in your `trigger.config.ts` file:
8+
9+
```ts
10+
import { defineConfig } from "@trigger.dev/sdk/v3";
11+
import { additionalFiles } from "@trigger.dev/build/extensions/core";
12+
13+
export default defineConfig({
14+
project: "<project ref>",
15+
// Your other config settings...
16+
build: {
17+
extensions: [
18+
additionalFiles({ files: ["wrangler/wrangler.toml", "./assets/**", "./fonts/**"] }),
19+
],
20+
},
21+
});
22+
```
23+
24+
This will copy the files specified in the `files` array to the build directory. The `files` array can contain globs. The output paths will match the path of the file, relative to the root of the project.
25+
26+
This extension effects both the `dev` and the `deploy` commands, and the resulting paths will be the same for both.
27+
28+
<Note>The root of the project is the directory that contains the trigger.config.ts file</Note>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: "Additional Packages"
3+
sidebarTitle: "additionalPackages"
4+
description: "Use the additionalPackages build extension to include additional packages in the build"
5+
---
6+
7+
Import the `additionalPackages` build extension and use it in your `trigger.config.ts` file:
8+
9+
```ts
10+
import { defineConfig } from "@trigger.dev/sdk/v3";
11+
import { additionalPackages } from "@trigger.dev/build/extensions/core";
12+
13+
export default defineConfig({
14+
project: "<project ref>",
15+
// Your other config settings...
16+
build: {
17+
extensions: [additionalPackages({ packages: ["wrangler"] })],
18+
},
19+
});
20+
```
21+
22+
This allows you to include additional packages in the build that are not automatically included via imports. This is useful if you want to install a package that includes a CLI tool that you want to invoke in your tasks via `exec`. We will try to automatically resolve the version of the package but you can specify the version by using the `@` symbol:
23+
24+
```ts
25+
import { defineConfig } from "@trigger.dev/sdk/v3";
26+
27+
export default defineConfig({
28+
project: "<project ref>",
29+
// Your other config settings...
30+
build: {
31+
extensions: [additionalPackages({ packages: ["wrangler@1.19.0"] })],
32+
},
33+
});
34+
```
35+
36+
This extension does not do anything in `dev` mode, but it will install the packages in the build directory when you run `deploy`. The packages will be installed in the `node_modules` directory in the build directory.

docs/config/extensions/aptGet.mdx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: "apt-get"
3+
sidebarTitle: "aptGet"
4+
description: "Use the aptGet build extension to install system packages into the deployed image"
5+
---
6+
7+
You can install system packages into the deployed image using the `aptGet` extension:
8+
9+
```ts
10+
import { defineConfig } from "@trigger.dev/sdk/v3";
11+
import { aptGet } from "@trigger.dev/build/extensions/core";
12+
13+
export default defineConfig({
14+
project: "<project ref>",
15+
// Your other config settings...
16+
build: {
17+
extensions: [aptGet({ packages: ["ffmpeg"] })],
18+
},
19+
});
20+
```
21+
22+
If you want to install a specific version of a package, you can specify the version like this:
23+
24+
```ts
25+
import { defineConfig } from "@trigger.dev/sdk/v3";
26+
27+
export default defineConfig({
28+
project: "<project ref>",
29+
// Your other config settings...
30+
build: {
31+
extensions: [aptGet({ packages: ["ffmpeg=6.0-4"] })],
32+
},
33+
});
34+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: "Audio Waveform"
3+
sidebarTitle: "audioWaveform"
4+
description: "Use the audioWaveform build extension to add support for Audio Waveform in your project"
5+
---
6+
7+
Previously, we installed [Audio Waveform](https://github.com/bbc/audiowaveform) in the build image. That's been moved to a build extension:
8+
9+
```ts
10+
import { defineConfig } from "@trigger.dev/sdk/v3";
11+
import { audioWaveform } from "@trigger.dev/build/extensions/audioWaveform";
12+
13+
export default defineConfig({
14+
project: "<project ref>",
15+
// Your other config settings...
16+
build: {
17+
extensions: [audioWaveform()], // uses verson 1.1.0 of audiowaveform by default
18+
},
19+
});
20+
```

0 commit comments

Comments
 (0)