Skip to main content

LitePolis-database-particiapi

ParticiAPI-compatible database module for LitePolis. This module extends LitePolis-database-default with ParticiAPI-specific models and functionality.

Overview

This module provides:

  • ParticiapiUser - Extended participant model with ParticiAPI fields
  • ParticipantExtended - Additional participant metadata
  • ParticiapiIssuer - OIDC issuer configuration
  • MathMain - Math results caching
  • NotificationTasks - Notification queue management

Installation

litepolis-cli deploy add-deps litepolis-database-particiapi
litepolis-cli deploy sync-deps

Configuration

This module shares database configuration with LitePolis-database-default. To customize, create a config file:

litepolis-cli deploy init-config

Then edit ~/.litepolis/litepolis.config:

[litepolis_database_default]
database_url = sqlite:///database.db
# For production:
# database_url = postgresql://user:pass@localhost:5432/litepolis
sqlalchemy_engine_pool_size = 30
sqlalchemy_pool_max_overflow = 50

Or set environment variables:

export DATABASE_URL="postgresql://user:pass@localhost:5432/litepolis"

Models

ParticiapiUser (participants table)

Column Type Description
pid INTEGER Participant ID (primary key)
uid INTEGER User ID
zid INTEGER Conversation ID
vote_count INTEGER Number of votes cast
last_interaction INTEGER Last activity timestamp (ms)
subscribed BOOLEAN Email subscription status
last_notified INTEGER Last notification timestamp (ms)
nsli INTEGER Not-since-last-interaction flag
mod INTEGER Moderation status
created DATETIME Creation timestamp

ParticipantExtended (participants_extended table)

Column Type Description
uid INTEGER User ID
zid INTEGER Conversation ID
referrer VARCHAR HTTP referrer
parent_url VARCHAR Parent page URL
created DATETIME Creation timestamp
modified DATETIME Last modified timestamp
subscribe_email BOOLEAN Email subscription
show_translation_activated BOOLEAN Translation feature
permanent_cookie VARCHAR Persistent cookie
origin VARCHAR Origin header

Quick Start

  1. Install all ParticiAPI modules:
litepolis-cli deploy add-deps litepolis-database-particiapi
litepolis-cli deploy add-deps litepolis-router-particiapi
litepolis-cli deploy add-deps litepolis-ui-particiapp
litepolis-cli deploy sync-deps
  1. Start LitePolis server:
litepolis-cli deploy serve

Usage

from litepolis_database_particiapi import DatabaseActor

# Get or create participant
participant = DatabaseActor.get_or_create_participant(zid=1, uid=1)

# Record vote
vote = DatabaseActor.do_vote(zid=1, pid=1, tid=1, vote=1)

# Get statements for conversation
statements = DatabaseActor.get_statements(zid=1)

DatabaseActor Methods

Method Description
get_or_create_participant(zid, uid) Get or create participant for conversation
do_vote(zid, pid, tid, vote) Record a vote
get_statements(zid) Get all statements for conversation
get_conversation(zid) Get conversation details
create_statement(zid, pid, text) Create new statement

Development Testing

pip install -e .
pytest tests/

License

MIT License

Metadata

Release files for litepolis-database-particiapi 0.0.2

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

Source distribution (sdist)

Source distribution for litepolis-database-particiapi 0.0.2
File Size Uploaded
litepolis_database_particiapi-0.0.2.tar.gz 15.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for litepolis-database-particiapi 0.0.2
File Interpreter ABI Platform
litepolis_database_particiapi-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 28.2 kB

Release files / litepolis_database_particiapi-0.0.2.tar.gz

Download URL litepolis_database_particiapi-0.0.2.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e60f01605f11eaeb14ed20d3be4d5dab65dc040c1db3b095ec525a7168b2fcbb
BLAKE2b-256 checksum
How to use checksums
3661bf61a01544c542431b8ecf69230c8026d146c962a4dbe7c2292417ffbe0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 24, 2026.

Transparency log

Release files / litepolis_database_particiapi-0.0.2-py3-none-any.whl

Download URL litepolis_database_particiapi-0.0.2-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcc3f9c781b9c8b96621c6efa7afc99e982ea0153abd7223193817a1f618386a
BLAKE2b-256 checksum
How to use checksums
11924f86272f20efe638c38685017be0b39564838a4d348964ddee568302d2da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.2 This release

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