From d65f77299b2c044749dc662df084256d4f02862e Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Wed, 17 May 2023 04:45:23 +0000 Subject: automatic import of python-jurigged --- .gitignore | 1 + python-jurigged.spec | 849 +++++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 851 insertions(+) create mode 100644 python-jurigged.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..157badc 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/jurigged-0.5.5.tar.gz diff --git a/python-jurigged.spec b/python-jurigged.spec new file mode 100644 index 0000000..d0aaad1 --- /dev/null +++ b/python-jurigged.spec @@ -0,0 +1,849 @@ +%global _empty_manifest_terminate_build 0 +Name: python-jurigged +Version: 0.5.5 +Release: 1 +Summary: Live update of Python functions +License: MIT +URL: https://github.com/breuleux/jurigged +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c3/92/f5aef98421e55884037f14fee9b4ff95f2cd4928d60a2ffec358e8ddedbb/jurigged-0.5.5.tar.gz +BuildArch: noarch + +Requires: python3-blessed +Requires: python3-codefind +Requires: python3-ovld +Requires: python3-watchdog +Requires: python3-giving +Requires: python3-rich + +%description + +# jurigged + +Jurigged lets you update your code while it runs. Using it is trivial: + +1. `jurigged your_script.py` +2. Change some function or method with your favorite editor and save the file +3. Jurigged will hot patch the new function into the running script + +Jurigged updates live code smartly: changing a function or method will fudge code pointers so that all existing instances are simultaneously modified to implement the new behavior. When modifying a module, only changed lines will be re-run. + +![demo](https://user-images.githubusercontent.com/599820/113785377-ffab1e80-9704-11eb-9c82-6d866c9087a6.gif) + +You can also optionally install the [develoop](#develoop), a terminal-based live development environment: + +![develoop2](https://user-images.githubusercontent.com/599820/165631993-8c428e4b-51d2-48d7-ae15-93bfc09c70af.gif) + +As seen above, `jurigged --loop script.py` will "loop" on a particular function of the script. That funtion will be re-run every time the source code is modified, with changes hot-patched into the running process. The rest of the program is *not* re-run, so preprocessing is preserved and heavy modules do not have to be reloaded! + +## Install + +Jurigged requires Python version >= 3.8. + +```bash +pip install jurigged +``` + +To also install the develoop feature, which lets you interactively develop functions: + +```bash +pip install jurigged[develoop] +``` + +## Command line + +The simplest way to use jurigged is to add `-m jurigged` to your script invocation, or to use `jurigged` instead of `python`. You can use `-v` to get feedback about what files are watched and what happens when you change a file. + +```bash +python -m jurigged -v script.py + +OR + +jurigged -v script.py +``` + +With no arguments given, it will start a live REPL: + +```bash +python -m jurigged + +OR + +jurigged +``` + +Full help: + +``` +usage: jurigged [-h] [--interactive] [--watch PATH] [--debounce DEBOUNCE] [--poll POLL] [-m MODULE] [--dev] [--verbose] [--version] + [SCRIPT] ... + +Run a Python script so that it is live-editable. + +positional arguments: + SCRIPT Path to the script to run + ... Script arguments + +optional arguments: + -h, --help show this help message and exit + --interactive, -i Run an interactive session after the program ends + --watch PATH, -w PATH + Wildcard path/directory for which files to watch + --debounce DEBOUNCE, -d DEBOUNCE + Interval to wait for to refresh a modified file, in seconds + --poll POLL Poll for changes using the given interval + -m MODULE Module or module:function to run + --dev Inject jurigged.loop.__ in builtins + --verbose, -v Show watched files and changes as they happen + --version Print version +``` + +## Develoop + +Usage: + +```bash +# Loop over a function +jurigged --loop function_name script.py +jurigged --loop module_name:function_name script.py + +# Only stop on exceptions +jurigged --xloop function_name script.py +``` + +The "develoop" is an optional feature of Jurigged that provides a sort of live development environment for a function. If you run `jurigged --loop