Python SDK for Common Data Model.
Note: These instructions were verified on Windows. For Mac, the steps might change a bit.
- Download Python 3.7+ x86-64 executable installer from python.org.
- Run the installer. Make sure 'Add Python 3.7 to PATH' checkbox is ticked during installation.
- Open command prompt, change to the cloned repository folder and type
python -m venv envto create a virtual Python environment. - Make sure that you have Visual Studio Code installed. Type
code .to open the folder in Visual Studio Code. - In Visual Studio Code, install the Python extension for VS Code.
- Select
Python: Create Terminalcommand from the Command Palette (Ctrl+Shift+P). From the terminal, type:pip3 install -r requirements.txtto install project runtime dependencies.pip3 install -r dev-requirements.txtto install project development dependencies.
- The project requires some base files that are present in the schemaDocuments folder. Run
python .\setup.py copy_resourcesto copy the necessary files to the project. - To enable debugging of sample code in VSCode, please update your launch.json file with following settings: "cwd": "${workspaceFolder}", "env": { "PYTHONPATH": "${workspaceRoot}" }
Note: If in step 6 on Mac you receive error mentioning TLSV1_ALERT_PROTOCOL_VERSION, you need to upgrade pip with command curl https://bootstrap.pypa.io/get-pip.py | python3 - 'pip==9.0.3' --user, followed by pip3 install --upgrade setuptools --user. Then repeat the command to install all of the project requirements from step 6.
- To run the unit tests type
python -m unittest - A set of Azure Data Lake Storage Gen2 tests are included but disabled by default. To enable them follow the instructions here
If running Python: Create Terminal gives errors about running scripts and execution policies, add this to the settings.json for vscode: "terminal.integrated.profiles.windows": { "PowerShell": { "source": "PowerShell", "icon": "terminal-powershell", "args": ["-ExecutionPolicy", "Bypass"] } }, "terminal.integrated.defaultProfile.windows": "PowerShell",