Package: python-hooks
Python HooksA React inspired way to code in Python.If you like this project, consider starring it on Github ⭐⭐⭐⭐⚡️ Written with performance in mind(Not using inspect module)🐍 Support for familiar React like hooks such asuse_state,use_effect,use_reducer,use_contextand more.🛠️ Built with plugins support and easy to extend.🤝 Python 3.9+ compatibility🪶 Lightweight to remove the need for a lot of boilerplate code.📦 Support for different backend state-stores.🔧 Support for hooks-state scoping.🌎 Redis, Redux, and Zustand plugins out of the box.🔌 Tested mainly on CPython.InspirationI'll begin be prefacing that this project will not fit everyone's needs. It's a very opinionated project and it's not meant to be a replacement for any of the existing state management libraries.
Additionally, if you are trying to squeeze the most performance out of Python this is probably not the right tool for you(Though you might also be using the wrong programming language).The goal of the project is to provide a simple and familiar way to manage state in Python. It's inspired by the React hooks API and it's meant to be used in a similar way. It can be used to manage
state in a single function or in a large project. The state can be stored in memory, in a database or in a file. It's up to you to decide and the library is easily extendable to support any backend.One of the inspirations for this project was seeing the way junior developers struggle with state management and program structure in Python. This library is intended to provide a sense of familiarity
to developers coming from the JavaScript world and to provide a simple way to manage state in Python which will not require a lot of boilerplate code or hurt performance.It is meant to help write better data-driven code and to help developers focus on the business logic of their code rather than on the plumbing.Discord|DocsNote: This project is still in beta and is not recommended for production use just yet. We are working on adding more tests and improving the documentation. If you are interested in contributing, please reach out to me onDiscord.Let's see one API exampleAs Python is commonly used to create APIs, I wanted to provide one real-world example of using hooks for state management in Flask. Note, that this is just one example and the library can be used in many other ways. Seeexamplesfor more examples.Pretty neat, right?🚀 Installationpipinstallpython-hooks🎯 What's nextWell, that's up to you 💪🏻. We are looking for contributors to help us build this project and make it better. If you are interested in contributing, please reach out to me onDiscordor open an issue.
In addition we are looking for plugin developers to help us build more plugins for different state stores.📈 ReleasesYou can see the list of available releases on theGitHub Releasespage.We followSemantic Versionsspecification.We useRelease Drafter. As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you’re ready. With the categories option, you can categorize pull requests in release notes using labels.List of labels and corresponding titlesLabelTitle in Releasesenhancement,feature🚀 Featuresbug,refactoring,bugfix,fix🔧 Fixes & Refactoringbuild,ci,testing📦 Build System & CI/CDbreaking💥 Breaking Changesdocumentation📝 Documentationdependencies⬆️ Dependencies updatesGitHub creates thebug,enhancement, anddocumentationlabels for you. Dependabot creates thedependencieslabel. Create the remaining labels on the Issues tab of your GitHub repository, when you need them.📋 RoadmapFinish documentationImprove frame identifier without hurting performanceDevelop state-debugger pluginAdd redux pluginAsync support ⚡Additional hooksuse_refTest and adapt to PyPy, Jython, IronPythonSupport for more hook backendsMongoDBPostgresMySQLSQLiteFileMore testsSee theopen issuesfor a full list of proposed features (and known issues).🛡 LicenseThis project is licensed under the terms of theMITlicense. SeeLICENSEfor more details.📃 Citation@misc{python-hooks,author={Amit Assaraf},title={A React inspired way to code in Python},year={2023},publisher={GitHub},journal={GitHub repository},howpublished={\url{https://github.com/amitassaraf/python-hooks}}}