Prerequisites
Before installing GmGnAPI, make sure you have the following:
Python 3.8+
GmGnAPI requires Python 3.8 or higher.
python --version
# Python 3.8.0 or higher
pip Package Manager
Make sure pip is up to date.
pip install --upgrade pip
Install via pip (Recommended)
The easiest way to install GmGnAPI is from PyPI:
pip install gmgnapi
This will install the latest stable release along with all required dependencies:
- websockets >= 12.0 — WebSocket client library
- pydantic >= 2.0 — Data validation using Python type annotations
- aiofiles >= 23.0 — Async file operations
Pin Your Version
For production use, pin the version in your requirements.txt:
pip install gmgnapi==1.0.0
Install from Source
To get the latest development version or contribute to the project:
# Clone the repository
git clone https://github.com/ChipaDevTeam/GmGnAPI.git
cd GmGnAPI
# Install in development mode
pip install -e .
# Install with development dependencies
pip install -e ".[dev]"
Development dependencies include:
- pytest — Testing framework
- pytest-asyncio — Async test support
- black — Code formatting
- mypy — Static type checking
- ruff — Fast Python linter
Optional Dependencies
GmGnAPI supports optional extras for specific use cases:
# Install with all optional dependencies
pip install gmgnapi[all]
# Data analysis extras (pandas, numpy)
pip install gmgnapi[analysis]
# Webhook & notification extras (aiohttp)
pip install gmgnapi[webhooks]
# Export extras (openpyxl for Excel export)
pip install gmgnapi[export]
Analysis
pandas, numpy — For advanced data analysis and manipulation of pool/token data.
Webhooks
aiohttp — For sending webhook notifications to Slack, Discord, or custom endpoints.
Export
openpyxl — For exporting data to Excel spreadsheets alongside JSON and CSV.
Docker Setup
Run GmGnAPI inside a Docker container for isolated, reproducible environments:
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "main.py"]
# Build and run
docker build -t gmgnapi-app .
docker run -e GMGN_ACCESS_TOKEN=your_token gmgnapi-app
Virtual Environments
We strongly recommend using virtual environments to isolate your project dependencies:
venv (Built-in)
# Create virtual environment
python -m venv .venv
# Activate (macOS/Linux)
source .venv/bin/activate
# Activate (Windows)
.venv\Scripts\activate
# Install GmGnAPI
pip install gmgnapi
Poetry
# Add GmGnAPI to your project
poetry add gmgnapi
# With optional extras
poetry add "gmgnapi[all]"
Conda
# Create conda environment
conda create -n gmgnapi python=3.11
conda activate gmgnapi
# Install via pip inside conda
pip install gmgnapi
Verify Installation
Confirm that GmGnAPI is installed correctly:
import gmgnapi
print(f"GmGnAPI version: {gmgnapi.__version__}")
# Test basic import
from gmgnapi import GmGnClient
print("✅ GmGnAPI installed successfully!")
# Quick verification from command line
python -c "from gmgnapi import GmGnClient; print('✅ GmGnAPI ready!')"
Troubleshooting
Python version too old
GmGnAPI requires Python 3.8+. Update Python or use pyenv to manage versions:
pyenv install 3.11.0
pyenv local 3.11.0
Permission errors on install
Use the --user flag or a virtual environment:
pip install --user gmgnapi
Pydantic v1 conflict
GmGnAPI requires Pydantic v2. Upgrade with:
pip install --upgrade pydantic>=2.0