Contribute to code
Retool uses Hatch for environment management, code formatting and testing. Tests are run using Python 3.10, 3.11, 3.12, and 3.13.
You can install Hatch and the dependencies Retool uses with the following command:
To enter an environment and install Retool's depedencies, run the following command:
When you're done and want to exit the environment, run the following command:
Run formatters and tests
Before running any tests, install Visual Studio Code,
and set its path in tests/integration.py. This is used for comparing diffs if a test
fails.
To run all formatters, and then run all tests with all defined Python versions in
pyproject.toml, run the following command:
For speed when developing, you can run quick tests instead. This skips the formatters, and runs all tests except the determinism test using only the latest defined Python version. To run the quick tests, run the following command:
Formatting and syntax
To only run black, isort,
and ruff against the code:
To run MyPy against the code:
Integration tests
Instead of running the complete test suite, you can run individual tests that validate specific Retool functionality.
Tests different settings for compilation handling:
Tests that Retool outputs the same content five times in a row:
Tests that Retool is correctly excluding all user-selected title types:
Tests that Retool is correctly filtering by different language priorities:
Tests that Retool is correctly filtering by different region priorities:
To view all tests that you can run, see the [tool.hatch.envs.quick.scripts] section in
pyproject.toml.
Enable developer mode
If you create a file named .dev and place it in Retool's folder, the following options
are enabled by default:
-
Output DAT files in legacy parent/clone format. Useful to ensure file relationships are working as they should.
-
Report clone list warnings during processing. Useful to discover issues with clone lists. These are silenced in normal operation, as they can get noisy as DAT files update.
-
Pause on clone list warnings. So you can see what's going on.
You can override this at any time in Retool CLI with the -q flag.
Disable multiprocessing
When using input statements in the Python code, make sure to also pass the --singlecpu
flag, or turn on Disable multiprocessor usage in Retool GUI. This is because input
statements don't play well with multiprocessing and cause crashes.