Skip to main content

Python API library for WATS (Web-based Automated Test System) - manufacturing test data management

Project description

PyWATS

PyPI version Python 3.10+ License: MIT

A Python library for interacting with the WATS (Web-based Automated Test System) API.

⚠️ Beta Release: This is a beta version. The API is stabilizing but may have changes before 1.0.

Requirements

  • Python 3.10 or later
  • WATS Server 2025.3.9.824 or later

Features

  • PyWATS Library - Core API library for WATS integration

    • Product management
    • Asset management
    • Report creation and submission
    • Production/serial number management
    • RootCause ticket system
    • Software distribution
    • Statistics and analytics
  • PyWATS Client - Desktop and headless client application

    • Connection management
    • Converter configuration
    • Report queue management
    • GUI Mode: Qt-based desktop application (Windows, macOS, Linux)
    • Headless Mode: CLI and HTTP API for servers, Raspberry Pi, embedded systems

Installation

From PyPI (Recommended)

# Install core API library only
pip install pywats-api

# Install with GUI client (requires Qt)
pip install pywats-api[client]

# Install headless client (no Qt - for Raspberry Pi, servers)
pip install pywats-api[client-headless]

# Install with MCP server (for AI assistant integration)
pip install pywats-api[mcp]

From Source (Development)

# Clone the repository
git clone https://github.com/olreppe/pyWATS.git
cd pyWATS

# Create virtual environment
python -m venv .venv
.venv\Scripts\activate  # Windows
source .venv/bin/activate  # Linux/Mac

# Install in development mode
pip install -e ".[dev]"

Configuration

Create a configuration with your WATS credentials:

from pywats import pyWATS

api = pyWATS(
    base_url="https://your-server.wats.com",
    token="your_base64_encoded_token"
)

Or use environment variables:

WATS_BASE_URL=https://your-server.wats.com
WATS_AUTH_TOKEN=your_base64_encoded_token

Quick Start

from pywats import pyWATS, WATSFilter

# Initialize API
api = pyWATS(
    base_url="https://your-server.wats.com",
    token="your_token"
)

# Test connection
if api.test_connection():
    print(f"Connected! Server version: {api.get_version()}")

# Get products
products = api.product.get_products()
for p in products:
    print(f"{p.part_number}: {p.name}")

# Query recent reports
filter = WATSFilter(top_count=10)
headers = api.report.query_uut_headers(filter)

Enable Debug Logging

from pywats import pyWATS, enable_debug_logging

# Quick debug mode - shows all library operations
enable_debug_logging()

# Or configure logging your way
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('pywats').setLevel(logging.DEBUG)

# Now use the API with detailed logging
api = pyWATS(base_url="...", token="...")

See LOGGING_STRATEGY.md for comprehensive logging documentation.

Running the GUI Client

python -m pywats_client

GUI Configuration

The GUI supports modular tab configuration and logging control:

  • Tab Visibility: Show/hide tabs (Software, SN Handler, etc.) based on your needs
  • Logging Integration: Automatic PyWATS library logging when debug mode is enabled
  • Multiple Instances: Run multiple client instances with separate configurations

See GUI Configuration Guide for detailed setup instructions.

Running Headless (Raspberry Pi, Servers)

For systems without display or Qt support:

# Initialize configuration
pywats-client config init

# Test connection
pywats-client test-connection

# Run service with HTTP control API
pywats-client start --api --api-port 8765

# Run as daemon (Linux)
pywats-client start --daemon

CLI Commands

pywats-client config show          # Show configuration
pywats-client config set key value # Set config value
pywats-client status               # Show service status
pywats-client converters list      # List converters

HTTP Control API

When running with --api, manage the service remotely:

curl http://localhost:8765/status    # Get status
curl http://localhost:8765/config    # Get configuration
curl -X POST http://localhost:8765/restart  # Restart services

See Headless Operation Guide for complete documentation.

Project Structure

pyWATS/
├── src/
│   ├── pywats/              # Core library
│   │   ├── domains/         # Domain models and services
│   │   ├── core/            # HTTP client, exceptions, station
│   │   ├── models/          # Report models (UUT/UUR)
│   └── pywats_client/       # Client application
│       ├── core/            # Core client functionality
│       ├── gui/             # Qt GUI components (optional)
│       ├── control/         # Headless control (CLI, HTTP API)
│       └── services/        # Background services
├── converters/              # User converter plugins
├── docs/                    # Documentation
│   ├── api_specs/           # OpenAPI specifications
│   ├── examples/            # Usage examples
│   └── gui_screens/         # GUI screenshots
├── pyproject.toml           # Project configuration
└── requirements.txt         # Dependencies

Documentation

Testing

# Run all tests
pytest

# Run with coverage
pytest --cov=src --cov-report=html

Contributing

This project is maintained by Virinco AS.

License

MIT License - see LICENSE for details.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywats_api-0.1.0b11.tar.gz (442.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pywats_api-0.1.0b11-py3-none-any.whl (568.6 kB view details)

Uploaded Python 3

File details

Details for the file pywats_api-0.1.0b11.tar.gz.

File metadata

  • Download URL: pywats_api-0.1.0b11.tar.gz
  • Upload date:
  • Size: 442.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pywats_api-0.1.0b11.tar.gz
Algorithm Hash digest
SHA256 3d8313b3df925f415869e5b7144bef3a6bf7e5525b93d9a9f360d68b75807e7f
MD5 a52580a8aba70ff74486f36033493af8
BLAKE2b-256 e7e33e08849c8b7c57dd2c3bc4bb1c19c9cdb4d3d7cd29a0dc80594900b6e8d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pywats_api-0.1.0b11.tar.gz:

Publisher: publish.yml on olreppe/pyWATS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pywats_api-0.1.0b11-py3-none-any.whl.

File metadata

  • Download URL: pywats_api-0.1.0b11-py3-none-any.whl
  • Upload date:
  • Size: 568.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pywats_api-0.1.0b11-py3-none-any.whl
Algorithm Hash digest
SHA256 f2677eb50fa06695dba3e62d8b73e3cc9e1ce5e6d8a77a692a2d89583e7b4f0d
MD5 01b8c5d4c806e755d837acf26f03b168
BLAKE2b-256 4dba3bfca45727f8e6f2fb16b38faaf32b217317e051c803e4e9eca94feea49f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pywats_api-0.1.0b11-py3-none-any.whl:

Publisher: publish.yml on olreppe/pyWATS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page