---
title: "Poetry Installation"
description: "Install the TraceRTM Python SDK using Poetry dependency manager"
---

# Poetry Installation

Install the TraceRTM Python SDK using Poetry, a modern dependency management tool for Python.

## Prerequisites

### Install Poetry

```bash
# Official installer (recommended)
curl -sSL https://install.python-poetry.org | python3 -

# Or using pipx
pipx install poetry

# Or using pip (not recommended)
pip install poetry
```

Verify installation:

```bash
poetry --version
```

---

## Basic Installation

### Add to Existing Project

```bash
# Add latest stable version
poetry add tracertm

# Add specific version
poetry add tracertm@1.2.3

# Add version constraint
poetry add "tracertm@^1.2.0"
```

### New Project Setup

```bash
# Create new project
poetry new my-project
cd my-project

# Add TraceRTM SDK
poetry add tracertm
```

---

## Version Constraints

Poetry supports flexible version constraints:

```bash
# Exact version
poetry add tracertm@1.2.3

# Caret (^) - compatible releases
poetry add "tracertm@^1.2.0"  # >=1.2.0 <2.0.0

# Tilde (~) - patch releases
poetry add "tracertm@~1.2.0"  # >=1.2.0 <1.3.0

# Range
poetry add "tracertm@>=1.2.0,<2.0.0"

# Latest pre-release
poetry add tracertm --allow-prereleases
```

---

## Installing Extras

```bash
# Install with async support
poetry add "tracertm[async]"

# Install with CLI tools
poetry add "tracertm[cli]"

# Install with multiple extras
poetry add "tracertm[async,cli]"

# Install with all extras
poetry add "tracertm[all]"
```

---

## pyproject.toml Configuration

### Basic Configuration

```toml
[tool.poetry]
name = "my-project"
version = "0.1.0"
description = "My TraceRTM integration"
authors = ["Your Name <you@example.com>"]
python = "^3.9"

[tool.poetry.dependencies]
python = "^3.9"
tracertm = "^1.2.0"

[tool.poetry.group.dev.dependencies]
pytest = "^7.0"
mypy = "^1.0"
black = "^23.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
```

### With Extras

```toml
[tool.poetry.dependencies]
python = "^3.9"
tracertm = { version = "^1.2.0", extras = ["async", "cli"] }
```

### From Git Repository

```toml
[tool.poetry.dependencies]
tracertm = { git = "https://github.com/tracertm/tracertm-python.git", branch = "main" }
```

---

## Environment Management

### Install Dependencies

```bash
# Install all dependencies
poetry install

# Install without dev dependencies
poetry install --without dev

# Install with extras
poetry install --extras "async cli"

# Install all extras
poetry install --all-extras
```

### Activate Environment

```bash
# Activate virtual environment
poetry shell

# Or run command in environment
poetry run python script.py
poetry run pytest
```

### Environment Info

```bash
# Show environment info
poetry env info

# List environments
poetry env list

# Remove environment
poetry env remove python3.9
```

---

## Update and Remove

### Update SDK

```bash
# Update to latest compatible version
poetry update tracertm

# Update all dependencies
poetry update

# Show outdated packages
poetry show --outdated
```

### Remove SDK

```bash
poetry remove tracertm
```

---

## Lock File Management

```bash
# Generate/update lock file
poetry lock

# Install from lock file (exact versions)
poetry install --no-update

# Export to requirements.txt
poetry export -f requirements.txt -o requirements.txt

# Export without hashes
poetry export -f requirements.txt --without-hashes -o requirements.txt
```

---

## Development Workflow

### Recommended Setup

```bash
# Clone your project
git clone https://github.com/your-org/your-project.git
cd your-project

# Install dependencies
poetry install

# Activate environment
poetry shell

# Start development
python your_app.py
```

### Scripts Configuration

```toml
[tool.poetry.scripts]
my-cli = "my_project.cli:main"
sync = "my_project.sync:run_sync"
```

```bash
# Run defined scripts
poetry run my-cli
poetry run sync
```

---

## Verify Installation

```bash
# Check installed version
poetry show tracertm

# Run Python in environment
poetry run python -c "import tracertm; print(tracertm.__version__)"
```

```python
# In your code
from tracertm import TraceRTMClient

client = TraceRTMClient()
print("TraceRTM SDK ready!")
```

---

## Troubleshooting

### Clear Cache

```bash
poetry cache clear --all pypi
```

### Reset Environment

```bash
# Remove and recreate environment
poetry env remove python
poetry install
```

### SSL Issues

```bash
# Configure certificates
poetry config certificates.pypi.cert /path/to/ca-bundle.crt
```

### Proxy Configuration

```bash
# Set HTTP proxy
poetry config http-basic.proxy username password
```

---

## Related Documentation

- [Pip Installation](/docs/api-reference/sdks/python/pip-install) - Pip alternative
- [Quickstart](/docs/api-reference/sdks/python/quickstart) - Get started with the SDK
- [Authentication](/docs/api-reference/sdks/python/authentication) - Configure API keys
