This document describes how to create a dev environment in order to run SDK tests or execute the various commands available in the toolbox.
-
If you don't already have it, install Python:
- Windows: Python website or from the Windows store
- Ubuntu/Debian
sudo apt-get install python3 - RHEL/CentOS
sudo yum install python3
Python is also available in Bash for Windows natively.
-
Clone the repository and go to the folder
git clone https://github.com/Azure/azure-sdk-for-python.git cd azure-sdk-for-python -
Create a virtual environment
You can initialize a virtual environment this way:
python -m venv env # Might be "python3" or "py" depending on your Python installation source env/bin/activate # Linux shell (Bash, ZSH, etc.) .\env\Scripts\Activate.ps1 # PowerShell .\env\Scripts\activate.bat # Windows CMDAlternatively, you can use uv which is faster and handles Python version management automatically:
uv venv source .venv/bin/activate # Linux shell (Bash, ZSH, etc.) .\.venv\Scripts\Activate.ps1 # PowerShell .\.venv\Scripts\activate.bat # Windows CMD -
Setup your development environment
Install the development requirements for a specific library (located in the
dev_requirements.txtfile at the root of the library) and an editable install of your library. This will also installazure-sdk-toolswhich provides theazpysdkCLI for running checks. For example, to install requirements forazure-ai-formrecognizer:azure-sdk-for-python> cd sdk/formrecognizer/azure-ai-formrecognizer azure-sdk-for-python/sdk/formrecognizer/azure-ai-formrecognizer> pip install -r dev_requirements.txt azure-sdk-for-python/sdk/formrecognizer/azure-ai-formrecognizer> pip install -e .Or with uv:
azure-sdk-for-python/sdk/formrecognizer/azure-ai-formrecognizer> uv pip install -r dev_requirements.txt azure-sdk-for-python/sdk/formrecognizer/azure-ai-formrecognizer> uv pip install -e . -
Create a .env file to store your secrets.
Create a
.envfile to store secrets needed for live tests (e.g. connection strings, resource endpoints). Place it in the root of the SDK repository where it is gitignored. See tests.md for details on which environment variables are needed for each package.
After following the steps above, you'll be able to run recorded SDK tests with pytest. For more information about tests -- how to run live tests, write new tests, etc. -- refer to the documentation in tests.md.