py-wait-until 0.0.1__tar.gz → 0.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,11 @@
1
+ Metadata-Version: 2.3
2
+ Name: py-wait-until
3
+ Version: 0.0.3
4
+ Summary: Print a loading spinner while another command is running.
5
+ Author: billwallis
6
+ Requires-Python: >=3.13
7
+ Description-Content-Type: text/markdown
8
+
1
9
  <span align="center">
2
10
 
3
11
  [![Python](https://img.shields.io/badge/Python-3.11+-blue.svg)](https://www.python.org/downloads/)
@@ -15,16 +23,37 @@
15
23
 
16
24
  # Wait Until
17
25
 
18
- Print a loading spinner while another process is running.
26
+ Print a loading spinner while another command is running.
19
27
 
20
28
  ## Usage
21
29
 
22
- Simply prepend `py-wait-until` to any command:
30
+ `py-wait-until` is a CLI tool which runs a command and displays a loading spinner while the command is executing.
31
+
32
+ The easiest way to use `py-wait-until` is via [`uvx`](https://docs.astral.sh/uv/guides/tools/), for example:
23
33
 
24
34
  ```shell
35
+ uvx py-wait-until python -c "import time; time.sleep(2)"
36
+ ```
37
+
38
+ Alternatively, install from PyPI and run without `uvx`:
39
+
40
+ ```shell
41
+ pip install py-wait-until
25
42
  py-wait-until python -c "import time; time.sleep(2)"
26
43
  ```
27
44
 
45
+ The return code of the original command is preserved. Specifying no command will exit with code 1 and show the help message.
46
+
47
+ ### Custom loading message
48
+
49
+ You can specify a custom loading message using the `--message` (or `-m`) option:
50
+
51
+ ```shell
52
+ uvx py-wait-until --message "Processing..." python -c "import time; time.sleep(2)"
53
+ ```
54
+
55
+ This option _must_ be specified before the command to run
56
+
28
57
  ## Contributing
29
58
 
30
59
  Install [uv](https://docs.astral.sh/uv/getting-started/installation/) and then install the dependencies:
@@ -1,11 +1,3 @@
1
- Metadata-Version: 2.3
2
- Name: py-wait-until
3
- Version: 0.0.1
4
- Summary: Print a loading spinner while another process is running.
5
- Author: billwallis
6
- Requires-Python: >=3.13
7
- Description-Content-Type: text/markdown
8
-
9
1
  <span align="center">
10
2
 
11
3
  [![Python](https://img.shields.io/badge/Python-3.11+-blue.svg)](https://www.python.org/downloads/)
@@ -23,16 +15,37 @@ Description-Content-Type: text/markdown
23
15
 
24
16
  # Wait Until
25
17
 
26
- Print a loading spinner while another process is running.
18
+ Print a loading spinner while another command is running.
27
19
 
28
20
  ## Usage
29
21
 
30
- Simply prepend `py-wait-until` to any command:
22
+ `py-wait-until` is a CLI tool which runs a command and displays a loading spinner while the command is executing.
23
+
24
+ The easiest way to use `py-wait-until` is via [`uvx`](https://docs.astral.sh/uv/guides/tools/), for example:
31
25
 
32
26
  ```shell
27
+ uvx py-wait-until python -c "import time; time.sleep(2)"
28
+ ```
29
+
30
+ Alternatively, install from PyPI and run without `uvx`:
31
+
32
+ ```shell
33
+ pip install py-wait-until
33
34
  py-wait-until python -c "import time; time.sleep(2)"
34
35
  ```
35
36
 
37
+ The return code of the original command is preserved. Specifying no command will exit with code 1 and show the help message.
38
+
39
+ ### Custom loading message
40
+
41
+ You can specify a custom loading message using the `--message` (or `-m`) option:
42
+
43
+ ```shell
44
+ uvx py-wait-until --message "Processing..." python -c "import time; time.sleep(2)"
45
+ ```
46
+
47
+ This option _must_ be specified before the command to run
48
+
36
49
  ## Contributing
37
50
 
38
51
  Install [uv](https://docs.astral.sh/uv/getting-started/installation/) and then install the dependencies:
@@ -6,8 +6,8 @@ build-backend = "uv_build"
6
6
 
7
7
  [project]
8
8
  name = "py-wait-until"
9
- version = "0.0.1"
10
- description = "Print a loading spinner while another process is running."
9
+ version = "0.0.3"
10
+ description = "Print a loading spinner while another command is running."
11
11
  authors = [{name = "billwallis"}]
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.13"
@@ -32,7 +32,7 @@ def _spinner() -> Generator[str]:
32
32
  yield chars[index % len(chars)]
33
33
 
34
34
 
35
- def _wait_for_process(cmd: list[str]) -> int:
35
+ def _wait_for_process(cmd: list[str], message: str) -> int:
36
36
  """
37
37
  Execute a command and display a waiting message until it completes.
38
38
  """
@@ -53,7 +53,7 @@ def _wait_for_process(cmd: list[str]) -> int:
53
53
  if is_tty:
54
54
  _write_line(
55
55
  sys.stdout,
56
- f"\rWaiting for process to finish... {next(spin)}",
56
+ f"\r{message} {next(spin)}",
57
57
  )
58
58
  time.sleep(WAIT_DURATION_SECONDS)
59
59
 
@@ -72,16 +72,24 @@ def _wait_for_process(cmd: list[str]) -> int:
72
72
 
73
73
  def main(argv: Sequence[str] | None = None) -> int:
74
74
  """
75
- Wait until a command completes.
75
+ Print a loading spinner while another process is running.
76
76
  """
77
77
 
78
78
  parser = argparse.ArgumentParser(
79
- description="Wait until a command completes.",
79
+ description="Print a loading spinner while another command is running.",
80
80
  )
81
81
  parser.add_argument(
82
82
  "command",
83
83
  nargs=argparse.REMAINDER,
84
- help="Command and arguments to execute",
84
+ help="Command(s) to execute",
85
+ )
86
+ parser.add_argument(
87
+ "-m",
88
+ "--message",
89
+ type=str,
90
+ required=False,
91
+ default="Waiting for process to finish...",
92
+ help="Message to display while waiting",
85
93
  )
86
94
 
87
95
  args = parser.parse_args(argv)
@@ -89,7 +97,10 @@ def main(argv: Sequence[str] | None = None) -> int:
89
97
  parser.print_help()
90
98
  return 1
91
99
 
92
- return _wait_for_process(args.command)
100
+ return _wait_for_process(
101
+ cmd=args.command,
102
+ message=args.message,
103
+ )
93
104
 
94
105
 
95
106
  if __name__ == "__main__":