
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
StatefulPy provides transparent, persistent state management for regular Python functions.
MIGHT NOT BE FULLY FUNCTIONAL YET, STILL BEING WORKED ON
pip install statefulpy
For Redis support:
pip install statefulpy[redis]
The default serializer used by StatefulPy is Pickle for performance reasons.
However, Pickle is insecure if processing untrusted input.
For public-facing or untrusted data applications, use the JSON serializer instead:
@stateful(backend="sqlite", db_path="state.db", serializer="json")
def my_function():
# Your function code...
from statefulpy import stateful
@stateful(backend="sqlite", db_path="counter.db")
def counter():
# Initialize state if needed
if "count" not in counter.state:
counter.state["count"] = 0
# Update state
counter.state["count"] += 1
return counter.state["count"]
# The counter value persists across runs
print(counter()) # 1 (first run)
print(counter()) # 2
# Restart your program...
print(counter()) # 3 (value loaded from storage)
@stateful(backend="sqlite", db_path="state.db", serializer="pickle")
def my_function():
# Your function code...
@stateful(backend="redis", redis_url="redis://localhost:6379/0")
def my_function():
# Your function code...
from statefulpy import set_backend
# Set default backend for all @stateful functions
set_backend("redis", redis_url="redis://localhost:6379/0")
StatefulPy supports multiple serialization formats depending on your needs:
Using JSON serializer (Recommended for security):
@stateful(backend="sqlite", db_path="state.db", serializer="json")
def my_function():
# Your function code...
Using Pickle serializer (Faster, but only for trusted data):
⚠️ Warning: Only use Pickle when you fully trust your data sources.
@stateful(backend="sqlite", db_path="state.db", serializer="pickle")
def my_function():
# Your function code...
StatefulPy includes CLI utilities for managing backends:
Initialize storage:
statefulpy init --backend sqlite --path state.db
Migrate between backends:
statefulpy migrate --from sqlite --to redis --from-path state.db --to-path redis://localhost:6379/0
Check backend health:
statefulpy healthcheck --backend redis --path redis://localhost:6379/0
This project is licensed under the MIT License.
See the LICENSE file for full details.
FAQs
Transparent persistent state management for Python functions
We found that statefulpy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.