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.2


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.3

With uv:

uv add gp3sequencespy==0.1.3

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.3 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

Metadata

Release files for gp3sequencespy 0.1.3

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.3
File Size Uploaded
gp3sequencespy-0.1.3.tar.gz 1.4 MB Details

Built distribution (wheel)

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

Total release size: 1.5 MB

Release files / gp3sequencespy-0.1.3.tar.gz

Download URL gp3sequencespy-0.1.3.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
4281eb87141a7b193f37df8e43cc77dc618dc373db0b337b8a5932f273f5ef3e
BLAKE2b-256 checksum
How to use checksums
ab5fe765f1f24f22f9c16b36f60464103970d03e7ac9133b434f05abdcc025af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 21, 2026.

Transparency log

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

Download URL gp3sequencespy-0.1.3-py3-none-any.whl
Size 94.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6635db4aeff91201e1685a147e2f35d07acc28b2a776265045385b4fe4de8d63
BLAKE2b-256 checksum
How to use checksums
cdd90d3edc871005a5608f16c0ebb58dcdcf7c28d26e1b17eb5a1fa94d9c7e0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.4

2 release files

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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