|
| 1 | +--- |
| 2 | +hide: |
| 3 | + - footer |
| 4 | +--- |
| 5 | + |
| 6 | +# Contribute to code |
| 7 | + |
| 8 | +Retool uses [Hatch](https://github.com/pypa/hatch) for environment management, code |
| 9 | +formatting and testing. Tests are run using Python 3.10, 3.11, and 3.12. |
| 10 | + |
| 11 | + |
| 12 | +You can install Hatch and `hatch-pip-compile` with the following command: |
| 13 | + |
| 14 | +``` |
| 15 | +pip install hatch hatch-pip-compile |
| 16 | +``` |
| 17 | + |
| 18 | +To enter an environment and install Retool's depedencies, run the following command: |
| 19 | + |
| 20 | +``` |
| 21 | +hatch shell |
| 22 | +``` |
| 23 | + |
| 24 | +When you're done and want to exit the environment, run the following command: |
| 25 | + |
| 26 | +``` |
| 27 | +exit |
| 28 | +``` |
| 29 | + |
| 30 | +## Run formatters and tests |
| 31 | + |
| 32 | +To run all formatters and tests, run the following command: |
| 33 | + |
| 34 | +``` |
| 35 | +hatch run all |
| 36 | +``` |
| 37 | + |
| 38 | +### Formatting and syntax |
| 39 | + |
| 40 | +To only run [`black`](https://github.com/psf/black), [`isort`](https://pycqa.github.io/isort/), |
| 41 | +and [`ruff`](https://github.com/astral-sh/ruff) against the code: |
| 42 | + |
| 43 | +``` |
| 44 | +hatch run style:fix |
| 45 | +``` |
| 46 | + |
| 47 | +To run MyPy against the code: |
| 48 | + |
| 49 | +``` |
| 50 | +hatch run types:check |
| 51 | +``` |
| 52 | + |
| 53 | +### Integration tests |
| 54 | + |
| 55 | +Instead of running the complete test suite, you can run individual tests that validate |
| 56 | +specific Retool functionality. |
| 57 | + |
| 58 | +Tests different settings for compilation handling: |
| 59 | + |
| 60 | +``` |
| 61 | +hatch run integration:compilations |
| 62 | +``` |
| 63 | + |
| 64 | +Tests that Retool outputs the same content five times in a row: |
| 65 | + |
| 66 | +``` |
| 67 | +hatch run integration:determinism |
| 68 | +``` |
| 69 | + |
| 70 | +Tests that Retool is correctly excluding all user-selected title types: |
| 71 | + |
| 72 | +``` |
| 73 | +hatch run integration:exclusions |
| 74 | +``` |
| 75 | + |
| 76 | +Tests that Retool is correctly filtering by different language priorities: |
| 77 | + |
| 78 | +``` |
| 79 | +hatch run integration:languages |
| 80 | +``` |
| 81 | + |
| 82 | +Tests that Retool is correctly filtering by different region priorities: |
| 83 | + |
| 84 | +``` |
| 85 | +hatch run integration:regions |
| 86 | +``` |
| 87 | + |
| 88 | +## Enable developer mode |
| 89 | + |
| 90 | +If you create a file named `.dev` and place it in Retool's folder, the following options |
| 91 | +are enabled by default: |
| 92 | + |
| 93 | +* **Output DAT files in legacy parent/clone format**. Useful to ensure file relationships |
| 94 | + are working as they should. |
| 95 | + |
| 96 | +* **Report clone list warnings during processing**. Useful to discover issues with clone |
| 97 | + lists. These are silenced in normal operation, as they can get noisy as DAT files |
| 98 | + update. |
| 99 | + |
| 100 | +* **Pause on clone list warnings**. So you can see what's going on. |
| 101 | + |
| 102 | +You can override this at any time in Retool CLI with the `-q` flag. |
| 103 | + |
| 104 | +## Disable multiprocessing |
| 105 | + |
| 106 | +When using `input` statements in the Python code, make sure to also pass the `--singlecpu` |
| 107 | +flag, or turn on **Disable multiprocessor usage** in Retool GUI. This is because `input` |
| 108 | +statements don't play well with multiprocessing and cause crashes. |
| 109 | + |
| 110 | + |
0 commit comments