comb-utils 0.0.2__tar.gz → 0.1.0__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.
- {comb_utils-0.0.2/src/comb_utils.egg-info → comb_utils-0.1.0}/PKG-INFO +2 -9
- {comb_utils-0.0.2 → comb_utils-0.1.0}/README.md +1 -8
- {comb_utils-0.0.2 → comb_utils-0.1.0}/setup.cfg +2 -2
- {comb_utils-0.0.2 → comb_utils-0.1.0}/src/comb_utils/__init__.py +1 -1
- comb_utils-0.1.0/src/comb_utils/lib/__init__.py +3 -0
- comb_utils-0.1.0/src/comb_utils/lib/docs.py +100 -0
- {comb_utils-0.0.2 → comb_utils-0.1.0/src/comb_utils.egg-info}/PKG-INFO +2 -9
- {comb_utils-0.0.2 → comb_utils-0.1.0}/src/comb_utils.egg-info/SOURCES.txt +1 -4
- comb_utils-0.0.2/src/comb_utils/api/__init__.py +0 -1
- comb_utils-0.0.2/src/comb_utils/api/internal.py +0 -25
- comb_utils-0.0.2/src/comb_utils/api/public.py +0 -21
- comb_utils-0.0.2/src/comb_utils/lib/__init__.py +0 -1
- comb_utils-0.0.2/src/comb_utils/lib/example.py +0 -16
- {comb_utils-0.0.2 → comb_utils-0.1.0}/LICENSE +0 -0
- {comb_utils-0.0.2 → comb_utils-0.1.0}/pyproject.toml +0 -0
- {comb_utils-0.0.2 → comb_utils-0.1.0}/src/comb_utils.egg-info/dependency_links.txt +0 -0
- {comb_utils-0.0.2 → comb_utils-0.1.0}/src/comb_utils.egg-info/requires.txt +0 -0
- {comb_utils-0.0.2 → comb_utils-0.1.0}/src/comb_utils.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: comb_utils
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: Handy utils for Python projects.
|
|
5
5
|
Author: Kaleb Coberly
|
|
6
6
|
Maintainer-email: kaleb.coberly@gmail.com
|
|
@@ -41,7 +41,7 @@ Requires-Dist: coverage[toml]; extra == "test"
|
|
|
41
41
|
Requires-Dist: pytest; extra == "test"
|
|
42
42
|
Requires-Dist: pytest-cov; extra == "test"
|
|
43
43
|
|
|
44
|
-
#
|
|
44
|
+
# Comb Utils
|
|
45
45
|
|
|
46
46
|
## Summary
|
|
47
47
|
|
|
@@ -53,7 +53,6 @@ Some handy utils for Python projects. Repo is made from the `reference_package`
|
|
|
53
53
|
.github/workflows GitHub Actions CI/CD workflows.
|
|
54
54
|
docs RST docs and doc build staging.
|
|
55
55
|
Makefile Dev tools and params. (includes shared/Makefile)
|
|
56
|
-
src/comb_utils/api Public and internal API.
|
|
57
56
|
setup.cfg Metadata and dependencies.
|
|
58
57
|
shared Shared dev tools Git submodule.
|
|
59
58
|
src/comb_utils/lib Implementation.
|
|
@@ -70,12 +69,6 @@ To install the package, run:
|
|
|
70
69
|
|
|
71
70
|
See https://pypi.org/project/comb-utils/.
|
|
72
71
|
|
|
73
|
-
## Library functions
|
|
74
|
-
|
|
75
|
-
`comb_utils` is a library from which you can import functions. Import the public example function like this: `from comb_utils import wait_a_second`. Or, import the internal version like a power user like this: `from comb_utils.api.internal import wait_a_second`.
|
|
76
|
-
|
|
77
|
-
Unless you're developing, avoid importing directly from library, like `from comb_utils.lib.example import wait_a_second`.
|
|
78
|
-
|
|
79
72
|
## Dev workflow
|
|
80
73
|
|
|
81
74
|
There are a number of dev tools in the `Makefile`. You can list all the make tools you might want to use:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Comb Utils
|
|
2
2
|
|
|
3
3
|
## Summary
|
|
4
4
|
|
|
@@ -10,7 +10,6 @@ Some handy utils for Python projects. Repo is made from the `reference_package`
|
|
|
10
10
|
.github/workflows GitHub Actions CI/CD workflows.
|
|
11
11
|
docs RST docs and doc build staging.
|
|
12
12
|
Makefile Dev tools and params. (includes shared/Makefile)
|
|
13
|
-
src/comb_utils/api Public and internal API.
|
|
14
13
|
setup.cfg Metadata and dependencies.
|
|
15
14
|
shared Shared dev tools Git submodule.
|
|
16
15
|
src/comb_utils/lib Implementation.
|
|
@@ -27,12 +26,6 @@ To install the package, run:
|
|
|
27
26
|
|
|
28
27
|
See https://pypi.org/project/comb-utils/.
|
|
29
28
|
|
|
30
|
-
## Library functions
|
|
31
|
-
|
|
32
|
-
`comb_utils` is a library from which you can import functions. Import the public example function like this: `from comb_utils import wait_a_second`. Or, import the internal version like a power user like this: `from comb_utils.api.internal import wait_a_second`.
|
|
33
|
-
|
|
34
|
-
Unless you're developing, avoid importing directly from library, like `from comb_utils.lib.example import wait_a_second`.
|
|
35
|
-
|
|
36
29
|
## Dev workflow
|
|
37
30
|
|
|
38
31
|
There are a number of dev tools in the `Makefile`. You can list all the make tools you might want to use:
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = comb_utils
|
|
3
|
-
version = 0.0
|
|
3
|
+
version = 0.1.0
|
|
4
4
|
description = Handy utils for Python projects.
|
|
5
5
|
long_description = file: README.md
|
|
6
6
|
long_description_content_type = text/markdown
|
|
7
7
|
author = Kaleb Coberly
|
|
8
8
|
maintainer_email = kaleb.coberly@gmail.com
|
|
9
|
-
copyright =
|
|
9
|
+
copyright = 2025, Kaleb Coberly
|
|
10
10
|
|
|
11
11
|
[options]
|
|
12
12
|
python_requires = >=3.11
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Docstring formatting for sphinx API docs and click CLI help."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Final
|
|
5
|
+
|
|
6
|
+
from typeguard import typechecked
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class ErrorDocString:
|
|
11
|
+
"""Error docstrings.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
error_type: The error type. E.g., "ValueError".
|
|
15
|
+
docstring: The error docstring. E.g., "When arg `a` is less than 0."
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
error_type: Final[str]
|
|
19
|
+
docstring: Final[str]
|
|
20
|
+
|
|
21
|
+
@typechecked
|
|
22
|
+
def __init__(self, error_type: str, docstring: str) -> None:
|
|
23
|
+
"""Initialize the error docstring."""
|
|
24
|
+
self.error_type = error_type
|
|
25
|
+
self.docstring = docstring
|
|
26
|
+
|
|
27
|
+
return
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# TODO: Move this to a central utils repo. (And combine with Defaults? Include types?)
|
|
31
|
+
class DocString:
|
|
32
|
+
"""Class to format docstrings for public API `sphinx` docs and CLI `click` help.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
opening: The opening docstring.
|
|
36
|
+
args: Argument names and their docstrings.
|
|
37
|
+
raises: Objects holding error types with their docstrings.
|
|
38
|
+
returns: The returns docstrings.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
opening: str = ""
|
|
42
|
+
args: dict[str, str] = {}
|
|
43
|
+
raises: list[ErrorDocString] = []
|
|
44
|
+
returns: list[str] = []
|
|
45
|
+
|
|
46
|
+
@typechecked
|
|
47
|
+
def __init__(
|
|
48
|
+
self,
|
|
49
|
+
opening: str,
|
|
50
|
+
args: dict[str, str],
|
|
51
|
+
raises: list[ErrorDocString],
|
|
52
|
+
returns: list[str],
|
|
53
|
+
) -> None:
|
|
54
|
+
"""Initialize the docstring parts."""
|
|
55
|
+
self.opening = opening
|
|
56
|
+
self.args = args
|
|
57
|
+
self.raises = raises
|
|
58
|
+
self.returns = returns
|
|
59
|
+
|
|
60
|
+
return
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
@typechecked
|
|
64
|
+
def api_docstring(self) -> str:
|
|
65
|
+
"""Docstring formatted for Sphinx API docs."""
|
|
66
|
+
parts = [self.opening.strip()]
|
|
67
|
+
|
|
68
|
+
if self.args:
|
|
69
|
+
parts.append("\nArgs:\n")
|
|
70
|
+
parts.extend([f" {key}: {value}" for key, value in self.args.items()])
|
|
71
|
+
|
|
72
|
+
if self.raises:
|
|
73
|
+
parts.append("\nRaises:\n")
|
|
74
|
+
parts.extend(
|
|
75
|
+
[f" {error.error_type}: {error.docstring}" for error in self.raises]
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
if self.returns:
|
|
79
|
+
parts.append("\nReturns:\n")
|
|
80
|
+
parts.extend([f" {item}" for item in self.returns])
|
|
81
|
+
|
|
82
|
+
return "\n\n".join(parts) + "\n"
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
@typechecked
|
|
86
|
+
def cli_docstring(self) -> str:
|
|
87
|
+
"""Docstring formatted for Click CLI help."""
|
|
88
|
+
parts = [self.opening.strip()]
|
|
89
|
+
|
|
90
|
+
if self.raises:
|
|
91
|
+
parts.append("\nRaises:\n")
|
|
92
|
+
parts.extend(
|
|
93
|
+
[f" {error.error_type}: {error.docstring}" for error in self.raises]
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
if self.returns:
|
|
97
|
+
parts.append("\nReturns:\n")
|
|
98
|
+
parts.extend([f" {item}" for item in self.returns])
|
|
99
|
+
|
|
100
|
+
return "\n\n".join(parts) + "\n"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: comb_utils
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: Handy utils for Python projects.
|
|
5
5
|
Author: Kaleb Coberly
|
|
6
6
|
Maintainer-email: kaleb.coberly@gmail.com
|
|
@@ -41,7 +41,7 @@ Requires-Dist: coverage[toml]; extra == "test"
|
|
|
41
41
|
Requires-Dist: pytest; extra == "test"
|
|
42
42
|
Requires-Dist: pytest-cov; extra == "test"
|
|
43
43
|
|
|
44
|
-
#
|
|
44
|
+
# Comb Utils
|
|
45
45
|
|
|
46
46
|
## Summary
|
|
47
47
|
|
|
@@ -53,7 +53,6 @@ Some handy utils for Python projects. Repo is made from the `reference_package`
|
|
|
53
53
|
.github/workflows GitHub Actions CI/CD workflows.
|
|
54
54
|
docs RST docs and doc build staging.
|
|
55
55
|
Makefile Dev tools and params. (includes shared/Makefile)
|
|
56
|
-
src/comb_utils/api Public and internal API.
|
|
57
56
|
setup.cfg Metadata and dependencies.
|
|
58
57
|
shared Shared dev tools Git submodule.
|
|
59
58
|
src/comb_utils/lib Implementation.
|
|
@@ -70,12 +69,6 @@ To install the package, run:
|
|
|
70
69
|
|
|
71
70
|
See https://pypi.org/project/comb-utils/.
|
|
72
71
|
|
|
73
|
-
## Library functions
|
|
74
|
-
|
|
75
|
-
`comb_utils` is a library from which you can import functions. Import the public example function like this: `from comb_utils import wait_a_second`. Or, import the internal version like a power user like this: `from comb_utils.api.internal import wait_a_second`.
|
|
76
|
-
|
|
77
|
-
Unless you're developing, avoid importing directly from library, like `from comb_utils.lib.example import wait_a_second`.
|
|
78
|
-
|
|
79
72
|
## Dev workflow
|
|
80
73
|
|
|
81
74
|
There are a number of dev tools in the `Makefile`. You can list all the make tools you might want to use:
|
|
@@ -8,8 +8,5 @@ src/comb_utils.egg-info/SOURCES.txt
|
|
|
8
8
|
src/comb_utils.egg-info/dependency_links.txt
|
|
9
9
|
src/comb_utils.egg-info/requires.txt
|
|
10
10
|
src/comb_utils.egg-info/top_level.txt
|
|
11
|
-
src/comb_utils/api/__init__.py
|
|
12
|
-
src/comb_utils/api/internal.py
|
|
13
|
-
src/comb_utils/api/public.py
|
|
14
11
|
src/comb_utils/lib/__init__.py
|
|
15
|
-
src/comb_utils/lib/
|
|
12
|
+
src/comb_utils/lib/docs.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"""Do not define in API, only import."""
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"""Internal functions overlay library and are typically wrapped by public functions.
|
|
2
|
-
|
|
3
|
-
This allows us to maintain a separation of API from implementation.
|
|
4
|
-
Internal functions may come with extra options that public functions don't have, say for
|
|
5
|
-
power users and developers who may want to use an existing DB session or something.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from typeguard import typechecked
|
|
9
|
-
|
|
10
|
-
from comb_utils.lib import example
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@typechecked
|
|
14
|
-
def wait_a_second(
|
|
15
|
-
secs: int = 1, extra_string: str = "Fancy me, calling internal functions."
|
|
16
|
-
) -> None:
|
|
17
|
-
"""Just wait a second, or however many seconds you want.
|
|
18
|
-
|
|
19
|
-
Also prints a message with the number you passed, along with any extra message you want.
|
|
20
|
-
|
|
21
|
-
Arguments:
|
|
22
|
-
secs: How many seconds to wait.
|
|
23
|
-
extra_string: Extra message to add on tail of existing message.
|
|
24
|
-
"""
|
|
25
|
-
example.wait_a_second(secs=secs, extra_string=extra_string)
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"""Public functions wrap internal functions which wrap library functions.
|
|
2
|
-
|
|
3
|
-
This allows separation of API from implementation. It also allows a simplified public API
|
|
4
|
-
separate from a more complex internal API with more options for power users.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from typeguard import typechecked
|
|
8
|
-
|
|
9
|
-
from comb_utils.api.internal import example
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@typechecked
|
|
13
|
-
def wait_a_second(secs: int = 1) -> None:
|
|
14
|
-
"""Just wait a second, or however many seconds you want.
|
|
15
|
-
|
|
16
|
-
Also prints a message with the number you passed.
|
|
17
|
-
|
|
18
|
-
Arguments:
|
|
19
|
-
secs: How many seconds to wait.
|
|
20
|
-
"""
|
|
21
|
-
example.wait_a_second(secs=secs)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"""lib init."""
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"""This is an example module."""
|
|
2
|
-
|
|
3
|
-
import time
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def wait_a_second(secs: int = 1, extra_string: str = "") -> None:
|
|
7
|
-
"""Just wait a second, or however many seconds you want.
|
|
8
|
-
|
|
9
|
-
Also prints a message with the number you passed, along with any extra message you want.
|
|
10
|
-
|
|
11
|
-
Arguments:
|
|
12
|
-
secs: How many seconds to wait.
|
|
13
|
-
extra_string: Extra message to add on tail of existing message.
|
|
14
|
-
"""
|
|
15
|
-
print(f"Waiting {secs} seconds.{' ' + extra_string if extra_string else ''}")
|
|
16
|
-
time.sleep(secs)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|