crackerjack 0.10.8__py3-none-any.whl → 0.11.1__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 +44 -71
- crackerjack/pyproject.toml +13 -5
- {crackerjack-0.10.8.dist-info → crackerjack-0.11.1.dist-info}/METADATA +4 -5
- {crackerjack-0.10.8.dist-info → crackerjack-0.11.1.dist-info}/RECORD +10 -9
- {crackerjack-0.10.8.dist-info → crackerjack-0.11.1.dist-info}/WHEEL +0 -0
- {crackerjack-0.10.8.dist-info → crackerjack-0.11.1.dist-info}/entry_points.txt +0 -0
- {crackerjack-0.10.8.dist-info → crackerjack-0.11.1.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,33 @@
|
|
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
|
-
pkg_deps = pkg_toml_config["dependency-groups"]
|
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())
|
41
31
|
for tool, settings in our_toml_config["tool"].items():
|
42
32
|
for setting, value in settings.items():
|
43
33
|
if isinstance(value, str | list) and "crackerjack" in value:
|
@@ -58,50 +48,47 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
|
58
48
|
pkg_toml_config["tool"][tool][setting] + value
|
59
49
|
)
|
60
50
|
pkg_toml_config["tool"][tool] = settings
|
61
|
-
pkg_toml_config["dependency-groups"] = pkg_deps
|
62
51
|
python_version_pattern = r"\s*W*(\d\.\d*)"
|
63
52
|
requires_python = our_toml_config["project"]["requires-python"]
|
64
53
|
classifiers = []
|
65
54
|
for classifier in pkg_toml_config["project"]["classifiers"]:
|
66
55
|
classifier = re.sub(
|
67
|
-
python_version_pattern, f" {self.
|
56
|
+
python_version_pattern, f" {self.python_version}", classifier
|
68
57
|
)
|
69
58
|
classifiers.append(classifier)
|
70
59
|
pkg_toml_config["project"]["classifiers"] = classifiers
|
71
60
|
pkg_toml_config["project"]["requires-python"] = requires_python
|
72
|
-
|
61
|
+
self.pkg_toml_path.write_text(dumps(pkg_toml_config))
|
73
62
|
|
74
|
-
|
63
|
+
def copy_configs(self) -> None:
|
75
64
|
config_files = (".gitignore", ".pre-commit-config.yaml", ".libcst.codemod.yaml")
|
76
65
|
for config in config_files:
|
77
66
|
config_path = self.our_path / config
|
78
67
|
pkg_config_path = self.pkg_path / config
|
79
|
-
|
68
|
+
pkg_config_path.touch()
|
80
69
|
if self.pkg_path.stem == "crackerjack":
|
81
|
-
|
70
|
+
config_path.write_text(pkg_config_path.read_text())
|
82
71
|
continue
|
83
72
|
if config != ".gitignore":
|
84
|
-
|
85
|
-
(
|
86
|
-
"crackerjack", self.pkg_name
|
87
|
-
)
|
73
|
+
pkg_config_path.write_text(
|
74
|
+
(config_path.read_text()).replace("crackerjack", self.pkg_name)
|
88
75
|
)
|
89
76
|
execute(["git", "add", config])
|
90
77
|
|
91
|
-
|
78
|
+
def run_interactive(self, hook: str) -> None:
|
92
79
|
success: bool = False
|
93
80
|
while not success:
|
94
81
|
fail = execute(["pre-commit", "run", hook.lower(), "--all-files"])
|
95
82
|
if fail.returncode > 0:
|
96
|
-
retry =
|
97
|
-
|
83
|
+
retry = input(f"\n\n{hook.title()} failed. Retry? (y/N): ")
|
84
|
+
print()
|
98
85
|
if retry.strip().lower() == "y":
|
99
86
|
continue
|
100
|
-
|
87
|
+
raise SystemExit(1)
|
101
88
|
success = True
|
102
89
|
|
103
|
-
|
104
|
-
|
90
|
+
def update_pkg_configs(self) -> None:
|
91
|
+
self.copy_configs()
|
105
92
|
installed_pkgs = execute(
|
106
93
|
["pdm", "list", "--freeze"],
|
107
94
|
capture_output=True,
|
@@ -117,71 +104,57 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
|
117
104
|
execute(["git", "add", "pdm.lock"])
|
118
105
|
execute(["pre-commit", "install"])
|
119
106
|
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")
|
107
|
+
self.update_pyproject_configs()
|
130
108
|
|
131
|
-
|
109
|
+
def run_pre_commit(self) -> None:
|
132
110
|
check_all = execute(["pre-commit", "run", "--all-files"])
|
133
111
|
if check_all.returncode > 0:
|
134
112
|
check_all = execute(["pre-commit", "run", "--all-files"])
|
135
113
|
if check_all.returncode > 0:
|
136
|
-
|
137
|
-
raise SystemExit()
|
114
|
+
print("\n\nPre-commit failed. Please fix errors.\n")
|
115
|
+
raise SystemExit(1)
|
138
116
|
|
139
|
-
|
140
|
-
self.pkg_name =
|
117
|
+
def process(self, options: t.Any) -> None:
|
118
|
+
self.pkg_name = self.pkg_path.stem.lower().replace("-", "_")
|
141
119
|
self.pkg_dir = self.pkg_path / self.pkg_name
|
142
|
-
|
143
|
-
|
120
|
+
self.pkg_dir.mkdir(exist_ok=True)
|
121
|
+
print("\nCrackerjacking...\n")
|
144
122
|
if not options.do_not_update_configs:
|
145
|
-
|
123
|
+
self.update_pkg_configs()
|
146
124
|
execute(["pdm", "install"])
|
147
125
|
if self.pkg_path.stem == "crackerjack" and options.update_precommit:
|
148
126
|
execute(["pre-commit", "autoupdate"])
|
149
127
|
if options.interactive:
|
150
128
|
for hook in ("refurb", "bandit", "pyright"):
|
151
|
-
|
152
|
-
|
129
|
+
self.run_interactive(hook)
|
130
|
+
self.run_pre_commit()
|
153
131
|
for option in (options.publish, options.bump):
|
154
132
|
if option:
|
155
133
|
execute(["pdm", "bump", option])
|
156
134
|
break
|
157
135
|
if options.publish:
|
158
136
|
build = execute(["pdm", "build"], capture_output=True, text=True)
|
159
|
-
|
137
|
+
print(build.stdout)
|
160
138
|
if build.returncode > 0:
|
161
|
-
|
162
|
-
|
163
|
-
raise SystemExit()
|
139
|
+
print(build.stderr)
|
140
|
+
print("\n\nBuild failed. Please fix errors.\n")
|
141
|
+
raise SystemExit(1)
|
164
142
|
execute(["pdm", "publish", "--no-build"])
|
165
143
|
if options.commit:
|
166
|
-
commit_msg =
|
144
|
+
commit_msg = input("\nCommit message: ")
|
167
145
|
execute(
|
168
146
|
[
|
169
147
|
"git",
|
170
148
|
"commit",
|
171
149
|
"-m",
|
172
|
-
|
150
|
+
commit_msg,
|
173
151
|
"--no-verify",
|
174
152
|
"--",
|
175
153
|
".",
|
176
154
|
]
|
177
155
|
)
|
178
156
|
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
|
157
|
+
print("\nCrackerjack complete!\n")
|
185
158
|
|
186
159
|
|
187
|
-
crackerjack_it = Crackerjack().
|
160
|
+
crackerjack_it = Crackerjack().process
|
crackerjack/pyproject.toml
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
[tool.pytest.ini_options]
|
2
|
+
addopts = "--cov=crackerjack"
|
3
|
+
|
1
4
|
[tool.codespell]
|
2
5
|
skip = "*/data/*"
|
3
6
|
quiet-level = 3
|
@@ -9,6 +12,7 @@ target-version = "py313"
|
|
9
12
|
fix = true
|
10
13
|
show-fixes = true
|
11
14
|
output-format = "full"
|
15
|
+
unsafe-fixes = true
|
12
16
|
|
13
17
|
[tool.ruff.format]
|
14
18
|
docstring-code-format = true
|
@@ -57,6 +61,9 @@ exclude-deps = [
|
|
57
61
|
"autotyping",
|
58
62
|
"pre-commit",
|
59
63
|
"pytest",
|
64
|
+
"pytest-asyncio",
|
65
|
+
"pytest-cov",
|
66
|
+
"pytest-mock",
|
60
67
|
"pdm",
|
61
68
|
"pyfiglet",
|
62
69
|
"pyyaml",
|
@@ -72,6 +79,7 @@ target = [
|
|
72
79
|
"crackerjack",
|
73
80
|
]
|
74
81
|
skips = [
|
82
|
+
"B101",
|
75
83
|
"B301",
|
76
84
|
"B311",
|
77
85
|
"B403",
|
@@ -79,6 +87,7 @@ skips = [
|
|
79
87
|
"B602",
|
80
88
|
"B603",
|
81
89
|
"B607",
|
90
|
+
"B704",
|
82
91
|
]
|
83
92
|
|
84
93
|
[tool.pyright]
|
@@ -105,7 +114,7 @@ pythonPlatform = "Darwin"
|
|
105
114
|
|
106
115
|
[project]
|
107
116
|
name = "crackerjack"
|
108
|
-
version = "0.
|
117
|
+
version = "0.11.0"
|
109
118
|
description = "Default template for PDM package"
|
110
119
|
requires-python = ">=3.13"
|
111
120
|
readme = "README.md"
|
@@ -132,17 +141,16 @@ classifiers = [
|
|
132
141
|
]
|
133
142
|
dependencies = [
|
134
143
|
"click>=8.1.8",
|
135
|
-
"aioconsole>=0.8.1",
|
136
|
-
"inflection>=0.5.1",
|
137
144
|
"autotyping>=24.9.0",
|
138
145
|
"pre-commit>=4.0.1",
|
139
146
|
"pytest>=8.3.4",
|
140
147
|
"pydantic>=2.10.4",
|
141
|
-
"aiopath>=0.7.7",
|
142
148
|
"pdm-bump>=0.9.10",
|
143
149
|
"pdm>=2.22.1",
|
144
|
-
"acb>=0.8.0",
|
145
150
|
"uv>=0.5.13",
|
151
|
+
"pytest-cov>=6.0.0",
|
152
|
+
"pytest-mock>=3.14.0",
|
153
|
+
"tomli-w>=1.2.0",
|
146
154
|
]
|
147
155
|
authors = [
|
148
156
|
{ 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.1
|
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,16 @@ 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
|
37
36
|
Description-Content-Type: text/markdown
|
38
37
|
|
39
38
|
# Crackerjack Python
|
@@ -1,9 +1,10 @@
|
|
1
|
-
crackerjack-0.
|
2
|
-
crackerjack-0.
|
3
|
-
crackerjack-0.
|
4
|
-
crackerjack-0.
|
1
|
+
crackerjack-0.11.1.dist-info/METADATA,sha256=JHWIng2eWX0nh_ctgq4m47IggkcXjG-GL1cLR9Eihgc,6285
|
2
|
+
crackerjack-0.11.1.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
+
crackerjack-0.11.1.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
+
crackerjack-0.11.1.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=GwlQRdp98THHbjzhZ7rADn0VvLm-uKPAuC3nAM8gQug,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=vCDPVt1MoZ7Hi-At6D4j5Y8lsHaYQTpEwYnsE05csy0,6580
|
43
|
+
crackerjack/pyproject.toml,sha256=B-7O-v7BHexR9NuUbWBUiPQgAZ7tVHk6Ht_Ba4cHJ1g,3199
|
44
|
+
crackerjack-0.11.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|