Skip to main content

Requirements

The Mention Python Client requires:
  • Python 3.10 or higher
  • pip (Python package installer)
The library supports Python 3.10, 3.11, 3.12, 3.13, and 3.14.

Check Your Python Version

Verify your Python version:
python --version
# or
python3 --version
If you need to upgrade Python, visit python.org.

Installation Methods

Install the latest stable version from PyPI:
pip install mention

Installing a Specific Version

To install a specific version:
pip install mention==2.0.0

Upgrading

Upgrade to the latest version:
pip install --upgrade mention
It’s best practice to use a virtual environment to isolate your project dependencies:
1

Create a Virtual Environment

python -m venv venv
2

Activate the Virtual Environment

source venv/bin/activate
3

Install the Package

pip install mention

Development Installation

If you want to contribute to the project or need the latest development version:

From Source

1

Clone the Repository

git clone https://github.com/mazi76erX2/mention-python.git
cd mention-python
2

Install in Editable Mode

pip install -e .
3

Install Development Dependencies

pip install -e ".[dev]"
This installs additional tools for testing and development:
  • pytest - Testing framework
  • mypy - Static type checker
  • ruff - Linter and formatter
  • pre-commit - Git hooks

From GitHub

Install directly from the GitHub repository:
pip install git+https://github.com/mazi76erX2/mention-python.git
For a specific branch or tag:
# Install from main branch
pip install git+https://github.com/mazi76erX2/mention-python.git@main

# Install a specific version tag
pip install git+https://github.com/mazi76erX2/[email protected]

Verify Installation

Confirm the installation was successful:
import mention

print(mention.__version__)
print(mention.__author__)
Expected output:
2.0.0
Xolani Mazibuko
You can also verify from the command line:
python -c "import mention; print(mention.__version__)"

Dependencies

The Mention Python Client automatically installs these dependencies:

httpx

Modern HTTP client with sync and async support (≥0.28.1)

pydantic

Data validation using Python type hints (≥2.12.5)

python-dotenv

Environment variable management (≥1.2.0)

Environment Setup

Create a .env File

Store your API credentials securely:
1

Create .env File

Create a .env file in your project root:
touch .env
2

Add Your Credentials

.env
MENTION_ACCESS_TOKEN=your-access-token-here
MENTION_ACCOUNT_ID=your-account-id-here
3

Load in Your Code

from mention import MentionClient, MentionConfig

# Automatically loads .env file
config = MentionConfig.from_env()
client = MentionClient.from_config(config)
Never commit your .env file to version control! Add it to your .gitignore:
.gitignore
.env
.env.local

Custom Environment File

Load from a specific environment file:
from mention import MentionConfig

# Load from a custom file
config = MentionConfig.from_env(env_file=".env.production")

Custom Environment Variable Prefix

Use a different prefix for environment variables:
from mention import MentionConfig

# Look for MY_APP_ACCESS_TOKEN instead of MENTION_ACCESS_TOKEN
config = MentionConfig.from_env(prefix="MY_APP_")

Platform-Specific Notes

macOS

If you’re using the system Python, you might need to use pip3:
pip3 install mention

Linux

On some Linux distributions, you may need to install Python development headers:
sudo apt-get update
sudo apt-get install python3-dev python3-pip
pip3 install mention

Windows

On Windows, ensure Python is in your PATH:
  1. Download Python from python.org
  2. During installation, check “Add Python to PATH”
  3. Open Command Prompt or PowerShell:
pip install mention
If you encounter permission errors, try:
pip install --user mention

Docker

Use the Mention Python Client in a Docker container:
Dockerfile
FROM python:3.12-slim

WORKDIR /app

# Install the mention client
RUN pip install --no-cache-dir mention

# Copy your application code
COPY . .

CMD ["python", "app.py"]
Build and run:
docker build -t my-mention-app .
docker run --env-file .env my-mention-app

Troubleshooting

This means the package isn’t installed. Try:
pip install mention
If you’re using a virtual environment, make sure it’s activated.
pip might not be installed. Install it:
python -m ensurepip --default-pip
Use a virtual environment or install with the —user flag:
pip install --user mention
If you’re behind a corporate proxy, you may need to:
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org mention
Use a fresh virtual environment to avoid dependency conflicts:
python -m venv fresh_env
source fresh_env/bin/activate  # On Windows: fresh_env\Scripts\activate
pip install mention

Next Steps

Now that you’ve installed the Mention Python Client:

Quickstart Guide

Make your first API call in minutes

Authentication

Learn about authentication and configuration

Build docs developers (and LLMs) love