npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sockpuppet-js

v0.6.0

Published

Websocket consumer to support django-sockpuppet / stimulus-reflex.

Downloads

30

Readme

🎉 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 [email protected]: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