===============
It is common task in all web frameworks — to provide an easy way to reload development
server on code changes. Most of these frameworks are carrying a reloader's code with
themselves. And there isn't any python module, simple enougth to use in a small project.
Some times ago, I started to write a chat bot called [TheBot][] and begun to look for
a separate server reloader's implementation. And found nothing suitable.
Then, I extracted autoreloader from the Django's codebase and put it into a separate
module, which README you are reading now. Code was partly modified, now it allows
not only to watch on file changes but also to reload upon a some event.
Reload on some event is a quite useful feature for [TheBot][], because now he can update
himself on a push to the GitHub. A pseudocode for this procedure will look like:
def on_push_to_the_github_master_branch():
make_git_pull()
run_pip_install()
trigger_code_reload()
And I don't need an external watcher to run bot, because now he uses [server-reloader][].
Example usage
-------------
Here is a simple example, how to use a reloader.
```python
def run_server():
"""Some function, which creates and runs your server."""
pass
def main():
server_reloader.main(
run_server,
before_reload=lambda: print('Reloading code…')
)
if __name__ == '__main__':
main()
```
If you want to trigger code reloading on some custom event, then just do:
```python
from server_reloader import trigger_reload
trigger_reload()
```
Credentials
-----------
Many thanks to original authors of the autoreloader, I took as the basis.
[TheBot]: http://github.com/svetlyak40wt/thebot
[server-reloader]: http://github.com/svetlyak40wt/server-reloader
Metadata
Release files for server-reloader 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| server-reloader-0.1.3.tar.gz | 4.7 kB | Without provenance | Details for server-reloader-0.1.3.tar.gz |
Release files / server-reloader-0.1.3.tar.gz
| Download URL | server-reloader-0.1.3.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9b6ed6a45f21e078faacee352394659b4675a76d72b62912676a936453f22f8
|
|
BLAKE2b-256 checksum How to use checksums |
01124bc7661e34fc8e09e882cc605a85320681339a7d0081405cf06879a64600
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for server-reloader 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.