crackerjack 0.10.7__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 ADDED
@@ -0,0 +1 @@
1
+ test crackerjack config
@@ -1,6 +1,6 @@
1
1
  repos:
2
2
  - repo: https://github.com/pdm-project/pdm
3
- rev: 2.22.2 # a PDM release exposing the hook
3
+ rev: 2.22.3 # a PDM release exposing the hook
4
4
  hooks:
5
5
  - id: pdm-lock-check
6
6
  - repo: https://github.com/pre-commit/pre-commit-hooks
@@ -17,7 +17,7 @@ repos:
17
17
  - id: check-added-large-files
18
18
  name: check-added-large-files
19
19
  - repo: https://github.com/astral-sh/ruff-pre-commit
20
- rev: v0.9.3
20
+ rev: v0.9.9
21
21
  hooks:
22
22
  - id: ruff-format
23
23
  - id: ruff
@@ -26,7 +26,7 @@ repos:
26
26
  hooks:
27
27
  - id: vulture
28
28
  - repo: https://github.com/fredrikaverpil/creosote
29
- rev: v4.0.0
29
+ rev: v4.0.1
30
30
  hooks:
31
31
  - id: creosote
32
32
  - repo: https://github.com/ikamensh/flynt/
@@ -34,7 +34,7 @@ repos:
34
34
  hooks:
35
35
  - id: flynt
36
36
  - repo: https://github.com/codespell-project/codespell
37
- rev: v2.4.0
37
+ rev: v2.4.1
38
38
  hooks:
39
39
  - id: codespell
40
40
  additional_dependencies:
@@ -60,16 +60,16 @@ repos:
60
60
  hooks:
61
61
  - id: refurb
62
62
  - repo: https://github.com/PyCQA/bandit
63
- rev: '1.8.2'
63
+ rev: '1.8.3'
64
64
  hooks:
65
65
  - id: bandit
66
66
  args: ["-c", "pyproject.toml"]
67
67
  - repo: https://github.com/RobertCraigie/pyright-python
68
- rev: v1.1.392.post0
68
+ rev: v1.1.396
69
69
  hooks:
70
70
  - id: pyright
71
71
  - repo: https://github.com/astral-sh/ruff-pre-commit
72
- rev: v0.9.3
72
+ rev: v0.9.9
73
73
  hooks:
74
74
  - id: ruff
75
75
  - id: ruff-format
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
- asyncio.run(crackerjack_it(options=options))
60
+ crackerjack_it(options=options)
62
61
 
63
62
 
64
63
  if __name__ == "__main__":
@@ -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: AsyncPath = AsyncPath(__file__).parent
21
- pkg_path: AsyncPath = AsyncPath(Path.cwd())
22
- settings_path: AsyncPath = pkg_path / ".crackerjack.yaml"
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[AsyncPath] = None
28
- pkg_toml_path: t.Optional[AsyncPath] = None
29
- config: t.Optional[Config] = None
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
- async def update_pyproject_configs(self) -> None:
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
- await self.our_toml_path.write_text(await self.pkg_toml_path.read_text())
27
+ self.our_toml_path.write_text(self.pkg_toml_path.read_text())
37
28
  return
38
- our_toml_config: t.Any = await load.toml(self.our_toml_path) # type: ignore
39
- pkg_toml_config: t.Any = await load.toml(self.pkg_toml_path) # type: ignore
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.config.python_version}", classifier
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
- await dump.toml(pkg_toml_config, self.pkg_toml_path) # type: ignore
61
+ self.pkg_toml_path.write_text(dumps(pkg_toml_config))
73
62
 
74
- async def copy_configs(self) -> None:
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
- await pkg_config_path.touch(exist_ok=True)
68
+ pkg_config_path.touch()
80
69
  if self.pkg_path.stem == "crackerjack":
81
- await config_path.write_text(await pkg_config_path.read_text())
70
+ config_path.write_text(pkg_config_path.read_text())
82
71
  continue
83
72
  if config != ".gitignore":
84
- await pkg_config_path.write_text(
85
- (await config_path.read_text()).replace(
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
- async def run_interactive(self, hook: str) -> None:
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 = await ainput(f"\n\n{hook.title()} failed. Retry? (y/N): ")
97
- await aprint()
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
- sys.exit()
87
+ raise SystemExit(1)
101
88
  success = True
102
89
 
103
- async def update_pkg_configs(self) -> None:
104
- await self.copy_configs()
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
- await self.update_pyproject_configs()
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
- async def run_pre_commit(self) -> None:
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
- await aprint("\n\nPre-commit failed. Please fix errors.\n")
137
- raise SystemExit()
114
+ print("\n\nPre-commit failed. Please fix errors.\n")
115
+ raise SystemExit(1)
138
116
 
139
- async def process(self, options: t.Any) -> None:
140
- self.pkg_name = underscore(self.pkg_path.stem.lower())
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
- await self.pkg_dir.mkdir(exist_ok=True)
143
- await aprint("\nCrackerjacking...\n")
120
+ self.pkg_dir.mkdir(exist_ok=True)
121
+ print("\nCrackerjacking...\n")
144
122
  if not options.do_not_update_configs:
145
- await self.update_pkg_configs()
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
- await self.run_interactive(hook)
152
- await self.run_pre_commit()
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
- await aprint(build.stdout)
137
+ print(build.stdout)
160
138
  if build.returncode > 0:
161
- await aprint(build.stderr)
162
- await aprint("\n\nBuild failed. Please fix errors.\n")
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 = await ainput("\nCommit message: ")
144
+ commit_msg = input("\nCommit message: ")
167
145
  execute(
168
146
  [
169
147
  "git",
170
148
  "commit",
171
149
  "-m",
172
- str(commit_msg),
150
+ commit_msg,
173
151
  "--no-verify",
174
152
  "--",
175
153
  ".",
176
154
  ]
177
155
  )
178
156
  execute(["git", "push", "origin", "main"])
179
- await aprint("\nCrackerjack complete!\n")
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().run
160
+ crackerjack_it = Crackerjack().process
@@ -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.10.6"
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.10.7
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,10 +1,11 @@
1
- crackerjack-0.10.7.dist-info/METADATA,sha256=qa-u2OigFsX99dGQJkAEo0QcI93kQXfN2ZqjWWJbyVk,6309
2
- crackerjack-0.10.7.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- crackerjack-0.10.7.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- crackerjack-0.10.7.dist-info/licenses/LICENSE,sha256=fDt371P6_6sCu7RyqiZH_AhT1LdN3sN1zjBtqEhDYCk,1531
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/.pre-commit-config.yaml,sha256=uBsb09_9PYl-wrxDbhcaM8o66vQINE2ZRIUXSO6-M90,2271
7
+ crackerjack/.pdm.toml,sha256=dZe44HRcuxxCFESGG8SZIjmc-cGzSoyK3Hs6t4NYA8w,23
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
10
11
  crackerjack/.ruff_cache/0.1.14/602324811142551221,sha256=HIYvldb69IHdMzquAA8JpzU2RDT9shEB_dPvzyeFZ_g,248
@@ -34,9 +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
38
+ crackerjack/.ruff_cache/0.9.9/12813592349865671909,sha256=GwlQRdp98THHbjzhZ7rADn0VvLm-uKPAuC3nAM8gQug,224
37
39
  crackerjack/.ruff_cache/CACHEDIR.TAG,sha256=WVMVbX4MVkpCclExbq8m-IcOZIOuIZf5FrYw5Pk-Ma4,43
38
40
  crackerjack/__init__.py,sha256=AuglbbJHkUJ2GdvyT0ca35ntexo1RkT2V6DgypoFeEk,121
39
- crackerjack/__main__.py,sha256=W0KSo35_rmj_p4Zr2Q6FAvojiiPTmh5kjlggVNcOdac,1766
40
- crackerjack/crackerjack.py,sha256=BkB3A5ukiUWNmNdREZvcpld2-p_a6kEkF3doj5cEw2Q,7811
41
- crackerjack/pyproject.toml,sha256=XiSLMnvNSg4yfQcg0zClDid6Mc4LjIF1Rgsp9laMjWw,3055
42
- crackerjack-0.10.7.dist-info/RECORD,,
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,,