crackerjack 0.11.1__tar.gz → 0.11.3__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.
Files changed (48) hide show
  1. {crackerjack-0.11.1 → crackerjack-0.11.3}/PKG-INFO +2 -1
  2. crackerjack-0.11.3/crackerjack/.ruff_cache/0.9.9/12813592349865671909 +0 -0
  3. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/crackerjack.py +5 -4
  4. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/pyproject.toml +7 -1
  5. {crackerjack-0.11.1 → crackerjack-0.11.3}/pyproject.toml +7 -1
  6. crackerjack-0.11.3/tests/test_crackerjack.py +174 -0
  7. {crackerjack-0.11.1 → crackerjack-0.11.3}/tests/test_main.py +1 -4
  8. crackerjack-0.11.1/crackerjack/.ruff_cache/0.9.9/12813592349865671909 +0 -0
  9. crackerjack-0.11.1/tests/test_crackerjack.py +0 -0
  10. {crackerjack-0.11.1 → crackerjack-0.11.3}/LICENSE +0 -0
  11. {crackerjack-0.11.1 → crackerjack-0.11.3}/README.md +0 -0
  12. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.gitignore +0 -0
  13. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.libcst.codemod.yaml +0 -0
  14. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.pdm.toml +0 -0
  15. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.pre-commit-config.yaml +0 -0
  16. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/.gitignore +0 -0
  17. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.1.11/3256171999636029978 +0 -0
  18. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.1.14/602324811142551221 +0 -0
  19. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.1.4/10355199064880463147 +0 -0
  20. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.1.6/15140459877605758699 +0 -0
  21. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.1.7/1790508110482614856 +0 -0
  22. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.1.9/17041001205004563469 +0 -0
  23. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.2.0/10047773857155985907 +0 -0
  24. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.2.1/8522267973936635051 +0 -0
  25. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.2.2/18053836298936336950 +0 -0
  26. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.3.0/12548816621480535786 +0 -0
  27. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.3.3/11081883392474770722 +0 -0
  28. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.3.4/676973378459347183 +0 -0
  29. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.3.5/16311176246009842383 +0 -0
  30. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.5.7/1493622539551733492 +0 -0
  31. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.5.7/6231957614044513175 +0 -0
  32. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.5.7/9932762556785938009 +0 -0
  33. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.6.0/11982804814124138945 +0 -0
  34. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.6.0/12055761203849489982 +0 -0
  35. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.6.2/1206147804896221174 +0 -0
  36. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.6.4/1206147804896221174 +0 -0
  37. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.6.5/1206147804896221174 +0 -0
  38. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.6.7/3657366982708166874 +0 -0
  39. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.6.9/285614542852677309 +0 -0
  40. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.7.1/1024065805990144819 +0 -0
  41. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.7.1/285614542852677309 +0 -0
  42. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.7.3/16061516852537040135 +0 -0
  43. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.8.4/16354268377385700367 +0 -0
  44. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/0.9.3/13948373885254993391 +0 -0
  45. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/.ruff_cache/CACHEDIR.TAG +0 -0
  46. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/__init__.py +0 -0
  47. {crackerjack-0.11.1 → crackerjack-0.11.3}/crackerjack/__main__.py +0 -0
  48. {crackerjack-0.11.1 → crackerjack-0.11.3}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: crackerjack
3
- Version: 0.11.1
3
+ Version: 0.11.3
4
4
  Summary: Default template for PDM package
5
5
  Keywords: black,ruff,mypy,creosote,refurb
6
6
  Author-Email: lesleslie <les@wedgwoodwebworks.com>
@@ -33,6 +33,7 @@ Requires-Dist: uv>=0.5.13
33
33
  Requires-Dist: pytest-cov>=6.0.0
34
34
  Requires-Dist: pytest-mock>=3.14.0
35
35
  Requires-Dist: tomli-w>=1.2.0
36
+ Requires-Dist: pytest-asyncio>=0.25.3
36
37
  Description-Content-Type: text/markdown
37
38
 
38
39
  # Crackerjack Python
@@ -28,6 +28,8 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
28
28
  return
29
29
  our_toml_config: t.Any = loads(self.our_toml_path.read_text())
30
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", {})
31
33
  for tool, settings in our_toml_config["tool"].items():
32
34
  for setting, value in settings.items():
33
35
  if isinstance(value, str | list) and "crackerjack" in value:
@@ -44,14 +46,13 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
44
46
  "skips",
45
47
  "ignore",
46
48
  ) and isinstance(value, list):
47
- settings[setting] = set(
48
- pkg_toml_config["tool"][tool][setting] + value
49
- )
49
+ conf = pkg_toml_config["tool"].get(tool, {}).get(setting, [])
50
+ settings[setting] = list(set(conf + value))
50
51
  pkg_toml_config["tool"][tool] = settings
51
52
  python_version_pattern = r"\s*W*(\d\.\d*)"
52
53
  requires_python = our_toml_config["project"]["requires-python"]
53
54
  classifiers = []
54
- for classifier in pkg_toml_config["project"]["classifiers"]:
55
+ for classifier in pkg_toml_config["project"].get("classifiers", []):
55
56
  classifier = re.sub(
56
57
  python_version_pattern, f" {self.python_version}", classifier
57
58
  )
@@ -1,5 +1,6 @@
1
1
  [tool.pytest.ini_options]
2
2
  addopts = "--cov=crackerjack"
3
+ asyncio_default_fixture_loop_scope = "function"
3
4
 
4
5
  [tool.codespell]
5
6
  skip = "*/data/*"
@@ -69,6 +70,7 @@ exclude-deps = [
69
70
  "pyyaml",
70
71
  "uv",
71
72
  "tomli-w",
73
+ "google-crc32c",
72
74
  ]
73
75
 
74
76
  [tool.refurb]
@@ -108,13 +110,16 @@ reportOptionalCall = false
108
110
  reportUnknownMemberType = false
109
111
  reportUnknownVariableType = false
110
112
  reportUnknownArgumentType = false
113
+ reportInvalidTypeForm = false
114
+ reportUnknownLambdaType = false
115
+ reportUnknownParameterType = "warning"
111
116
  reportPrivateUsage = "warning"
112
117
  pythonVersion = "3.13"
113
118
  pythonPlatform = "Darwin"
114
119
 
115
120
  [project]
116
121
  name = "crackerjack"
117
- version = "0.11.0"
122
+ version = "0.11.2"
118
123
  description = "Default template for PDM package"
119
124
  requires-python = ">=3.13"
120
125
  readme = "README.md"
@@ -151,6 +156,7 @@ dependencies = [
151
156
  "pytest-cov>=6.0.0",
152
157
  "pytest-mock>=3.14.0",
153
158
  "tomli-w>=1.2.0",
159
+ "pytest-asyncio>=0.25.3",
154
160
  ]
155
161
  authors = [
156
162
  { name = "lesleslie", email = "les@wedgwoodwebworks.com" },
@@ -1,5 +1,6 @@
1
1
  [tool.pytest.ini_options]
2
2
  addopts = "--cov=crackerjack"
3
+ asyncio_default_fixture_loop_scope = "function"
3
4
 
4
5
  [tool.codespell]
5
6
  skip = "*/data/*"
@@ -71,6 +72,7 @@ exclude-deps = [
71
72
  "pyyaml",
72
73
  "uv",
73
74
  "tomli-w",
75
+ "google-crc32c",
74
76
  ]
75
77
 
76
78
  [tool.refurb]
@@ -110,13 +112,16 @@ reportOptionalCall = false
110
112
  reportUnknownMemberType = false
111
113
  reportUnknownVariableType = false
112
114
  reportUnknownArgumentType = false
115
+ reportInvalidTypeForm = false
116
+ reportUnknownLambdaType = false
117
+ reportUnknownParameterType = "warning"
113
118
  reportPrivateUsage = "warning"
114
119
  pythonVersion = "3.13"
115
120
  pythonPlatform = "Darwin"
116
121
 
117
122
  [project]
118
123
  name = "crackerjack"
119
- version = "0.11.1"
124
+ version = "0.11.3"
120
125
  description = "Default template for PDM package"
121
126
  requires-python = ">=3.13"
122
127
  readme = "README.md"
@@ -153,6 +158,7 @@ dependencies = [
153
158
  "pytest-cov>=6.0.0",
154
159
  "pytest-mock>=3.14.0",
155
160
  "tomli-w>=1.2.0",
161
+ "pytest-asyncio>=0.25.3",
156
162
  ]
157
163
  authors = [
158
164
  { name = "lesleslie", email = "les@wedgwoodwebworks.com" },
@@ -0,0 +1,174 @@
1
+ import typing as t
2
+ from pathlib import Path
3
+ from unittest.mock import MagicMock, call, patch
4
+
5
+ import pytest
6
+ from crackerjack.__main__ import options
7
+ from crackerjack.crackerjack import Crackerjack
8
+
9
+
10
+ @pytest.fixture
11
+ def mock_execute() -> t.Generator[t.Any, t.Any, t.Any]:
12
+ with patch("crackerjack.crackerjack.execute") as mock:
13
+ yield mock
14
+
15
+
16
+ @pytest.fixture
17
+ def mock_subprocess_run() -> t.Generator[t.Any, t.Any, t.Any]:
18
+ with patch("subprocess.run") as mock:
19
+ yield mock
20
+
21
+
22
+ @pytest.fixture
23
+ def mock_print() -> t.Generator[t.Any, t.Any, t.Any]:
24
+ with patch("builtins.print") as mock:
25
+ yield mock
26
+
27
+
28
+ @pytest.fixture
29
+ def mock_input() -> t.Generator[t.Any, t.Any, t.Any]:
30
+ with patch("builtins.input") as mock:
31
+ yield mock
32
+
33
+
34
+ @pytest.fixture(autouse=True)
35
+ def reset_options() -> None:
36
+ """Resets the options before each test."""
37
+ options.commit = False
38
+ options.interactive = False
39
+ options.doc = False
40
+ options.update_precommit = False
41
+ options.do_not_update_configs = False
42
+ options.publish = False
43
+ options.bump = False
44
+ options.verbose = False
45
+
46
+
47
+ @pytest.fixture
48
+ def tmp_path_package(tmp_path: Path) -> Path:
49
+ return tmp_path / "my-package"
50
+
51
+
52
+ @pytest.fixture
53
+ def create_package_dir(tmp_path_package: Path) -> None:
54
+ (tmp_path_package / "my_package").mkdir(parents=True)
55
+ (tmp_path_package / "pyproject.toml").touch()
56
+ (tmp_path_package / ".gitignore").touch()
57
+ (tmp_path_package / ".pre-commit-config.yaml").touch()
58
+ (tmp_path_package / ".libcst.codemod.yaml").touch()
59
+
60
+
61
+ class TestCrackerjackProcess:
62
+ def test_process_all_options(
63
+ self,
64
+ mock_execute: MagicMock,
65
+ mock_print: MagicMock,
66
+ mock_input: MagicMock,
67
+ mock_subprocess_run: MagicMock,
68
+ tmp_path: Path,
69
+ tmp_path_package: Path,
70
+ create_package_dir: None,
71
+ ) -> None:
72
+ mock_input.return_value = "Test Commit"
73
+ mock_execute.return_value.returncode = 0
74
+ mock_execute.return_value.stdout = "Mock Build Output"
75
+ mock_subprocess_run.return_value.returncode = 0
76
+ mock_execute.return_value.stderr = ""
77
+ mock_subprocess_run.return_value.stdout = ""
78
+ mock_subprocess_run.return_value.stderr = ""
79
+ crackerjack_instance = Crackerjack(pkg_path=tmp_path_package)
80
+ options_mock = MagicMock()
81
+ options_mock.do_not_update_configs = False
82
+ options_mock.update_precommit = True
83
+ options_mock.interactive = True
84
+ options_mock.commit = False
85
+ options_mock.publish = None
86
+ options_mock.bump = None
87
+ crackerjack_instance.process(options_mock)
88
+
89
+ assert crackerjack_instance.pkg_name == "my_package"
90
+ (tmp_path_package / "my_package").exists()
91
+ mock_execute.assert_has_calls(
92
+ [
93
+ call(["pdm", "self", "add", "keyring"]),
94
+ call(["pdm", "config", "python.use_uv", "true"]),
95
+ call(["git", "init"]),
96
+ call(["git", "branch", "-m", "main"]),
97
+ call(["git", "add", "pyproject.toml"]),
98
+ call(["git", "add", "pdm.lock"]),
99
+ call(["pre-commit", "install"]),
100
+ call(["git", "config", "advice.addIgnoredFile", "false"]),
101
+ call(["pdm", "install"]),
102
+ call(["pre-commit", "run", "refurb", "--all-files"]),
103
+ call(["pre-commit", "run", "bandit", "--all-files"]),
104
+ call(["pre-commit", "run", "pyright", "--all-files"]),
105
+ call(["pre-commit", "run", "--all-files"]),
106
+ call(["git", "add", ".gitignore"]),
107
+ call(["git", "add", ".pre-commit-config.yaml"]),
108
+ call(["git", "add", ".libcst.codemod.yaml"]),
109
+ ],
110
+ any_order=True,
111
+ )
112
+
113
+ def test_process_no_options(
114
+ self,
115
+ mock_execute: MagicMock,
116
+ mock_print: MagicMock,
117
+ mock_subprocess_run: MagicMock,
118
+ tmp_path_package: Path,
119
+ create_package_dir: None,
120
+ ) -> None:
121
+ mock_execute.return_value.returncode = 0
122
+ mock_subprocess_run.return_value.returncode = 0
123
+ crackerjack_instance = Crackerjack(pkg_path=tmp_path_package)
124
+ options_mock = MagicMock()
125
+ options_mock.do_not_update_configs = True
126
+ options_mock.update_precommit = False
127
+ options_mock.interactive = False
128
+ options_mock.publish = None
129
+ options_mock.bump = None
130
+ options_mock.commit = False
131
+
132
+ crackerjack_instance.process(options_mock)
133
+
134
+ assert crackerjack_instance.pkg_name == "my_package"
135
+ (tmp_path_package / "my_package").exists()
136
+ mock_execute.assert_has_calls(
137
+ [
138
+ call(["pre-commit", "run", "--all-files"]),
139
+ ]
140
+ )
141
+
142
+ def test_process_interactive_hooks(
143
+ self,
144
+ mock_execute: MagicMock,
145
+ mock_print: MagicMock,
146
+ mock_subprocess_run: MagicMock,
147
+ tmp_path_package: Path,
148
+ create_package_dir: None,
149
+ ) -> None:
150
+ mock_execute.return_value.returncode = 0
151
+ mock_subprocess_run.return_value.returncode = 0
152
+
153
+ crackerjack_instance = Crackerjack(pkg_path=tmp_path_package)
154
+ options_mock = MagicMock()
155
+ options_mock.do_not_update_configs = False
156
+ options_mock.update_precommit = False
157
+ options_mock.interactive = True
158
+ options_mock.publish = None
159
+ options_mock.bump = None
160
+ options_mock.commit = False
161
+
162
+ crackerjack_instance.process(options_mock)
163
+
164
+ assert crackerjack_instance.pkg_name == "my_package"
165
+ (tmp_path_package / "my_package").exists()
166
+
167
+ mock_execute.assert_has_calls(
168
+ [
169
+ call(["pre-commit", "run", "refurb", "--all-files"]),
170
+ call(["pre-commit", "run", "bandit", "--all-files"]),
171
+ call(["pre-commit", "run", "pyright", "--all-files"]),
172
+ call(["pre-commit", "run", "--all-files"]),
173
+ ]
174
+ )
@@ -2,15 +2,13 @@ import typing as t
2
2
 
3
3
  import pytest
4
4
  from click.testing import CliRunner
5
- from crackerjack.__main__ import crackerjack, options # Import crackerjack and options
5
+ from crackerjack.__main__ import crackerjack, options
6
6
  from crackerjack.crackerjack import Crackerjack
7
7
 
8
8
 
9
- # Mock crackerjack_it before test suite
10
9
  @pytest.fixture(autouse=True)
11
10
  def mock_crackerjack_it(monkeypatch: pytest.MonkeyPatch) -> None:
12
11
  def mock_process(self: Crackerjack, options: t.Any) -> None:
13
- """Mock implementation for crackerjack_it process function."""
14
12
  pass
15
13
 
16
14
  monkeypatch.setattr(Crackerjack, "process", mock_process)
@@ -23,7 +21,6 @@ def runner() -> CliRunner:
23
21
 
24
22
  @pytest.fixture(autouse=True)
25
23
  def reset_options() -> None:
26
- """Resets the options before each test."""
27
24
  options.commit = False
28
25
  options.interactive = False
29
26
  options.doc = False
File without changes
File without changes
File without changes