Skip to main content

Welcome to Sockpuppet 👋

downloads License: MIT Documentation
semantic-release Tests

🎉 You just discovered an exciting new way to build modern, reactive, real-time apps with Django.

Why should I spend time exploring this? If you use current frontend libraries, such as react, vue or angular you end up creating state for the frontend and then updating state changes in the backend through an api.

This means that you forgo server-rendered html with the advantages that brings + you'll end up with a more complex app overall.

With this library you can still use normal django templates, and any frontend state you change will be directly reflected in the backend. Currently this happens through the use of websockets.

This is the django implementation of the excellent rails library stimulus-reflex, which in turn is inspired by Phoenix LiveView.

Hit me up on twitter if you have any questions. Twitter follow

📚 Documentation

⚡️ Get started

pip install django-sockpuppet

# If performance is important you can take advantage lxml parsing
# It will typically speed up the round trip by 30-90ms depending on the html
pip install django-sockpuppet[lxml]

# Add these into INSTALLED_APPS in settings.py
INSTALLED_APPS = [
    'channels',
    'sockpuppet'
]

# generates scaffolding for webpack.config.js and installs required js dependencies
# if you prefer to do that manually read the more thorough documentation
python manage.py initial_sockpuppet

# scaffolds a new reflex with everything that's needed.
python manage.py generate_reflex app_name name_of_reflex

You're almost there, read about how to tie it all together in the quickstart documentation

💙 Community

  • Discord - We share the discord together with stimulus-reflex, and there is a channel dedicated for python/django discussions.
  • django-sockpuppet-expo - Do you want more examples? There code examples of chats, book search, etc ... We accept PRs :)

🛠 Development in the repo

See some common commands that can be useful for development

pip install -r requirements_dev.txt
invoke -l

Try out a minimal example manually

git clone git@github.com:jonathan-s/django-sockpuppet.git
npm install
npm run build:test
python manage.py runserver
# visit https://localhost:8000/test

⛑ Running tests locally

The most important tests are integration tests that makes sure that frontend and backend work together in conjunction with each other.

# Install the cypress et al
npm install

# Spin up a dev server that uses some fixtures
inv test-server

# Run the cypress tests
npm run cypress:run

🔜 Release

pip install -r requirements_dev.txt
invoke release -b feature

Metadata

Release files for django-sockpuppet 0.6.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 django-sockpuppet 0.6.0
File Size Uploaded
django-sockpuppet-0.6.0.tar.gz 36.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-sockpuppet 0.6.0
File Interpreter ABI Platform
django_sockpuppet-0.6.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 77.3 kB

Release files / django-sockpuppet-0.6.0.tar.gz

Download URL django-sockpuppet-0.6.0.tar.gz
Size 36.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a0f90239d855026876edcd3d4d835b3dca7f71579bb56d0de3ec39bf348929b3
BLAKE2b-256 checksum
How to use checksums
8d9d858d9ecee70cb7a31f9f13bd245a449cbd9122d3148d8dc9e629d295928d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.2

Release files / django_sockpuppet-0.6.0-py2.py3-none-any.whl

Download URL django_sockpuppet-0.6.0-py2.py3-none-any.whl
Size 41.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
478b7ef9936cf3914c08ee507abaa1daf7d5f2d9bea9efff3677d1d5b12e82e9
BLAKE2b-256 checksum
How to use checksums
7c75d1e5eeb966bb13b3bbdc7320f29928d30bf0f261868ddb771cad1b6dfd5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.0

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

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