cmdkit 2.7.5__tar.gz → 2.7.7__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.
- {cmdkit-2.7.5 → cmdkit-2.7.7}/PKG-INFO +13 -7
- {cmdkit-2.7.5 → cmdkit-2.7.7}/README.rst +6 -2
- {cmdkit-2.7.5 → cmdkit-2.7.7}/pyproject.toml +11 -10
- {cmdkit-2.7.5 → cmdkit-2.7.7}/src/cmdkit/namespace.py +13 -8
- {cmdkit-2.7.5 → cmdkit-2.7.7}/LICENSE +0 -0
- {cmdkit-2.7.5 → cmdkit-2.7.7}/src/cmdkit/__init__.py +0 -0
- {cmdkit-2.7.5 → cmdkit-2.7.7}/src/cmdkit/ansi.py +0 -0
- {cmdkit-2.7.5 → cmdkit-2.7.7}/src/cmdkit/app.py +0 -0
- {cmdkit-2.7.5 → cmdkit-2.7.7}/src/cmdkit/cli.py +0 -0
- {cmdkit-2.7.5 → cmdkit-2.7.7}/src/cmdkit/config.py +0 -0
- {cmdkit-2.7.5 → cmdkit-2.7.7}/src/cmdkit/contrib/__init__.py +0 -0
- {cmdkit-2.7.5 → cmdkit-2.7.7}/src/cmdkit/contrib/builder.py +0 -0
- {cmdkit-2.7.5 → cmdkit-2.7.7}/src/cmdkit/logging.py +0 -0
- {cmdkit-2.7.5 → cmdkit-2.7.7}/src/cmdkit/platform.py +0 -0
- {cmdkit-2.7.5 → cmdkit-2.7.7}/src/cmdkit/py.typed +0 -0
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cmdkit
|
|
3
|
-
Version: 2.7.
|
|
3
|
+
Version: 2.7.7
|
|
4
4
|
Summary: A command-line utility toolkit for Python.
|
|
5
5
|
Home-page: https://cmdkit.readthedocs.io
|
|
6
6
|
License: Apache-2.0
|
|
7
7
|
Keywords: command-line,utility,toolkit
|
|
8
8
|
Author: Geoffrey Lentner
|
|
9
9
|
Author-email: glentner@purdue.edu
|
|
10
|
-
Requires-Python: >=3.
|
|
10
|
+
Requires-Python: >=3.9,<4.0
|
|
11
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
19
|
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
Provides-Extra: toml
|
|
21
|
+
Provides-Extra: yaml
|
|
22
|
+
Requires-Dist: pyyaml (>=6.0.1,<7.0.0) ; extra == "yaml"
|
|
23
|
+
Requires-Dist: tomli (>=2.1.0,<3.0.0) ; extra == "toml"
|
|
24
|
+
Requires-Dist: tomli-w (>=1.1.0,<2.0.0) ; extra == "toml"
|
|
23
25
|
Project-URL: Documentation, https://cmdkit.readthedocs.io
|
|
24
26
|
Project-URL: Repository, https://github.com/glentner/cmdkit
|
|
25
27
|
Description-Content-Type: text/x-rst
|
|
@@ -29,7 +31,7 @@ CmdKit
|
|
|
29
31
|
|
|
30
32
|
A library for developing command-line applications in Python.
|
|
31
33
|
|
|
32
|
-
.. image:: https://img.shields.io/badge/license-Apache-
|
|
34
|
+
.. image:: https://img.shields.io/badge/license-Apache-yellow.svg?style=flat
|
|
33
35
|
:target: https://www.apache.org/licenses/LICENSE-2.0
|
|
34
36
|
:alt: License
|
|
35
37
|
|
|
@@ -45,6 +47,10 @@ A library for developing command-line applications in Python.
|
|
|
45
47
|
:target: https://cmdkit.readthedocs.io
|
|
46
48
|
:alt: Documentation
|
|
47
49
|
|
|
50
|
+
.. image:: https://github.com/glentner/cmdkit/actions/workflows/tests.yml/badge.svg
|
|
51
|
+
:target: https://github.com/glentner/cmdkit/actions/workflows/tests.yml
|
|
52
|
+
:alt: Tests
|
|
53
|
+
|
|
48
54
|
.. image:: https://pepy.tech/badge/cmdkit
|
|
49
55
|
:target: https://pepy.tech/badge/cmdkit
|
|
50
56
|
:alt: Downloads
|
|
@@ -62,7 +68,7 @@ understand.
|
|
|
62
68
|
Installation
|
|
63
69
|
------------
|
|
64
70
|
|
|
65
|
-
*CmdKit* is tested
|
|
71
|
+
*CmdKit* is tested for `Windows`, `macOS`, and `Linux`, and can be installed
|
|
66
72
|
from the `Python Package Index` using `Pip`.
|
|
67
73
|
|
|
68
74
|
::
|
|
@@ -3,7 +3,7 @@ CmdKit
|
|
|
3
3
|
|
|
4
4
|
A library for developing command-line applications in Python.
|
|
5
5
|
|
|
6
|
-
.. image:: https://img.shields.io/badge/license-Apache-
|
|
6
|
+
.. image:: https://img.shields.io/badge/license-Apache-yellow.svg?style=flat
|
|
7
7
|
:target: https://www.apache.org/licenses/LICENSE-2.0
|
|
8
8
|
:alt: License
|
|
9
9
|
|
|
@@ -19,6 +19,10 @@ A library for developing command-line applications in Python.
|
|
|
19
19
|
:target: https://cmdkit.readthedocs.io
|
|
20
20
|
:alt: Documentation
|
|
21
21
|
|
|
22
|
+
.. image:: https://github.com/glentner/cmdkit/actions/workflows/tests.yml/badge.svg
|
|
23
|
+
:target: https://github.com/glentner/cmdkit/actions/workflows/tests.yml
|
|
24
|
+
:alt: Tests
|
|
25
|
+
|
|
22
26
|
.. image:: https://pepy.tech/badge/cmdkit
|
|
23
27
|
:target: https://pepy.tech/badge/cmdkit
|
|
24
28
|
:alt: Downloads
|
|
@@ -36,7 +40,7 @@ understand.
|
|
|
36
40
|
Installation
|
|
37
41
|
------------
|
|
38
42
|
|
|
39
|
-
*CmdKit* is tested
|
|
43
|
+
*CmdKit* is tested for `Windows`, `macOS`, and `Linux`, and can be installed
|
|
40
44
|
from the `Python Package Index` using `Pip`.
|
|
41
45
|
|
|
42
46
|
::
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "cmdkit"
|
|
3
|
-
version = "2.7.
|
|
3
|
+
version = "2.7.7"
|
|
4
4
|
description = "A command-line utility toolkit for Python."
|
|
5
5
|
readme = "README.rst"
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -15,7 +15,6 @@ classifiers = [
|
|
|
15
15
|
"Development Status :: 5 - Production/Stable",
|
|
16
16
|
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
17
17
|
"Programming Language :: Python :: 3",
|
|
18
|
-
"Programming Language :: Python :: 3.8",
|
|
19
18
|
"Programming Language :: Python :: 3.9",
|
|
20
19
|
"Programming Language :: Python :: 3.10",
|
|
21
20
|
"Programming Language :: Python :: 3.11",
|
|
@@ -25,10 +24,15 @@ classifiers = [
|
|
|
25
24
|
]
|
|
26
25
|
|
|
27
26
|
[tool.poetry.dependencies]
|
|
28
|
-
python = ">=3.
|
|
29
|
-
|
|
27
|
+
python = ">=3.9,<4.0"
|
|
28
|
+
tomli = {version = "^2.1.0", optional = true}
|
|
29
|
+
tomli-w = {version = "^1.1.0", optional = true}
|
|
30
30
|
pyyaml = {version = "^6.0.1", optional = true}
|
|
31
31
|
|
|
32
|
+
[tool.poetry.extras]
|
|
33
|
+
toml = ['tomli', 'tomli-w']
|
|
34
|
+
yaml = ['pyyaml']
|
|
35
|
+
|
|
32
36
|
[tool.poetry.group.docs.dependencies]
|
|
33
37
|
sphinx = "^7.2.6"
|
|
34
38
|
sphinx-sitemap = "^2.5.1"
|
|
@@ -39,17 +43,14 @@ sphinxcontrib-details-directive = "^0.1.0"
|
|
|
39
43
|
sphinx-toolbox = "^3.5.0"
|
|
40
44
|
pydata-sphinx-theme = "^0.15.1"
|
|
41
45
|
enum-tools = {extras = ["sphinx"], version = "^0.10.0"}
|
|
46
|
+
docutils = "^0.21.1" # NOTE: https://github.com/python-poetry/poetry/issues/9293
|
|
42
47
|
|
|
43
48
|
[tool.poetry.group.dev.dependencies]
|
|
44
|
-
|
|
49
|
+
tomli = "^2.1.0"
|
|
50
|
+
tomli-w = "^1.1.0"
|
|
45
51
|
pyyaml = "^6.0.1"
|
|
46
52
|
pytest = "^7.4.4"
|
|
47
|
-
pytest-cov = "^4.1.0"
|
|
48
53
|
hypothesis = "^6.92.6"
|
|
49
|
-
ruff = "^0.1.11"
|
|
50
|
-
pyright = "^1.1.345"
|
|
51
|
-
pynvim = "^0.5.0"
|
|
52
|
-
ipython = "^8.20.0"
|
|
53
54
|
sphinx-autobuild = "^2021.3.14"
|
|
54
55
|
|
|
55
56
|
[build-system]
|
|
@@ -10,6 +10,7 @@ from typing import Union, Mapping, Iterable, Any, Dict, Optional, IO, List, Tupl
|
|
|
10
10
|
|
|
11
11
|
# standard libs
|
|
12
12
|
import os
|
|
13
|
+
import sys
|
|
13
14
|
import functools
|
|
14
15
|
import subprocess
|
|
15
16
|
from collections import Counter
|
|
@@ -135,8 +136,9 @@ class Namespace(NSCoreMixin):
|
|
|
135
136
|
If `filepath` does not exist an exception is raised as expected,
|
|
136
137
|
unless `ignore_if_missing` is `True` and an empty Namespace is returned instead.
|
|
137
138
|
|
|
138
|
-
Supported formats
|
|
139
|
-
|
|
139
|
+
Supported formats currently include `yaml`, `toml`, and `json`.
|
|
140
|
+
For yaml support include "yaml" extra (adds `pyyaml` dependency).
|
|
141
|
+
For toml support include "toml" extra when Python < 3.11 (adds `tomli` dependency).
|
|
140
142
|
|
|
141
143
|
Example:
|
|
142
144
|
>>> Namespace.from_local('config.toml', ignore_if_missing=True)
|
|
@@ -174,12 +176,15 @@ class Namespace(NSCoreMixin):
|
|
|
174
176
|
@classmethod
|
|
175
177
|
def from_toml(cls, path_or_file: Union[str, IO], **options) -> Namespace:
|
|
176
178
|
"""Load a namespace from a TOML file."""
|
|
177
|
-
|
|
179
|
+
if sys.version_info >= (3, 11):
|
|
180
|
+
import tomllib as toml
|
|
181
|
+
else:
|
|
182
|
+
import tomli as toml
|
|
178
183
|
if isinstance(path_or_file, str):
|
|
179
|
-
with open(path_or_file, mode='
|
|
184
|
+
with open(path_or_file, mode='rb', **options) as source:
|
|
180
185
|
return cls(toml.load(source))
|
|
181
186
|
else:
|
|
182
|
-
return cls(toml.
|
|
187
|
+
return cls(toml.loads(path_or_file.read()))
|
|
183
188
|
|
|
184
189
|
@classmethod
|
|
185
190
|
def from_json(cls, path_or_file: Union[str, IO], **options) -> Namespace:
|
|
@@ -218,10 +223,10 @@ class Namespace(NSCoreMixin):
|
|
|
218
223
|
|
|
219
224
|
def to_toml(self, path_or_file: Union[str, IO], encoding: str = 'utf-8', **kwargs) -> None:
|
|
220
225
|
"""Output to TOML file."""
|
|
221
|
-
import toml
|
|
226
|
+
import tomli_w as toml
|
|
222
227
|
if isinstance(path_or_file, str):
|
|
223
228
|
with open(path_or_file, mode='w', encoding=encoding) as output:
|
|
224
|
-
toml.
|
|
229
|
+
output.write(toml.dumps(self.to_dict(), **kwargs))
|
|
225
230
|
else:
|
|
226
231
|
toml.dump(self.to_dict(), path_or_file, **kwargs)
|
|
227
232
|
|
|
@@ -322,7 +327,7 @@ def _coerced(var: str) -> _VT:
|
|
|
322
327
|
pass
|
|
323
328
|
try:
|
|
324
329
|
return float(var)
|
|
325
|
-
except(ValueError, TypeError):
|
|
330
|
+
except (ValueError, TypeError):
|
|
326
331
|
return var
|
|
327
332
|
|
|
328
333
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|