|
| 1 | +Setting up Development Environment |
| 2 | +================================== |
| 3 | + |
| 4 | +Getting started with DataLab development is easy. |
| 5 | + |
| 6 | +Here is what you will need: |
| 7 | + |
| 8 | +1. An integrated development environment (IDE) for Python. We recommend |
| 9 | + [Spyder](https://www.spyder-ide.org/) or [Visual Studio Code](https://code.visualstudio.com/), |
| 10 | + but any IDE will do. |
| 11 | + |
| 12 | +2. A Python distribution. We recommend [WinPython](https://winpython.github.io/), |
| 13 | + on Windows, or [Anaconda](https://www.anaconda.com/), on Linux or Mac. |
| 14 | + But, again, any Python distribution will do. |
| 15 | + |
| 16 | +3. A clean project structure (see below). |
| 17 | + |
| 18 | +4. Test data (see below). |
| 19 | + |
| 20 | +5. Environment variables (see below). |
| 21 | + |
| 22 | +6. Third-party software (see below). |
| 23 | + |
| 24 | +Development Environment |
| 25 | +----------------------- |
| 26 | + |
| 27 | +If you are using [Spyder](https://www.spyder-ide.org/), thank you for supporting |
| 28 | +the scientific open-source Python community! |
| 29 | + |
| 30 | +If you are using Visual Studio Code, that's also an excellent choice (for other |
| 31 | +reasons). We recommend installing the following extensions: |
| 32 | + |
| 33 | +| Extension | Description | |
| 34 | +| --------- | ----------- | |
| 35 | +| [Black Formatter](https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter) | Python code formatter | |
| 36 | +| [gettext](https://marketplace.visualstudio.com/items?itemName=mrorz.language-gettext) | Gettext syntax highlighting | |
| 37 | +| [isort](https://marketplace.visualstudio.com/items?itemName=ms-python.isort) | Python import sorter | |
| 38 | +| [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance) | Python language server | |
| 39 | +| [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) | Python extension | |
| 40 | +| [reStructuredText Syntax highlighting](https://marketplace.visualstudio.com/items?itemName=trond-snekvik.simple-rst) | reStructuredText syntax highlighting | |
| 41 | +| [Ruff](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff) | Extremely fast Python linter and code formatter | |
| 42 | +| [Todo Tree](https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree) | Todo tree | |
| 43 | + |
| 44 | +Python Environment |
| 45 | +------------------ |
| 46 | + |
| 47 | +DataLab requires the following : |
| 48 | + |
| 49 | +* Python (e.g. WinPython) |
| 50 | + |
| 51 | +* Additional Python packages |
| 52 | + |
| 53 | +Installing all required packages : |
| 54 | + |
| 55 | + pip install --upgrade -r dev\requirements.txt |
| 56 | + |
| 57 | +ℹ️ See [Installation](https://cdlapp.readthedocs.io/en/latest/intro/installation.html) |
| 58 | +for more details on reference Python and Qt versions. |
| 59 | + |
| 60 | +If you are using [WinPython](https://winpython.github.io/), thank you for supporting |
| 61 | +the scientific open-source Python community! |
| 62 | + |
| 63 | +The following table lists the currently officially used Python distributions: |
| 64 | + |
| 65 | +| Python version | Status | WinPython version | |
| 66 | +| -------------- | ------------ | ----------------- | |
| 67 | +| 3.8 | OK | 3.8.10.0 | |
| 68 | +| 3.9 | OK | 3.9.10.0 | |
| 69 | +| 3.10 | OK | 3.10.11.1 | |
| 70 | +| 3.11 | OK | 3.11.5.0 | |
| 71 | +| 3.12 | OK | 3.12.0.1 | |
| 72 | + |
| 73 | +⚠ We strongly recommend using the `.dot` versions of WinPython which are lightweight |
| 74 | +and can be customized to your needs (using `pip install -r requirements.txt`). |
| 75 | + |
| 76 | +✅ We also recommend using a dedicated WinPython instance for DataLab. |
| 77 | + |
| 78 | +Test data |
| 79 | +--------- |
| 80 | + |
| 81 | +DataLab test data are located in different folders, depending on their nature or origin. |
| 82 | + |
| 83 | +Required data for unit tests are located in "cdl\data\tests" (public data). |
| 84 | + |
| 85 | +A second folder %CDL_DATA% (optional) may be defined for additional tests which are |
| 86 | +still under development (or for confidential data). |
| 87 | + |
| 88 | +Specific environment variables |
| 89 | +------------------------------ |
| 90 | + |
| 91 | +Enable the "debug" mode (no stdin/stdout redirection towards internal console): |
| 92 | + |
| 93 | + @REM Mode DEBUG |
| 94 | + set DEBUG=1 |
| 95 | + |
| 96 | +Building PDF documentation requires LaTeX. On Windows, the following environment: |
| 97 | + |
| 98 | + @REM LaTeX executable must be in Windows PATH, for mathematical equations rendering |
| 99 | + @REM Example with MiKTeX : |
| 100 | + set PATH=C:\\Apps\\miktex-portable\\texmfs\\install\\miktex\\bin\\x64;%PATH% |
| 101 | + |
| 102 | +Visual Studio Code configuration used in `launch.json` and `tasks.json` |
| 103 | +(examples) : |
| 104 | + |
| 105 | + @REM Development environment |
| 106 | + set CDL_PYTHONEXE=C:\C2OIQ-DevCDL\python-3.8.10.amd64\python.exe |
| 107 | + @REM Folder containing additional working test data |
| 108 | + set CDL_DATA=C:\Dev\Projets\CDL_data |
| 109 | + |
| 110 | +Visual Studio Code `.env` file: |
| 111 | + |
| 112 | +* This file is used to set environment variables for the application. |
| 113 | +* It is used to set the `PYTHONPATH` environment variable to the root of the project. |
| 114 | +* This is required to be able to import the project modules from within VS Code. |
| 115 | +* To create this file, copy the `.env.template` file to `.env` |
| 116 | + (and eventually add your own paths). |
| 117 | + |
| 118 | +Third-party Software |
| 119 | +-------------------- |
| 120 | + |
| 121 | +The following software may be required for maintaining the project: |
| 122 | + |
| 123 | +| Software | Description | |
| 124 | +| -------- | ----------- | |
| 125 | +| [gettext](https://mlocati.github.io/articles/gettext-iconv-windows.html) | Translations | |
| 126 | +| [Git](https://git-scm.com/) | Version control system | |
| 127 | +| [ImageMagick](https://imagemagick.org/) | Image manipulation utilities | |
| 128 | +| [Inkscape](https://inkscape.org/) | Vector graphics editor | |
| 129 | +| [MikTeX](https://miktex.org/) | LaTeX distribution on Windows | |
0 commit comments