Skip to main content

Python Suite research packages logo

gp3sequencespy

Transparent, reproducible sequence analysis in Python.
Audit ordered categorical data, discover recurring structure, compare trajectories, model transitions and latent states, test group differences, and report every analytical choice.

PyPI Python versions CI Docs Quality MIT License DOI

Documentation · Quickstart · Method map · Plot gallery · API reference · v0.1.4


gp3sequencespy is the Python implementation of gp3sequences 0.3.0 for ordered categorical sequences and scanpaths. The frozen R 0.3.0 tarball is the behavioral reference: scientific contracts are preserved and tested explicitly, while deliberate R→Python translations are documented rather than hidden.

The package is designed for research workflows where data preparation, method choice, reproducibility, and interpretation need to remain visible from input to report.

Install

pip install gp3sequencespy==0.1.4

With uv:

uv add gp3sequencespy==0.1.4

Python 3.11–3.14 is supported. Optional extras are available for HMM backends, Arrow/Polars data interoperability, performance helpers, time-varying models, documentation, and development.

pip install "gp3sequencespy[hmm]"
pip install "gp3sequencespy[data]"
pip install "gp3sequencespy[time]"

A 60-second workflow

import pandas as pd
import gp3sequencespy as g

# One row per observed state occurrence.
data = pd.DataFrame(
    {
        "sequence_id": ["s1", "s1", "s1", "s2", "s2", "s2"],
        "sequence_order": [1, 2, 3, 1, 2, 3],
        "state": ["home", "search", "checkout", "home", "product", "checkout"],
    }
)

# Audit and prepare explicitly.
validation = g.validate_sequence_data(
    data,
    "sequence_id",
    "sequence_order",
    "state",
)
prepared = g.prepare_sequence_data(
    data,
    "sequence_id",
    "sequence_order",
    "state",
)

# Compare complete trajectories.
distance = g.compute_sequence_distance(
    prepared.data,
    method="lcs",
    normalise="max_length",
)

# Inspect transition structure.
network = g.create_transition_network(
    prepared.data,
    normalise="from",
)

# Visualise complete paths.
ax = g.plot_sequence_index(prepared.data)

For the complete path from raw long-format data to summaries, motifs, clustering, networks, plots, and analysis auditing, see the Quickstart.

What you can do

Research task Capabilities Start here
Audit & prepare ordering, missing states, duplicate positions, durations, state policies, preparation provenance Validation & preparation
Describe sequences state occupancy, transitions, paths, consensus, representatives Examples
Find recurring structure contiguous motifs, bounded non-contiguous subsequences, motif filtering and visualisation Motif workflow
Compare trajectories Levenshtein, LCS, optimal matching, transition-profile distances, clustering and stability Distances & clustering
Model transitions transition networks, centrality, communities, higher-order transition structure Networks & higher-order models
Fit latent models categorical, multichannel, covariate-dependent and time-varying HMM workflows Latent models
Test group structure design-aware randomization and sequence-group inference Inference & randomization
Visualise & report sequence index, state distributions, distance heatmaps, transition networks, audit trails Plot gallery

Not sure which family fits your question? Use the method map to move from research question → assumptions → method family.

Parity and validation

Version 0.1.4 is a maintenance release preserving the 0.1.2 scientific contracts while strengthening release automation and public documentation.

Validation contract Status
Frozen R public counterparts 81 / 81
Frozen R public signatures audited 81 / 81
Frozen R test_that() blocks translated 130 / 130
Python tests 293
Statement coverage 100%
Branch coverage 100%
Mutation smoke 3 / 3 killed
CI platforms Linux · macOS · Windows
CI Python versions 3.11 · 3.12 · 3.13 · 3.14
Python-native articles 15

The deterministic core, hierarchical/PAM, and time-varying-model cross-language oracle tranches have been executed against frozen R 0.3.0. Remaining deliberate boundaries are recorded in PARITY_EXCEPTIONS.md, with broader parity evidence in PARITY_TEST_MATRIX.md and the online parity guide.

Documentation routes

If you want to… Go to
get from install to first analysis quickly Quickstart
choose a method by research question Method map
copy complete analysis recipes Examples
inspect available figure families Plot gallery
read the full methodological guides Articles
translate from the R package R → Python
browse functions and signatures API reference
document a reproducible analysis Reproducibility · Reporting guide

Reproducibility and release governance

The package treats release and parity evidence as part of the scientific software contract.

Stable releases publish the exact validated GitHub Release wheel and source distribution to PyPI through GitHub OIDC Trusted Publishing. Each publication is subsequently checked against the GitHub Release SHA-256 hashes and with a clean PyPI installation.

Development

uv sync --all-extras --python 3.12
uv run pytest -q

Full quality gate:

uv run pytest -q \
  --cov=gp3sequencespy \
  --cov-branch \
  --cov-report=term-missing \
  --cov-fail-under=100

uv run python scripts/run_mutation_smoke.py

See CONTRIBUTING.md for contribution guidance and SECURITY.md for the security policy.

Citation

If gp3sequencespy contributes to your research, use the repository citation metadata in CITATION.cff and the archived Zenodo record:

DOI: 10.5281/zenodo.22166449

Scientific interpretation guardrail

Sequence structure does not independently establish emotion, cognition, comprehension, personality, intention, deception, diagnosis, or causality. Observational group contrasts are associational unless a valid randomized design supports a causal interpretation.


Documentation · PyPI · Releases · Zenodo

October 2026 research article and figure

Scanpath transfer and brief-event preservation documents experimental, source-only validation methods and reproducible synthetic examples. It is available in the website navigation, while independently qualified external empirical claims and stable PyPI APIs remain separate (scientific acceptance criteria).

Original synthetic research figure

Metadata

Release files for gp3sequencespy 0.1.5

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

Source distribution (sdist)

Source distribution for gp3sequencespy 0.1.5
File Size Uploaded Provenance
gp3sequencespy-0.1.5.tar.gz 1.4 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for gp3sequencespy 0.1.5
File Interpreter ABI Platform
gp3sequencespy-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / gp3sequencespy-0.1.5.tar.gz

Download URL gp3sequencespy-0.1.5.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
8bea30f602e8aef1fdf35b49e06f47fc14cdd767a6e52a7fa33b2602c76f95eb
BLAKE2b-256 checksum
How to use checksums
3b68ff08461599252c36e0b28ca8221443480ae7adf0a53173f159a2187e0a80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / gp3sequencespy-0.1.5-py3-none-any.whl

Download URL gp3sequencespy-0.1.5-py3-none-any.whl
Size 95.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9067a91a59b908456b98c5212a948a30bac7cbc07196bfefbcd1beda603c0e82
BLAKE2b-256 checksum
How to use checksums
149454ae73b837419484e9afb1ca1b5c53e421798280f30a02fd3017a348a434
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for gp3sequencespy 0.1.5

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gp3sequencespy-0.1.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

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.

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