Skip to main content

Snowplow Signals logo

Snowplow Signals Python SDK

Early Release Test PyPI version License

The Snowplow Signals Python SDK enables you to interact with the Snowplow Signals Profile API. It provides a simple interface to define, deploy, and retrieve user attributes for personalization.

🚀 Start free on the Snowplow Signals developer tier.

📚 Read the documentation for the full Signals Python SDK setup and usage guide.

Installation

pip install snowplow-signals

Quickstart

from snowplow_signals import Signals, SignalsSandbox, Attribute, Event, StreamAttributeGroup, domain_sessionid

# Initialize the SDK with BDP authentication (default)
signals = Signals(
    api_url="API_URL",
    api_key="API_KEY",
    api_key_id="API_KEY_ID",
    org_id="ORG_ID",
)

# Or initialize with SANDBOX authentication
signals = SignalsSandbox(
    api_url="API_URL",
    sandbox_token="YOUR_SANDBOX_TOKEN",
)

# Define an attribute
page_view_count = Attribute(
    name="page_view_count",
    type="int32",
    events=[
        Event(
            vendor="com.snowplowanalytics.snowplow",
            name="page_view",
            version="1-0-0",
        )
    ],
    aggregation="counter"
)

# Create and deploy a view
stream_attribute_group = StreamAttributeGroup(
    name="my_attribute_group",
    version=1,
    attribute_key=domain_sessionid,
    attributes=[page_view_count],
)
signals.publish([stream_attribute_group])

# Retrieve attributes
response = signals.get_group_attributes(
    name="my_attribute_group",
    version=1,
    attribute_key="domain_sessionid",
    attributes=["page_view_count"],
    identifier="abc-123",
)

Key Features

  • Define attributes based on Snowplow events
  • Create attribute groups for related attributes
  • Deploy attribute groups to the Profile API
  • Retrieve real-time user attributes
  • Build training datasets with session-based or custom anchors
  • Execute dataset builds server-side and preview results

Dataset Builder

Build training datasets from your Snowplow events using the dataset builder. You can generate SQL bundles locally or submit dataset builds for server-side execution.

Generate SQL bundle

from datetime import datetime, timezone
from snowplow_signals import Signals, Criteria, Criterion, TrainingSpan
from snowplow_signals.models import AtomicProperty

bundle = signals.build_dataset_with_session_anchors(
    attribute_groups=[my_attribute_group],
    goal_criteria=Criteria(
        any=[Criterion.eq(AtomicProperty(name="se_action"), "purchase")]
    ),
    training_span=TrainingSpan(
        start_time=datetime(2025, 1, 1, tzinfo=timezone.utc),
        end_time=datetime(2025, 6, 1, tzinfo=timezone.utc),
    ),
)

# Save SQL files to disk
bundle.save_to("./dataset_output")

Server-side execution

Submit a dataset build for execution on your warehouse and poll for results:

import time
from snowplow_signals import DatasetRunStatus

run = signals.submit_dataset_run_with_session_anchors(
    attribute_groups=[my_attribute_group],
    goal_criteria=Criteria(
        any=[Criterion.eq(AtomicProperty(name="se_action"), "purchase")]
    ),
    training_span=TrainingSpan(
        start_time=datetime(2025, 1, 1, tzinfo=timezone.utc),
        end_time=datetime(2025, 6, 1, tzinfo=timezone.utc),
    ),
)

# Poll for completion
while True:
    status = signals.get_dataset_run_status(run.id)
    if status.status != DatasetRunStatus.PENDING:
        break
    time.sleep(5)

# Preview results
if status.status == DatasetRunStatus.SUCCESS:
    preview = signals.get_dataset_run_preview(run.id, limit=100)
    df = preview.to_pandas()
    print(df)

The Snowplow Signals Python SDK is copyright 2025-2027 Snowplow Analytics Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Metadata

Release files for snowplow-signals 0.4.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snowplow-signals 0.4.11
File Size Uploaded Provenance Actions
snowplow_signals-0.4.11.tar.gz 49.4 kB Without provenance Details for snowplow_signals-0.4.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for snowplow-signals 0.4.11
File Interpreter ABI Platform Actions
snowplow_signals-0.4.11-py3-none-any.whl Python 3 none any Details for snowplow_signals-0.4.11-py3-none-any.whl

Total release size: 109.0 kB

Release files / snowplow_signals-0.4.11.tar.gz

Download URL snowplow_signals-0.4.11.tar.gz
Size 49.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cba226bacd1ae6387001b0240e082ed92c23b479277fbff75926b1cad92da32c
BLAKE2b-256 checksum
How to use checksums
6cfc455f6ba9d02c5b9159ff9a1ba0b4b0ee9ea1329424bafe44f28f310c27f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.17 Linux/7.0.0-1017-azure

Release files / snowplow_signals-0.4.11-py3-none-any.whl

Download URL snowplow_signals-0.4.11-py3-none-any.whl
Size 59.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ca1a0d5b1c1ac7393a81c71da05f67d18b5ab3afdf05ae12c99cfc9d5ff354d
BLAKE2b-256 checksum
How to use checksums
338a905534da80a5322efd63d8423ba4e6c83b29dda38394faea1f403088b87f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.17 Linux/7.0.0-1017-azure

Security for snowplow-signals 0.4.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.11 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page