k3shell 0.1.5__tar.gz → 0.1.6__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,22 +1,21 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k3shell
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: Shell command dispatcher with nested subcommand support
5
5
  Author-email: Zhang Yanpo <drdr.xp@gmail.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/pykit3/k3shell
8
8
  Project-URL: Documentation, https://k3shell.readthedocs.io
9
9
  Keywords: shell,command,cli,subcommand,argparse
10
10
  Classifier: Development Status :: 4 - Beta
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Topic :: Software Development :: Libraries
13
- Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
17
15
  Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Programming Language :: Python :: 3.12
19
- Requires-Python: >=3.9
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.10
20
19
  Description-Content-Type: text/markdown
21
20
  License-File: LICENSE
22
21
  Requires-Dist: k3dict
@@ -66,34 +65,38 @@ pip install k3shell
66
65
  # Synopsis
67
66
 
68
67
  ```python
68
+ import sys
69
69
 
70
70
  import k3shell
71
- import sys
71
+
72
72
  arguments = {
73
- 'echo_repr': (
73
+ "echo_repr": (
74
74
  lambda x: sys.stdout.write(repr(x)),
75
- ('x', {'nargs': '+', 'help': 'just an input message'}),
75
+ ("x", {"nargs": "+", "help": "just an input message"}),
76
76
  ),
77
-
78
- 'foo': {
79
- 'bar': lambda: sys.stdout.write('bar'),
80
-
81
- 'bob': {
82
- 'plus': (
77
+ "foo": {
78
+ "bar": lambda: sys.stdout.write("bar"),
79
+ "bob": {
80
+ "plus": (
83
81
  lambda x, y: sys.stdout.write(str(x + y)),
84
- ('x', {'type': int, help: 'an int is needed'}),
85
- ('y', {'type': int, help: 'an int is needed'}),
82
+ ("x", {"type": int, help: "an int is needed"}),
83
+ ("y", {"type": int, help: "an int is needed"}),
86
84
  ),
87
85
  },
88
86
  },
89
-
90
- '__add_help__': {
91
- ('echo_repr',) : 'output what is input.',
92
- ('foo', 'bar',) : 'print a "bar".',
93
- ('foo', 'bob', 'plus',) : 'do addition operation with 2 numbers.',
87
+ "__add_help__": {
88
+ ("echo_repr",): "output what is input.",
89
+ (
90
+ "foo",
91
+ "bar",
92
+ ): 'print a "bar".',
93
+ (
94
+ "foo",
95
+ "bob",
96
+ "plus",
97
+ ): "do addition operation with 2 numbers.",
94
98
  },
95
-
96
- '__description__': 'this is an example command.',
99
+ "__description__": "this is an example command.",
97
100
  }
98
101
 
99
102
  k3shell.command(**arguments)
@@ -145,13 +148,13 @@ optional arguments:
145
148
 
146
149
  # Author
147
150
 
148
- Wenbo Li(李文博) <wenbo.li@baishancloud.com>
151
+ Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
149
152
 
150
153
  # Copyright and License
151
154
 
152
155
  The MIT License (MIT)
153
156
 
154
- Copyright (c) 2017 Wenbo Li(李文博) <wenbo.li@baishancloud.com>
157
+ Copyright (c) 2015 Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
155
158
 
156
159
 
157
160
  [pykit3]: https://github.com/pykit3
@@ -29,34 +29,38 @@ pip install k3shell
29
29
  # Synopsis
30
30
 
31
31
  ```python
32
+ import sys
32
33
 
33
34
  import k3shell
34
- import sys
35
+
35
36
  arguments = {
36
- 'echo_repr': (
37
+ "echo_repr": (
37
38
  lambda x: sys.stdout.write(repr(x)),
38
- ('x', {'nargs': '+', 'help': 'just an input message'}),
39
+ ("x", {"nargs": "+", "help": "just an input message"}),
39
40
  ),
40
-
41
- 'foo': {
42
- 'bar': lambda: sys.stdout.write('bar'),
43
-
44
- 'bob': {
45
- 'plus': (
41
+ "foo": {
42
+ "bar": lambda: sys.stdout.write("bar"),
43
+ "bob": {
44
+ "plus": (
46
45
  lambda x, y: sys.stdout.write(str(x + y)),
47
- ('x', {'type': int, help: 'an int is needed'}),
48
- ('y', {'type': int, help: 'an int is needed'}),
46
+ ("x", {"type": int, help: "an int is needed"}),
47
+ ("y", {"type": int, help: "an int is needed"}),
49
48
  ),
50
49
  },
51
50
  },
52
-
53
- '__add_help__': {
54
- ('echo_repr',) : 'output what is input.',
55
- ('foo', 'bar',) : 'print a "bar".',
56
- ('foo', 'bob', 'plus',) : 'do addition operation with 2 numbers.',
51
+ "__add_help__": {
52
+ ("echo_repr",): "output what is input.",
53
+ (
54
+ "foo",
55
+ "bar",
56
+ ): 'print a "bar".',
57
+ (
58
+ "foo",
59
+ "bob",
60
+ "plus",
61
+ ): "do addition operation with 2 numbers.",
57
62
  },
58
-
59
- '__description__': 'this is an example command.',
63
+ "__description__": "this is an example command.",
60
64
  }
61
65
 
62
66
  k3shell.command(**arguments)
@@ -108,13 +112,13 @@ optional arguments:
108
112
 
109
113
  # Author
110
114
 
111
- Wenbo Li(李文博) <wenbo.li@baishancloud.com>
115
+ Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
112
116
 
113
117
  # Copyright and License
114
118
 
115
119
  The MIT License (MIT)
116
120
 
117
- Copyright (c) 2017 Wenbo Li(李文博) <wenbo.li@baishancloud.com>
121
+ Copyright (c) 2015 Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
118
122
 
119
123
 
120
124
  [pykit3]: https://github.com/pykit3
@@ -1,11 +1,8 @@
1
- #!/usr/bin/env python2
2
- # coding: utf-8
3
-
4
1
  import argparse
5
2
  import copy
6
- import sys
7
3
  import logging
8
4
  import os
5
+ import sys
9
6
 
10
7
  import k3dict
11
8
 
@@ -61,7 +58,7 @@ def command(**kwargs):
61
58
  sys.exit(1)
62
59
 
63
60
  except Exception as e:
64
- logger.exception(repr(e))
61
+ logger.exception(f"command {cmds!r} failed")
65
62
  sys.stderr.write(repr(e))
66
63
  sys.exit(1)
67
64
 
@@ -81,7 +78,7 @@ def command(**kwargs):
81
78
  sys.exit(2)
82
79
 
83
80
  except Exception as e:
84
- logger.exception(repr(e))
81
+ logger.exception(f"failed to handle arguments {sys.argv[1:]!r}")
85
82
  sys.stderr.write(repr(e))
86
83
  sys.exit(1)
87
84
 
@@ -1,22 +1,21 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k3shell
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: Shell command dispatcher with nested subcommand support
5
5
  Author-email: Zhang Yanpo <drdr.xp@gmail.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/pykit3/k3shell
8
8
  Project-URL: Documentation, https://k3shell.readthedocs.io
9
9
  Keywords: shell,command,cli,subcommand,argparse
10
10
  Classifier: Development Status :: 4 - Beta
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Topic :: Software Development :: Libraries
13
- Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
17
15
  Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Programming Language :: Python :: 3.12
19
- Requires-Python: >=3.9
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.10
20
19
  Description-Content-Type: text/markdown
21
20
  License-File: LICENSE
22
21
  Requires-Dist: k3dict
@@ -66,34 +65,38 @@ pip install k3shell
66
65
  # Synopsis
67
66
 
68
67
  ```python
68
+ import sys
69
69
 
70
70
  import k3shell
71
- import sys
71
+
72
72
  arguments = {
73
- 'echo_repr': (
73
+ "echo_repr": (
74
74
  lambda x: sys.stdout.write(repr(x)),
75
- ('x', {'nargs': '+', 'help': 'just an input message'}),
75
+ ("x", {"nargs": "+", "help": "just an input message"}),
76
76
  ),
77
-
78
- 'foo': {
79
- 'bar': lambda: sys.stdout.write('bar'),
80
-
81
- 'bob': {
82
- 'plus': (
77
+ "foo": {
78
+ "bar": lambda: sys.stdout.write("bar"),
79
+ "bob": {
80
+ "plus": (
83
81
  lambda x, y: sys.stdout.write(str(x + y)),
84
- ('x', {'type': int, help: 'an int is needed'}),
85
- ('y', {'type': int, help: 'an int is needed'}),
82
+ ("x", {"type": int, help: "an int is needed"}),
83
+ ("y", {"type": int, help: "an int is needed"}),
86
84
  ),
87
85
  },
88
86
  },
89
-
90
- '__add_help__': {
91
- ('echo_repr',) : 'output what is input.',
92
- ('foo', 'bar',) : 'print a "bar".',
93
- ('foo', 'bob', 'plus',) : 'do addition operation with 2 numbers.',
87
+ "__add_help__": {
88
+ ("echo_repr",): "output what is input.",
89
+ (
90
+ "foo",
91
+ "bar",
92
+ ): 'print a "bar".',
93
+ (
94
+ "foo",
95
+ "bob",
96
+ "plus",
97
+ ): "do addition operation with 2 numbers.",
94
98
  },
95
-
96
- '__description__': 'this is an example command.',
99
+ "__description__": "this is an example command.",
97
100
  }
98
101
 
99
102
  k3shell.command(**arguments)
@@ -145,13 +148,13 @@ optional arguments:
145
148
 
146
149
  # Author
147
150
 
148
- Wenbo Li(李文博) <wenbo.li@baishancloud.com>
151
+ Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
149
152
 
150
153
  # Copyright and License
151
154
 
152
155
  The MIT License (MIT)
153
156
 
154
- Copyright (c) 2017 Wenbo Li(李文博) <wenbo.li@baishancloud.com>
157
+ Copyright (c) 2015 Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
155
158
 
156
159
 
157
160
  [pykit3]: https://github.com/pykit3
@@ -1,14 +1,14 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61.0"]
2
+ requires = ["setuptools>=77.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "k3shell"
7
- version = "0.1.5"
7
+ version = "0.1.6"
8
8
  description = "Shell command dispatcher with nested subcommand support"
9
9
  readme = "README.md"
10
- license = {text = "MIT"}
11
- requires-python = ">=3.9"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
12
  authors = [
13
13
  { name = "Zhang Yanpo", email = "drdr.xp@gmail.com" }
14
14
  ]
@@ -17,12 +17,11 @@ classifiers = [
17
17
  "Development Status :: 4 - Beta",
18
18
  "Intended Audience :: Developers",
19
19
  "Topic :: Software Development :: Libraries",
20
- "License :: OSI Approved :: MIT License",
21
20
  "Programming Language :: Python :: 3",
22
- "Programming Language :: Python :: 3.9",
23
21
  "Programming Language :: Python :: 3.10",
24
22
  "Programming Language :: Python :: 3.11",
25
23
  "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
26
25
  ]
27
26
  dependencies = [
28
27
  "k3dict",
@@ -1,6 +1,7 @@
1
- import k3shell
2
1
  import sys
3
2
 
3
+ import k3shell
4
+
4
5
  arguments = {
5
6
  "echo_repr": (
6
7
  lambda x: sys.stdout.write(repr(x)),
@@ -1,10 +1,10 @@
1
- #!/usr/bin/env python2
2
1
  # conding: utf-8
3
2
 
4
- import os
5
- import unittest
6
3
  import logging
4
+ import os
7
5
  import sys
6
+ import unittest
7
+
8
8
  import k3shell
9
9
 
10
10
  # Python 3.10+ changed argparse help text from "optional arguments:" to "options:"
@@ -23,7 +23,7 @@ class TestCommand(unittest.TestCase):
23
23
  sys.argv = self.backup_argv
24
24
  try:
25
25
  os.remove(self.out_buf)
26
- except EnvironmentError as e:
26
+ except OSError as e:
27
27
  sys.stderr.write(repr(e))
28
28
 
29
29
  def execute_test(self, arguments, argv, out_str, exit_code):
File without changes
File without changes
File without changes
File without changes