Installation Guide
Default setup
To use svy-sae, you first need to install it. You can install svy-sae from PyPI using pip:
pip install svy-saeThe svy-sae package depends on svy for survey design specification and direct estimation. This dependency is installed automatically.
We recommend using a virtual environment to install svy-sae. You can create one with:
python -m venv venvYou may replace venv with any name you prefer, such as .venv or svy_sae_env. Activate the virtual environment with:
source venv/bin/activateRecommended setup for the tutorials
For the tutorials, we will use the uv package manager to create and configure a new Python project. If you prefer a different Python package manager (e.g., venv, pipx, poetry, or pipenv), feel free to use that instead.
Step 1: Install uv
You may skip this step if you already have uv installed.
pip install uvFor best results, install uv globally so it is available across projects. Refer to the official documentation for platform-specific instructions.
Step 2: Create a project folder
Navigate to the directory where you would like to create your project and run:
uv init svy_sae_tutorial
cd svy_sae_tutorialThis generates the following structure:
svy_sae_tutorial/
├── .python-version
├── README.md
├── main.py
└── pyproject.toml
.python-version→ Python version for the virtual environmentpyproject.toml→ project configuration and dependenciesmain.py→ placeholder scriptREADME.md→ project overview
Step 3: Add svy-sae as a dependency
Use uv add to add svy-sae to your project:
uv add svy-saeThis adds svy-sae under [project] dependencies in your pyproject.toml and installs it:
[project]
name = "svy_sae_tutorial"
dependencies = ["svy-sae"]If you want to pin a specific version:
uv add "svy-sae==0.0.1"You may also add additional packages as needed, for example:
uv add polars
uv add ruff --devTo remove a package:
uv remove polarsTo upgrade a dependency:
uv lock --upgrade-package svy-saeNext steps
Next, take a quick tour of the svy-sae workflow and package structure: