Tasks: Projects & Env Import
Submit multi-file Python project folders or .zip archives to Serverless Tasks, configure entrypoints and requirements, and bulk-import environment variables from .env, shell, JSON, YAML, or TOML files.
Run full multi-file Python repositories and bulk-import environment variables in Serverless Tasks.
Run a project
Section titled “Run a project”A single file is enough for many jobs. When your code is a folder — several modules, config files, a training repo — switch the Script card to Project and run it as it is, instead of pasting everything into one file.
Add a project
Section titled “Add a project”Drop a project folder or a .zip on the Script card, or click Choose folder or Choose .zip. A GitHub Download ZIP works as it is: the top-level folder inside it becomes the project name.
- One asset, uploaded for you. The console uploads the project to Assets as one asset and attaches it to the task as an input, so it counts toward the 20-input limit. The upload starts as soon as you drop, while you fill in the rest of the form.
- Submit waits for the upload. Submit task stays off until the upload has finished — it doesn’t submit by itself, so click it again afterward. If the upload fails, Retry is on the project row.
- It stays in Assets. The project is an ordinary asset in managed storage, billed as storage like any other upload until you delete it. Dropping the same folder again uploads another copy (
-2,-3, and so on). - Replace or Remove on the project row swaps or drops it. Switching between Script and Project keeps what you entered in both.
What the console leaves out. It tells you what it skipped under the project row, for example Skipped .git, __pycache__ (1,204 files).
| Left out | Why |
|---|---|
Version control, caches and tool folders — .git (and .hg, .svn), __pycache__ and *.pyc, node_modules, .ipynb_checkpoints, .mypy_cache, .pytest_cache, .ruff_cache, .tox, .nox, .idea, .vscode, *.egg-info | Rebuilt or irrelevant at run time, and often thousands of files |
Virtual environments — .venv, venv, and any folder that contains a pyvenv.cfg, whatever its name | Install packages with a requirements file instead |
Experiment logs — wandb, mlruns, lightning_logs | Output, not code |
Operating-system leftovers — .DS_Store, __MACOSX, ._*, Thumbs.db, desktop.ini | Noise |
.env and .env.* files (but not .env.example and the like) | Assets aren’t encrypted and are visible in Assets, so secrets stay out. The console offers to load them into Environment & secrets instead — see below |
Empty files, except empty .py files such as __init__.py (and py.typed, .gitkeep) | Assets can’t hold empty files; an empty __init__.py is kept because it makes a folder a package |
Other folders — data, build, dist, env — are uploaded like any other, so keep large datasets out of the project and attach them as input assets.
A .env file in the project. The console doesn’t upload it. Under the project row, Load into Environment & secrets reads it into the rows of that card (with several .env files, there is one Load button for each) and tells you where the variables went. Because the variables are then set in the container, code that calls python-dotenv’s load_dotenv() keeps working without the file.
File count. A task can fetch about 500 files in total at run time, counting the project and the files of the input assets you attach. Linked sources (Hugging Face, CivitAI, URLs) and bucket references aren’t counted. Over the limit, the console names the three folders with the most files and offers a Skip button for each. Many small files are better packed into one archive that your program unpacks.
A .zip is unpacked in your browser. One that is password-protected, uses non-UTF-8 file names, or unpacks to more than about 2 GiB can’t be opened that way — unzip it and drop the folder instead.
Choose what runs
Section titled “Choose what runs”Once the project is on the card, set:
- Run — the
.pyfile to execute. The console picks a top-levelmain.py,train.py,run.pyor__main__.pyfor you, the only candidate left once files likesetup.py,conftest.pyandtest_*.pyare set aside, or the only file with one of those names anywhere in the project (such asmypkg/train.py). When it can’t tell, the field is empty and the form asks you to Choose the file to run. - Install requirements from — a
requirements*.txtin the project. A top-levelrequirements.txtis chosen by default; choose None to skip installing. - Extra packages (optional) —
requirements.txtlines installed before the project’s own requirements file, for a package you don’t want to add to the repository. - Arguments (optional) — passed to the file as command-line arguments.
Under these fields the console shows the exact commands that will run, such as pip install -r requirements.txt followed by python -m mypkg.train. The Run summary’s Entrypoint row shows the same command.
How a project runs
Section titled “How a project runs”The project is downloaded like any input asset — that download time is billed — and then:
- It’s copied into a working folder, so the program can write next to its code. Very large files (~64 MiB and up) are linked read-only instead of copied, so big weights inside a project aren’t stored twice; they can be read but not changed in place.
- The working directory is the project folder, so relative paths such as
data/train.csvorconfigs/base.yamlwork, and sibling modules import as usual. This differs from Script mode, where the working directory is/outputs. - Requirements are installed. Extra packages first, then
pip install -r <file>from the project folder. Install time is billed, and a failed install ends the task as a user fault — see requirements.txt. - The entry file runs as
python path/to/file.py. When the file sits in a package — every folder from the project root down to it has an__init__.py— it runs aspython -m pkg.moduleinstead, so relative imports such asfrom .utils import loadwork, and sibling modules imported by plain name (import utils) are still found. A file at the top level always runs as a plain script, and__init__.pycan’t be chosen — add a__main__.pyto run a package. If your code starts Python again itself withpython -m(some multi-GPU launchers do), import sibling modules through the package (from pkg import utils) in those processes. - New and changed files are collected. When the program exits, files it created or changed inside the project folder are moved to
/outputsat the same relative path and uploaded with the rest of the outputs. If moving them would pass the output file limit, files in shallower folders are moved first until/outputsreaches the limit, and the log lists the ones that weren’t saved.
Re-run and the task page
Section titled “Re-run and the task page”The task page shows the project instead of the code: its name with Open in Assets, the command, and the requirements file. Re-run with same config (and Re-run on the task list) attaches the same project and input assets again, after checking they still exist.
The project isn’t uploaded again, so edits on your computer aren’t picked up — drop the folder again to run the new version. If the project asset has been deleted since, the form says so and asks you to drop the folder again.
Import environment variables
Section titled “Import environment variables”Instead of typing each row in Environment & secrets, bring in a whole set of variables:
- Paste into a name field. Paste
KEY=VALUElines, JSON or YAML into the name of a row and it expands into one row per variable. - Paste into a value field. Paste a block of several
KEY=VALUElines. A single-line value is never split, so a value that contains=, like a base64 string or a URL, stays as you typed it. - Drop a file. Drop a file anywhere on the card.
- Click Import from file and choose a file (up to 1 MiB).
A line under the card sums up the result, for example “Imported 5 variables · 1 replaced · 2 marked secret · 1 line skipped”.
- Existing names are replaced. A name that is already a row gets the new value; the other names are added as new rows. If a name appears twice in the pasted text, the last one wins.
- Secret-looking names come in as Secret. A name containing
TOKEN(as a whole word, soMAX_TOKENSis left alone),SECRET,PASSWORD,API_KEY,ACCESS_KEY,PRIVATE_KEYorCREDENTIALis imported as a Secret. It’s a guess from the name only: click the Variable or Secret pill on a row to change it. - Values come in as written. Wrapping quotes are removed, but
${VAR},$(command)and%VAR%are not expanded. Numbers and booleans become text. - A file with several sets of variables asks which one you want. Two Compose services or two Kubernetes containers are never merged silently: pick one, or All, where a name that appears twice takes the later value.
- Kubernetes secrets are decoded. Values under
dataare decoded from base64 and come in as secrets, along withstringData.valueFromentries have no value to import, so they’re skipped.
The format is recognized from the content, so the file name doesn’t matter:
| Format | What’s understood |
|---|---|
.env | KEY=value, KEY: value, # comments, "double" quotes with \n escapes and multi-line values, 'single' quotes |
| Shell | export KEY=value (several on a line), .envrc, fish set -x, csh setenv |
| Windows | PowerShell $env:KEY = "value", set KEY=value, set "KEY=value", setx |
| JSON | An object, a list of {"name": …, "value": …} or "KEY=value" strings, comments and trailing commas (launch.json), AWS SAM env.json, ECS task definitions |
| YAML | Plain maps, Docker Compose, Kubernetes env, ConfigMaps and Secrets, GitHub Actions env, serverless.yml, App Engine env_variables |
| TOML | wrangler.toml, fly.toml, netlify.toml, Cargo [env], mise |
| Other | Java .properties, INI, systemd Environment=, Dockerfile ENV, two columns pasted from a spreadsheet |
- Lines that aren’t valid variable names are skipped and counted. The usual limits and reserved names still apply.
The same import works in a Pod’s or template’s Environment variables section: names that match a variable the template already defines fill in its value, and names that look secret are added as secret variables.