Python Development Environment
Overview
This guide provides a simple and consistent way to start a new Python project. It covers installing Python, choosing a package manager, and running code locally or in Docker.
Setup
1. Install Python
- Linux
- macOS
- Windows (WSL2)
sudo apt update
sudo apt install python3
brew install python
sudo apt update
sudo apt install python3
2. Choose a package manager
uv is a modern, fast alternative to pip + venv that manages both Python packages and virtual environments with a single tool. pip + venv is the long-standing standard Python toolchain included with most Python installations. Both are fully supported — pick whichever you prefer.
- uv
- pip + venv
uv manages Python packages and virtual environments with a single fast command.
Install uv:
- Linux / Windows (WSL2)
- macOS
- Windows (native)
curl -LsSf https://astral.sh/uv/install.sh | sh
curl -LsSf https://astral.sh/uv/install.sh | sh
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Create a project directory
mkdir my_project && cd my_project
Add a pyproject.toml file
Create a pyproject.toml to declare your project and dependencies:
[project]
name = "my-project"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = [
"accelbyte-py-sdk",
"bitarray",
"httpx[http2]",
"mmh3",
"PyJWT[crypto]",
"PyYAML",
"requests",
"websockets",
]
Install dependencies (uv creates and manages .venv automatically):
uv sync
Write and run code
mkdir src
cat <<EOF > src/app.py
import accelbyte_py_sdk
print(accelbyte_py_sdk.get_version(latest=True, full=True))
EOF
uv run python src/app.py
Run with Docker (Optional)
FROM python:3.10-slim
WORKDIR /app
COPY pyproject.toml uv.lock ./
RUN --mount=from=ghcr.io/astral-sh/uv:latest,source=/uv,target=/uv \
UV_PROJECT_ENVIRONMENT=/usr/local /uv sync --frozen --no-dev --no-install-project
COPY src/ .
CMD ["python", "app.py"]
docker build -t my-app . && docker run --rm my-app
pip and venv are the traditional Python packaging tools included with most Python installations.
On Linux / WSL2, install them if missing:
sudo apt install python3-pip python3-venv
Create a project directory and virtual environment
mkdir my_project && cd my_project
python3 -m venv .venv
source .venv/bin/activate
Add a requirements.txt file
Create a requirements.txt with your dependencies:
cat <<EOF > requirements.txt
accelbyte-py-sdk
bitarray
httpx[http2]
mmh3
PyJWT[crypto]
PyYAML
requests
websockets
EOF
Install dependencies:
pip install -r requirements.txt
mkdir src
cat <<EOF > src/app.py
import accelbyte_py_sdk
print(accelbyte_py_sdk.get_version(latest=True, full=True))
EOF
python src/app.py
Run with Docker (Optional, pip + venv)
FROM python:3.10-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY src/ .
CMD ["python", "src/app.py"]
docker build -t my-app . && docker run --rm my-app