Set up your development environment
Install the toolchain TuyaOpen needs, clone the repository, and activate tos.py โ the one command you use to configure, build, and flash every project.
What you get at the end
A working TuyaOpen checkout on your computer with the tos.py command active in your terminal. Every later learn page โ build, flash, pair โ assumes you finished this one.
tos.pyis the single CLI for configuring, building, flashing, and monitoring TuyaOpen projects.- Activation creates a Python virtual environment (
.venv) inside the repo โ it does not touch your system Python. - You must re-activate
tos.pyevery time you open a new terminal.
What you need
Before you start, gather the following:
- A TuyaOpen-compatible development board or module.
- A USB data cable (a charge-only cable will not work).
- A computer running Windows, macOS, or Linux.
Install the toolchain
TuyaOpen needs git, Python 3, make, cmake, and ninja. Pick your OS โ the install commands and the activate command below both update to match.
Clone TuyaOpen
Clone the repository from GitHub or Gitee (use Gitee if you are in mainland China for a faster clone).
Do not use Chinese characters, spaces, or special characters in the project path. On Windows, do not place the project on the C drive.
# Use GitHub
git clone https://github.com/tuya/TuyaOpen.git
# Or use Gitee
git clone https://gitee.com/tuya-open/TuyaOpen.git
# Enter the project
cd TuyaOpenIf the clone is slow, raise the git HTTP buffer first: git config --global http.postBuffer 524288000.
Activate tos.py
From inside the TuyaOpen directory, run the activate script for your OS. This creates the .venv virtual environment and puts tos.py on your PATH.
You must run the activate command again every time you reopen the terminal.
Verify it worked
Run tos.py version and tos.py check. check validates the tool versions and downloads the SDK submodules on first run.
โฏ tos.py version
[INFO]: Running tos.py ...
[INFO]: v1.3.0
โฏ tos.py check
[INFO]: Running tos.py ...
[INFO]: [git] (2.43.0 >= 2.0.0) is ok.
[INFO]: [cmake] (4.0.2 >= 3.28.0) is ok.
[INFO]: [make] (4.3 >= 3.0.0) is ok.
[INFO]: [ninja] (1.11.1 >= 1.6.0) is ok.
[INFO]: Downloading submodules...
[INFO]: Download submodules successfully.versionprints the current tag-commit (e.g.v1.3.0).[Unknown version]means the repo has no tags โ common in forks.checkconfirms git โฅ 2.0.0, cmake โฅ 3.28.0, make โฅ 3.0.0, ninja โฅ 1.6.0, then runsgit submodule update --init.- When you are done for the day, run
deactivate(Linux/Mac) orexit(Windows) to leave the virtual environment.
Troubleshooting
Usually python3-venv is missing. Install it and retry: sudo apt-get install python3-venv. If activation still fails, delete the ./.venv directory and activate again.
Install or upgrade the named tool to at least the minimum version shown (git 2.0.0, cmake 3.28.0, make 3.0.0, ninja 1.6.0), then run tos.py check again.
Run it manually in the repo root: git submodule update --init, then re-run tos.py check.
Terminal emulator compatibility. Use cmd or PowerShell, or navigate with h j k l (left/down/up/right).
Next: build your first firmware โFull environment docs โtos.py command reference โ