Skip to main content

Red Dwarf: A Pol.is-like library

   ⚫⋆✦⋆⭑⋆⋆⋆⋆⋆          PyPI - Version Run Tests Deploy Docs

A DIMensional REDuction library for reproducing and experimenting with Polis-like data pipelines.

Red dwarf stars are dim red stars. They are hard to see, but are the most common type -- the quiet 70% majority. They burn slow, using fuel efficiently, making them the longest-living stars in the universe. They'll be around until the last light, even supporting habitable planets for billions of years. If there's persistant life out there, it's likely in a long slow dance with a red dwarf.

Features

  • Loads data from any Polis conversation on any Polis server, using only the conversation URL.
  • Reproduces Polis calculation pipeline from only raw vote data.
    • "Classic" Polis pipeline = PCA dimensional reduction, KMeans clustering, and comment statistics.
  • Alternative algorithms, aspiring for sensible defaults:
  • Helpful visualizations via matplotlib

Goals

Code that aspires to embody and support democratic values should be...

  • Legible. It should be explorable and auditable not just to researchers, but to as many curious citizens as possible.
  • Re-usable. It should be easily used in contexts in which its original creators did not anticipate, nor perhaps even desire.
  • Collectively stewarded. It should grow and govern itself democratically and in a plural fashion.

Roadmap

For now, see this related issue

Sponsors

Agora Citizen Network

Red Dwarf is generously sponsored by ZKorum SAS, creators of the Agora Citizen Network.

Are you or your organization eager to see more platforms and community built around democracy-supporting algorithms like these? Please consider getting in touch on Discord and supporting our continued work! (ping @patcon)

Usage

# OFFICIAL RELEASES

# For core, the classic polis pipeline: PCA + K-means
# (~60MB beyond scikit-learn disk space)
pip install red-dwarf

# For additional algorithms beyond classic polis: PaCMAP, LocalMAP, HDBSCAN, etc.
pip install red-dwarf[alt-algos]

# For additional packages for visualizing plots
pip install red-dwarf[plots]

# For everything (~60MB beyond core packages)
pip install red-dwarf[all]
# pip install red-dwarf[alt-algos,plots]

See docs/notebooks/polis-implementation-demo.ipynb or docs/notebooks/ for other examples.

screenshot of library-generated notebook screenshot of Polis-generated report
screen of the sample jupyter notebook screenshot of the polis report

Architecture

This is the generalized pipeline of Polis-like processes that we're aiming to accomodate. (See issue #53 for details.)

Get Involved

Running it for local development

  • Install python (preferrably virtual environment)
  • Install uv (python package manager) (e.g. pip install uv)
  • Install dependencies with make install-dev
  • Run make command alone to see other helpful make subcommands
  • Alternatively, run one of the ipynb notebooks; possibly replacing the install command at the top with %pip install -e ../../ to use the local source instead.

Contributing

  • Join the Polis User Group (PUG) Discord server.
  • Open a GitHub issue.
  • Submit a GitHub pull request.
  • Review the Awesome Polis directory to learn about related projects, academic papers, and other resources.
    • Use the "People" section to find other individuals and groups working in the field.

Changelog

See CHANGELOG.md.

License

MPL 2.0: Mozilla Public License 2.0 (See LICENSE)

Metadata

Release files for red-dwarf 0.4.0

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

Source distribution (sdist)

Source distribution for red-dwarf 0.4.0
File Size Uploaded
red_dwarf-0.4.0.tar.gz 49.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for red-dwarf 0.4.0
File Interpreter ABI Platform
red_dwarf-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 101.5 kB

Release files / red_dwarf-0.4.0.tar.gz

Download URL red_dwarf-0.4.0.tar.gz
Size 49.6 kB
Tags Source
SHA-256 checksum
How to use checksums
92f5d0120cb8dd758890246fbb8497bc559663333f1aaf9e871bff0cc9ea163e
BLAKE2b-256 checksum
How to use checksums
3fb7cd6609d8cc712809c5d9dbef3f7bcd797cd9b479ce84a71c11654cbf9634
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.2

Release files / red_dwarf-0.4.0-py3-none-any.whl

Download URL red_dwarf-0.4.0-py3-none-any.whl
Size 52.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b002bbb8b3f9b5864532a62860b1d76b307b6b8905cea1ab11f0a9c25154bb3
BLAKE2b-256 checksum
How to use checksums
d1ca1611e38e619cc8f4fffa7a0e90c84971810e9066d94d3c7019e96657eef2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.2

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

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