crackerjack 0.10.8__py3-none-any.whl → 0.11.2__py3-none-any.whl
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.
- crackerjack/.pdm.toml +1 -0
- crackerjack/.ruff_cache/0.9.9/12813592349865671909 +0 -0
- crackerjack/__main__.py +1 -2
- crackerjack/crackerjack.py +49 -75
- crackerjack/pyproject.toml +15 -5
- {crackerjack-0.10.8.dist-info → crackerjack-0.11.2.dist-info}/METADATA +5 -5
- {crackerjack-0.10.8.dist-info → crackerjack-0.11.2.dist-info}/RECORD +10 -9
- {crackerjack-0.10.8.dist-info → crackerjack-0.11.2.dist-info}/WHEEL +0 -0
- {crackerjack-0.10.8.dist-info → crackerjack-0.11.2.dist-info}/entry_points.txt +0 -0
- {crackerjack-0.10.8.dist-info → crackerjack-0.11.2.dist-info}/licenses/LICENSE +0 -0
crackerjack/.pdm.toml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
test crackerjack config
|
Binary file
|
crackerjack/__main__.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import asyncio
|
2
1
|
import typing as t
|
3
2
|
|
4
3
|
from click import command, help_option, option
|
@@ -58,7 +57,7 @@ def crackerjack(
|
|
58
57
|
if v:
|
59
58
|
print("-v not currently implemented")
|
60
59
|
options.verbose = v
|
61
|
-
|
60
|
+
crackerjack_it(options=options)
|
62
61
|
|
63
62
|
|
64
63
|
if __name__ == "__main__":
|
crackerjack/crackerjack.py
CHANGED
@@ -1,43 +1,35 @@
|
|
1
|
-
import asyncio
|
2
1
|
import re
|
3
|
-
import sys
|
4
2
|
import typing as t
|
5
3
|
from pathlib import Path
|
6
4
|
from subprocess import run as execute
|
5
|
+
from tomllib import loads
|
7
6
|
|
8
|
-
from acb.actions.encode import dump, load
|
9
|
-
from aioconsole import ainput, aprint
|
10
|
-
from aiopath import AsyncPath
|
11
|
-
from inflection import underscore
|
12
7
|
from pydantic import BaseModel
|
13
|
-
|
14
|
-
|
15
|
-
class Config(BaseModel):
|
16
|
-
python_version: str = "3.13"
|
8
|
+
from tomli_w import dumps
|
17
9
|
|
18
10
|
|
19
11
|
class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
20
|
-
our_path:
|
21
|
-
pkg_path:
|
22
|
-
|
23
|
-
pkg_dir: t.Optional[AsyncPath] = None
|
12
|
+
our_path: Path = Path(__file__).parent
|
13
|
+
pkg_path: Path = Path(Path.cwd())
|
14
|
+
pkg_dir: t.Optional[Path] = None
|
24
15
|
pkg_name: str = "crackerjack"
|
25
16
|
our_toml: t.Optional[dict[str, t.Any]] = None
|
26
17
|
pkg_toml: t.Optional[dict[str, t.Any]] = None
|
27
|
-
our_toml_path: t.Optional[
|
28
|
-
pkg_toml_path: t.Optional[
|
29
|
-
|
18
|
+
our_toml_path: t.Optional[Path] = None
|
19
|
+
pkg_toml_path: t.Optional[Path] = None
|
20
|
+
python_version: str = "3.13"
|
30
21
|
|
31
|
-
|
22
|
+
def update_pyproject_configs(self) -> None:
|
32
23
|
toml_file = "pyproject.toml"
|
33
24
|
self.our_toml_path = self.our_path / toml_file
|
34
25
|
self.pkg_toml_path = self.pkg_path / toml_file
|
35
26
|
if self.pkg_path.stem == "crackerjack":
|
36
|
-
|
27
|
+
self.our_toml_path.write_text(self.pkg_toml_path.read_text())
|
37
28
|
return
|
38
|
-
our_toml_config: t.Any =
|
39
|
-
pkg_toml_config: t.Any =
|
40
|
-
|
29
|
+
our_toml_config: t.Any = loads(self.our_toml_path.read_text())
|
30
|
+
pkg_toml_config: t.Any = loads(self.pkg_toml_path.read_text())
|
31
|
+
pkg_toml_config.setdefault("tool", {})
|
32
|
+
pkg_toml_config.setdefault("project", {})
|
41
33
|
for tool, settings in our_toml_config["tool"].items():
|
42
34
|
for setting, value in settings.items():
|
43
35
|
if isinstance(value, str | list) and "crackerjack" in value:
|
@@ -54,54 +46,50 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
|
54
46
|
"skips",
|
55
47
|
"ignore",
|
56
48
|
) and isinstance(value, list):
|
57
|
-
|
58
|
-
|
59
|
-
)
|
49
|
+
conf = pkg_toml_config["tool"].get(tool, {}).get(setting, [])
|
50
|
+
settings[setting] = list(set(conf + value))
|
60
51
|
pkg_toml_config["tool"][tool] = settings
|
61
|
-
pkg_toml_config["dependency-groups"] = pkg_deps
|
62
52
|
python_version_pattern = r"\s*W*(\d\.\d*)"
|
63
53
|
requires_python = our_toml_config["project"]["requires-python"]
|
64
54
|
classifiers = []
|
65
|
-
for classifier in pkg_toml_config["project"]
|
55
|
+
for classifier in pkg_toml_config["project"].get("classifiers", []):
|
66
56
|
classifier = re.sub(
|
67
|
-
python_version_pattern, f" {self.
|
57
|
+
python_version_pattern, f" {self.python_version}", classifier
|
68
58
|
)
|
69
59
|
classifiers.append(classifier)
|
70
60
|
pkg_toml_config["project"]["classifiers"] = classifiers
|
71
61
|
pkg_toml_config["project"]["requires-python"] = requires_python
|
72
|
-
|
62
|
+
self.pkg_toml_path.write_text(dumps(pkg_toml_config))
|
73
63
|
|
74
|
-
|
64
|
+
def copy_configs(self) -> None:
|
75
65
|
config_files = (".gitignore", ".pre-commit-config.yaml", ".libcst.codemod.yaml")
|
76
66
|
for config in config_files:
|
77
67
|
config_path = self.our_path / config
|
78
68
|
pkg_config_path = self.pkg_path / config
|
79
|
-
|
69
|
+
pkg_config_path.touch()
|
80
70
|
if self.pkg_path.stem == "crackerjack":
|
81
|
-
|
71
|
+
config_path.write_text(pkg_config_path.read_text())
|
82
72
|
continue
|
83
73
|
if config != ".gitignore":
|
84
|
-
|
85
|
-
(
|
86
|
-
"crackerjack", self.pkg_name
|
87
|
-
)
|
74
|
+
pkg_config_path.write_text(
|
75
|
+
(config_path.read_text()).replace("crackerjack", self.pkg_name)
|
88
76
|
)
|
89
77
|
execute(["git", "add", config])
|
90
78
|
|
91
|
-
|
79
|
+
def run_interactive(self, hook: str) -> None:
|
92
80
|
success: bool = False
|
93
81
|
while not success:
|
94
82
|
fail = execute(["pre-commit", "run", hook.lower(), "--all-files"])
|
95
83
|
if fail.returncode > 0:
|
96
|
-
retry =
|
97
|
-
|
84
|
+
retry = input(f"\n\n{hook.title()} failed. Retry? (y/N): ")
|
85
|
+
print()
|
98
86
|
if retry.strip().lower() == "y":
|
99
87
|
continue
|
100
|
-
|
88
|
+
raise SystemExit(1)
|
101
89
|
success = True
|
102
90
|
|
103
|
-
|
104
|
-
|
91
|
+
def update_pkg_configs(self) -> None:
|
92
|
+
self.copy_configs()
|
105
93
|
installed_pkgs = execute(
|
106
94
|
["pdm", "list", "--freeze"],
|
107
95
|
capture_output=True,
|
@@ -117,71 +105,57 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
|
117
105
|
execute(["git", "add", "pdm.lock"])
|
118
106
|
execute(["pre-commit", "install"])
|
119
107
|
execute(["git", "config", "advice.addIgnoredFile", "false"])
|
120
|
-
|
121
|
-
|
122
|
-
async def load_config(self) -> None:
|
123
|
-
await self.settings_path.touch(exist_ok=True)
|
124
|
-
try:
|
125
|
-
self.config = Config(**await load.yaml(self.settings_path))
|
126
|
-
except TypeError:
|
127
|
-
self.config = Config()
|
128
|
-
await dump.yaml(self.config.model_dump(), self.settings_path)
|
129
|
-
raise SystemExit("\nPlease configure '.crackerjack.yaml' and try again\n")
|
108
|
+
self.update_pyproject_configs()
|
130
109
|
|
131
|
-
|
110
|
+
def run_pre_commit(self) -> None:
|
132
111
|
check_all = execute(["pre-commit", "run", "--all-files"])
|
133
112
|
if check_all.returncode > 0:
|
134
113
|
check_all = execute(["pre-commit", "run", "--all-files"])
|
135
114
|
if check_all.returncode > 0:
|
136
|
-
|
137
|
-
raise SystemExit()
|
115
|
+
print("\n\nPre-commit failed. Please fix errors.\n")
|
116
|
+
raise SystemExit(1)
|
138
117
|
|
139
|
-
|
140
|
-
self.pkg_name =
|
118
|
+
def process(self, options: t.Any) -> None:
|
119
|
+
self.pkg_name = self.pkg_path.stem.lower().replace("-", "_")
|
141
120
|
self.pkg_dir = self.pkg_path / self.pkg_name
|
142
|
-
|
143
|
-
|
121
|
+
self.pkg_dir.mkdir(exist_ok=True)
|
122
|
+
print("\nCrackerjacking...\n")
|
144
123
|
if not options.do_not_update_configs:
|
145
|
-
|
124
|
+
self.update_pkg_configs()
|
146
125
|
execute(["pdm", "install"])
|
147
126
|
if self.pkg_path.stem == "crackerjack" and options.update_precommit:
|
148
127
|
execute(["pre-commit", "autoupdate"])
|
149
128
|
if options.interactive:
|
150
129
|
for hook in ("refurb", "bandit", "pyright"):
|
151
|
-
|
152
|
-
|
130
|
+
self.run_interactive(hook)
|
131
|
+
self.run_pre_commit()
|
153
132
|
for option in (options.publish, options.bump):
|
154
133
|
if option:
|
155
134
|
execute(["pdm", "bump", option])
|
156
135
|
break
|
157
136
|
if options.publish:
|
158
137
|
build = execute(["pdm", "build"], capture_output=True, text=True)
|
159
|
-
|
138
|
+
print(build.stdout)
|
160
139
|
if build.returncode > 0:
|
161
|
-
|
162
|
-
|
163
|
-
raise SystemExit()
|
140
|
+
print(build.stderr)
|
141
|
+
print("\n\nBuild failed. Please fix errors.\n")
|
142
|
+
raise SystemExit(1)
|
164
143
|
execute(["pdm", "publish", "--no-build"])
|
165
144
|
if options.commit:
|
166
|
-
commit_msg =
|
145
|
+
commit_msg = input("\nCommit message: ")
|
167
146
|
execute(
|
168
147
|
[
|
169
148
|
"git",
|
170
149
|
"commit",
|
171
150
|
"-m",
|
172
|
-
|
151
|
+
commit_msg,
|
173
152
|
"--no-verify",
|
174
153
|
"--",
|
175
154
|
".",
|
176
155
|
]
|
177
156
|
)
|
178
157
|
execute(["git", "push", "origin", "main"])
|
179
|
-
|
180
|
-
|
181
|
-
async def run(self, options: t.Any) -> None:
|
182
|
-
await self.load_config()
|
183
|
-
process = asyncio.create_task(self.process(options))
|
184
|
-
await process
|
158
|
+
print("\nCrackerjack complete!\n")
|
185
159
|
|
186
160
|
|
187
|
-
crackerjack_it = Crackerjack().
|
161
|
+
crackerjack_it = Crackerjack().process
|
crackerjack/pyproject.toml
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
[tool.pytest.ini_options]
|
2
|
+
addopts = "--cov=crackerjack"
|
3
|
+
asyncio_default_fixture_loop_scope = "function"
|
4
|
+
|
1
5
|
[tool.codespell]
|
2
6
|
skip = "*/data/*"
|
3
7
|
quiet-level = 3
|
@@ -9,6 +13,7 @@ target-version = "py313"
|
|
9
13
|
fix = true
|
10
14
|
show-fixes = true
|
11
15
|
output-format = "full"
|
16
|
+
unsafe-fixes = true
|
12
17
|
|
13
18
|
[tool.ruff.format]
|
14
19
|
docstring-code-format = true
|
@@ -57,6 +62,9 @@ exclude-deps = [
|
|
57
62
|
"autotyping",
|
58
63
|
"pre-commit",
|
59
64
|
"pytest",
|
65
|
+
"pytest-asyncio",
|
66
|
+
"pytest-cov",
|
67
|
+
"pytest-mock",
|
60
68
|
"pdm",
|
61
69
|
"pyfiglet",
|
62
70
|
"pyyaml",
|
@@ -72,6 +80,7 @@ target = [
|
|
72
80
|
"crackerjack",
|
73
81
|
]
|
74
82
|
skips = [
|
83
|
+
"B101",
|
75
84
|
"B301",
|
76
85
|
"B311",
|
77
86
|
"B403",
|
@@ -79,6 +88,7 @@ skips = [
|
|
79
88
|
"B602",
|
80
89
|
"B603",
|
81
90
|
"B607",
|
91
|
+
"B704",
|
82
92
|
]
|
83
93
|
|
84
94
|
[tool.pyright]
|
@@ -105,7 +115,7 @@ pythonPlatform = "Darwin"
|
|
105
115
|
|
106
116
|
[project]
|
107
117
|
name = "crackerjack"
|
108
|
-
version = "0.
|
118
|
+
version = "0.11.1"
|
109
119
|
description = "Default template for PDM package"
|
110
120
|
requires-python = ">=3.13"
|
111
121
|
readme = "README.md"
|
@@ -132,17 +142,17 @@ classifiers = [
|
|
132
142
|
]
|
133
143
|
dependencies = [
|
134
144
|
"click>=8.1.8",
|
135
|
-
"aioconsole>=0.8.1",
|
136
|
-
"inflection>=0.5.1",
|
137
145
|
"autotyping>=24.9.0",
|
138
146
|
"pre-commit>=4.0.1",
|
139
147
|
"pytest>=8.3.4",
|
140
148
|
"pydantic>=2.10.4",
|
141
|
-
"aiopath>=0.7.7",
|
142
149
|
"pdm-bump>=0.9.10",
|
143
150
|
"pdm>=2.22.1",
|
144
|
-
"acb>=0.8.0",
|
145
151
|
"uv>=0.5.13",
|
152
|
+
"pytest-cov>=6.0.0",
|
153
|
+
"pytest-mock>=3.14.0",
|
154
|
+
"tomli-w>=1.2.0",
|
155
|
+
"pytest-asyncio>=0.25.3",
|
146
156
|
]
|
147
157
|
authors = [
|
148
158
|
{ name = "lesleslie", email = "les@wedgwoodwebworks.com" },
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: crackerjack
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.11.2
|
4
4
|
Summary: Default template for PDM package
|
5
5
|
Keywords: black,ruff,mypy,creosote,refurb
|
6
6
|
Author-Email: lesleslie <les@wedgwoodwebworks.com>
|
@@ -23,17 +23,17 @@ Project-URL: documentation, https://github.com/lesleslie/crackerjack
|
|
23
23
|
Project-URL: repository, https://github.com/lesleslie/crackerjack
|
24
24
|
Requires-Python: >=3.13
|
25
25
|
Requires-Dist: click>=8.1.8
|
26
|
-
Requires-Dist: aioconsole>=0.8.1
|
27
|
-
Requires-Dist: inflection>=0.5.1
|
28
26
|
Requires-Dist: autotyping>=24.9.0
|
29
27
|
Requires-Dist: pre-commit>=4.0.1
|
30
28
|
Requires-Dist: pytest>=8.3.4
|
31
29
|
Requires-Dist: pydantic>=2.10.4
|
32
|
-
Requires-Dist: aiopath>=0.7.7
|
33
30
|
Requires-Dist: pdm-bump>=0.9.10
|
34
31
|
Requires-Dist: pdm>=2.22.1
|
35
|
-
Requires-Dist: acb>=0.8.0
|
36
32
|
Requires-Dist: uv>=0.5.13
|
33
|
+
Requires-Dist: pytest-cov>=6.0.0
|
34
|
+
Requires-Dist: pytest-mock>=3.14.0
|
35
|
+
Requires-Dist: tomli-w>=1.2.0
|
36
|
+
Requires-Dist: pytest-asyncio>=0.25.3
|
37
37
|
Description-Content-Type: text/markdown
|
38
38
|
|
39
39
|
# Crackerjack Python
|
@@ -1,9 +1,10 @@
|
|
1
|
-
crackerjack-0.
|
2
|
-
crackerjack-0.
|
3
|
-
crackerjack-0.
|
4
|
-
crackerjack-0.
|
1
|
+
crackerjack-0.11.2.dist-info/METADATA,sha256=xR4s7WnIl6jzlAjFYNmnQvV2fS7HyvaoK8DGXs6DHug,6323
|
2
|
+
crackerjack-0.11.2.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
+
crackerjack-0.11.2.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
+
crackerjack-0.11.2.dist-info/licenses/LICENSE,sha256=fDt371P6_6sCu7RyqiZH_AhT1LdN3sN1zjBtqEhDYCk,1531
|
5
5
|
crackerjack/.gitignore,sha256=7qePRaD8q-U6oV3gvgAcwFF8GudcRGAWf-Z-0IDqMaE,207
|
6
6
|
crackerjack/.libcst.codemod.yaml,sha256=a8DlErRAIPV1nE6QlyXPAzTOgkB24_spl2E9hphuf5s,772
|
7
|
+
crackerjack/.pdm.toml,sha256=dZe44HRcuxxCFESGG8SZIjmc-cGzSoyK3Hs6t4NYA8w,23
|
7
8
|
crackerjack/.pre-commit-config.yaml,sha256=MdCTkavvr84yaP8B3DYuSjCfR_X4q3tpDO8yZAR5t9s,2265
|
8
9
|
crackerjack/.ruff_cache/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
|
9
10
|
crackerjack/.ruff_cache/0.1.11/3256171999636029978,sha256=-RLDsRf5uj09SyFQVzjwQ1HkTxjIRxNLLE24SEJxD4g,248
|
@@ -34,10 +35,10 @@ crackerjack/.ruff_cache/0.7.1/285614542852677309,sha256=mOHKRzKoSvW-1sHtqI_LHWRt
|
|
34
35
|
crackerjack/.ruff_cache/0.7.3/16061516852537040135,sha256=AWJR9gmaO7-wpv8mY1homuwI8CrMPI3VrnbXH-wRPlg,224
|
35
36
|
crackerjack/.ruff_cache/0.8.4/16354268377385700367,sha256=Ksz4X8N6Z1i83N0vV1PxmBRlqgjrtzmDCOg7VBF4baQ,224
|
36
37
|
crackerjack/.ruff_cache/0.9.3/13948373885254993391,sha256=kGhtIkzPUtKAgvlKs3D8j4QM4qG8RhsHrmQJI69Sv3o,224
|
37
|
-
crackerjack/.ruff_cache/0.9.9/12813592349865671909,sha256=
|
38
|
+
crackerjack/.ruff_cache/0.9.9/12813592349865671909,sha256=RfNLBMX23ATK_GzSmnPl0h8AsUG9sZU3GwPCsVHe2FU,224
|
38
39
|
crackerjack/.ruff_cache/CACHEDIR.TAG,sha256=WVMVbX4MVkpCclExbq8m-IcOZIOuIZf5FrYw5Pk-Ma4,43
|
39
40
|
crackerjack/__init__.py,sha256=AuglbbJHkUJ2GdvyT0ca35ntexo1RkT2V6DgypoFeEk,121
|
40
|
-
crackerjack/__main__.py,sha256=
|
41
|
-
crackerjack/crackerjack.py,sha256=
|
42
|
-
crackerjack/pyproject.toml,sha256=
|
43
|
-
crackerjack-0.
|
41
|
+
crackerjack/__main__.py,sha256=3TrS-Hejbx315O558j3MI2L59VX0Y6t0tz5L41NTVG0,1738
|
42
|
+
crackerjack/crackerjack.py,sha256=Aa5Mb0p63W2AG0rcYzU1H2iez-z42eGqDP3dWPRbh9A,6693
|
43
|
+
crackerjack/pyproject.toml,sha256=jxftrdjb7ze5UShh5MUIFiI5oW4YT9y7j_dJHh7Iwp8,3277
|
44
|
+
crackerjack-0.11.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|