Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Reloadr + A Bunch of Little Extensions.
Reloadr is a great tool to hot-reload Python code.
This library is based on Reloadr, with a bunch of little extensions added.
You can decorate the target with @autoreload
just like Reloadr.
from reloadrable import autoreload
@autoreload
def target_function(a, b):
return a + b
@autoreload
class TargetClass:
def __init__(self):
print("Target class is created.")
You can decorate the target with @autoupdate
instead of @autoreload
.
from reloadrable import autoupdate, ReloadableHandler
@autoupdate
def target_function(a, b):
return a + b
@autoupdate
class TargetClass:
def __init__(self):
print("Target class is created.")
You can use @autoreload_with
to set an event handler and/or a file path to be observed.
from reloadrable import autoreload_with, ReloadableHandler
class FuncReloadingHandler(ReloadableHandler):
def on_reloaded(self, target):
print(f"{str(target)} reloaded")
@autoreload_with(handler=FuncReloadingHandler())
def target_function(a, b):
return a + b
@autoreload_with(file_path="/path/to/be/observed")
class TargetClass:
def __init__(self):
print("Target class is created.")
You can use @autoupdate_with
to set an event handler and/or the interval between periodic reloading.
from reloadrable import autoupdate_with, ReloadableHandler
class FuncReloadingHandler(ReloadableHandler):
def on_reloaded(self, target):
print(f"{str(target)} reloaded")
@autoupdate_with(handler=FuncReloadingHandler())
def target_function(a, b):
return a + b
@autoupdate_with(interval=1.5)
class TargetClass:
def __init__(self):
print("Target class is created.")
You can manually reload the target just like Reloadr.
Besides, you can manually control reloading without warnings in IDEs.
from pathlib import Path
from reloadrable import reloadr, ReloadableHandler
@reloadr
class Gear:
def shift(self):
print("Rattling")
# Manual reload (just like Reloadr)
Gear._reload()
# Manual reload (without warning in IDEs)
Gear.reload()
# Start auto-reloading on file modification (just like Reloadr)
Gear._start_watch_reload()
# Start auto-reloading on file modification (without warning in IDEs)
Gear.start_on_modified_update()
# Start periodic reloading (just like Reloadr)
Gear._start_timer_reload(1)
# Start periodic reloading (without warning in IDEs)
Gear.start_periodic_update(interval=1)
# Add an event handler
class GearReloadingHandler(ReloadableHandler):
def on_reloaded(self, target):
if isinstance(target, Gear):
target.shift()
Gear.set_handler(handler=GearReloadingHandler())
# Add a file path to be observed for reloading the target
Gear.set_file_path(file_path="/path/to/be/observed")
# You can use pathlib.Path as well as str
Gear.set_file_path(file_path=Path("/path/to/be/observed"))
You can use ReloadableManager
to stop periodical reloads and to stop reloads on file modifications.
from reloadrable import ReloadableManager
# Stop all periodical reloads
ReloadableManager.stop_periodic_updates()
# Stop all observations of file modification.
ReloadableManager.stop_on_modified_updates()
This library is based on Reloadr.
Copyright 2015-2020, Hugo Herter and the Reloadr contributors.
Reloadr is licensed under the GNU Lesser General Public License v3.0.
Copyright 2021-2021, Yuta Urushiyama,
Copyright 2015-2020, Hugo Herter and the Reloadr contributors.
Reloadrable is licensed under the same license as Reloadr.
FAQs
Reloadr's hot-reloading Python code + a bunch of little extensions.
We found that Reloadrable 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.