Installation

This guide covers the installation of gntplib and its optional dependencies.

Requirements

Core Requirements

  • Python 3.7 or higher

  • No external dependencies for basic functionality

Optional Dependencies

For Async Support (Tornado)

  • tornado >= 5.0

pip install tornado

For Encryption Support

  • pycryptodomex >= 3.15

pip install pycryptodomex

Installing gntplib

With Optional Dependencies

Install with async support:

pip install gntplib[async]

Install with encryption support:

pip install gntplib[crypto]

Install with all optional features:

pip install gntplib[all]

From Source

Clone the repository and install:

git clone https://github.com/cumulus13/gntplib.git
cd gntplib
pip install -e .

For development with all dependencies:

pip install -e ".[dev,async,crypto]"

Verifying Installation

Check that gntplib is installed correctly:

import gntplib
print(gntplib.__version__)

Run a simple test:

from gntplib import publish

# This will attempt to send a notification to localhost
try:
    publish('TestApp', 'TestEvent', 'Test Title', 'Test message')
    print("✓ Installation successful!")
except Exception as e:
    print(f"Note: {e}")
    print("(This is expected if no GNTP server is running)")

Platform-Specific Notes

Linux

On Linux, you might need to install development headers for building dependencies:

Debian/Ubuntu:

sudo apt-get update
sudo apt-get install python3-dev build-essential

Fedora/RHEL:

sudo dnf install python3-devel gcc

macOS

Install using Homebrew Python:

brew install python3
pip3 install gntplib

Windows

Install Python from python.org and ensure pip is included. Then install normally:

pip install gntplib

Virtual Environments

It’s recommended to use virtual environments for Python projects.

Using venv (Python 3.3+)

# Create virtual environment
python3 -m venv venv

# Activate (Linux/macOS)
source venv/bin/activate

# Activate (Windows)
venv\Scripts\activate

# Install gntplib
pip install gntplib

Using conda

# Create conda environment
conda create -n myproject python=3.10

# Activate environment
conda activate myproject

# Install gntplib
pip install gntplib

Upgrading

Upgrade to the latest version:

pip install --upgrade gntplib

Upgrade to a specific version:

pip install gntplib==1.0.0

Uninstalling

Remove gntplib:

pip uninstall gntplib

Troubleshooting

Import Errors

If you encounter import errors:

  1. Verify Python version:

    python --version  # Should be 3.7+
    
  2. Check installation:

    pip show gntplib
    
  3. Verify Python path:

    import sys
    print(sys.path)
    

Encryption Issues

If encryption doesn’t work:

  1. Ensure PyCryptodome is installed:

    pip install pycryptodomex
    
  2. Try importing manually:

    from Cryptodome.Cipher import AES  # Should not raise ImportError
    

Async Issues

If async features don’t work:

  1. Ensure Tornado is installed:

    pip install tornado
    
  2. Verify Tornado import:

    import tornado
    print(tornado.version)  # Should be 5.0+
    

Getting Help

If you encounter issues:

Next Steps

Now that you have gntplib installed, check out the Quickstart guide to learn basic usage.