crackerjack 0.12.0__tar.gz → 0.13.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.
Files changed (59) hide show
  1. {crackerjack-0.12.0 → crackerjack-0.13.0}/PKG-INFO +47 -8
  2. {crackerjack-0.12.0 → crackerjack-0.13.0}/README.md +46 -7
  3. crackerjack-0.13.0/crackerjack/.ruff_cache/0.9.10/12813592349865671909 +0 -0
  4. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/__main__.py +10 -0
  5. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/crackerjack.py +19 -5
  6. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/pyproject.toml +1 -1
  7. {crackerjack-0.12.0 → crackerjack-0.13.0}/pyproject.toml +1 -1
  8. crackerjack-0.13.0/tests/data/comments_sample.txt +7 -0
  9. crackerjack-0.13.0/tests/data/docstrings_sample.txt +10 -0
  10. crackerjack-0.13.0/tests/test_crackerjack.py +1082 -0
  11. {crackerjack-0.12.0 → crackerjack-0.13.0}/tests/test_main.py +37 -0
  12. crackerjack-0.12.0/crackerjack/.ruff_cache/0.9.10/12813592349865671909 +0 -0
  13. crackerjack-0.12.0/tests/test_crackerjack.py +0 -268
  14. {crackerjack-0.12.0 → crackerjack-0.13.0}/LICENSE +0 -0
  15. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.coverage +0 -0
  16. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.gitignore +0 -0
  17. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.libcst.codemod.yaml +0 -0
  18. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.pdm.toml +0 -0
  19. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.pre-commit-config.yaml +0 -0
  20. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.pytest_cache/.gitignore +0 -0
  21. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.pytest_cache/CACHEDIR.TAG +0 -0
  22. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.pytest_cache/README.md +0 -0
  23. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.pytest_cache/v/cache/nodeids +0 -0
  24. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.pytest_cache/v/cache/stepwise +0 -0
  25. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/.gitignore +0 -0
  26. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.1.11/3256171999636029978 +0 -0
  27. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.1.14/602324811142551221 +0 -0
  28. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.1.4/10355199064880463147 +0 -0
  29. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.1.6/15140459877605758699 +0 -0
  30. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.1.7/1790508110482614856 +0 -0
  31. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.1.9/17041001205004563469 +0 -0
  32. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.2.0/10047773857155985907 +0 -0
  33. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.2.1/8522267973936635051 +0 -0
  34. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.2.2/18053836298936336950 +0 -0
  35. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.3.0/12548816621480535786 +0 -0
  36. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.3.3/11081883392474770722 +0 -0
  37. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.3.4/676973378459347183 +0 -0
  38. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.3.5/16311176246009842383 +0 -0
  39. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.5.7/1493622539551733492 +0 -0
  40. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.5.7/6231957614044513175 +0 -0
  41. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.5.7/9932762556785938009 +0 -0
  42. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.6.0/11982804814124138945 +0 -0
  43. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.6.0/12055761203849489982 +0 -0
  44. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.6.2/1206147804896221174 +0 -0
  45. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.6.4/1206147804896221174 +0 -0
  46. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.6.5/1206147804896221174 +0 -0
  47. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.6.7/3657366982708166874 +0 -0
  48. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.6.9/285614542852677309 +0 -0
  49. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.7.1/1024065805990144819 +0 -0
  50. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.7.1/285614542852677309 +0 -0
  51. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.7.3/16061516852537040135 +0 -0
  52. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.8.4/16354268377385700367 +0 -0
  53. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.9.3/13948373885254993391 +0 -0
  54. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.9.9/12813592349865671909 +0 -0
  55. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/0.9.9/8843823720003377982 +0 -0
  56. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/.ruff_cache/CACHEDIR.TAG +0 -0
  57. {crackerjack-0.12.0 → crackerjack-0.13.0}/crackerjack/__init__.py +0 -0
  58. {crackerjack-0.12.0 → crackerjack-0.13.0}/tests/__init__.py +0 -0
  59. {crackerjack-0.12.0 → crackerjack-0.13.0}/tests/data/init.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: crackerjack
3
- Version: 0.12.0
3
+ Version: 0.13.0
4
4
  Summary: Default template for PDM package
5
5
  Keywords: black,ruff,mypy,creosote,refurb
6
6
  Author-Email: lesleslie <les@wedgwoodwebworks.com>
@@ -52,6 +52,31 @@ Description-Content-Type: text/markdown
52
52
 
53
53
  Crackerjack is an opinionated Python project management tool designed to help you create, maintain, and publish high-quality Python projects with ease. It combines best-in-class tools and a streamlined workflow to ensure code quality, consistency, and reliability.
54
54
 
55
+ ---
56
+
57
+ ## Getting Started
58
+
59
+ ### Quick Start
60
+
61
+ If you're new to Crackerjack, follow these steps:
62
+ 1. **Install Python 3.13:** Ensure you have Python 3.13 installed.
63
+ 2. **Install PDM:**
64
+ ```
65
+ pipx install pdm
66
+ ```
67
+ 3. **Install Crackerjack:**
68
+ ```
69
+ pip install crackerjack
70
+ ```
71
+
72
+ 4. **Initialize a New Project:**
73
+ Navigate to your project's root directory and run:
74
+ ```
75
+ python -m crackerjack
76
+ ```
77
+
78
+ ---
79
+
55
80
  ## The Crackerjack Philosophy
56
81
 
57
82
  Crackerjack is built on the following core principles:
@@ -61,7 +86,7 @@ Crackerjack is built on the following core principles:
61
86
  - **Consistency:** Code style, formatting, and project structure should be consistent across projects.
62
87
  - **Reliability:** Tests are essential, and code should be checked rigorously.
63
88
  - **Tool Integration:** Leverage powerful existing tools instead of reinventing the wheel.
64
- - **Static Typing:** Static typing is essential for all development.
89
+ - **Static Typing:** Static typing is essential for all development.
65
90
 
66
91
  ## Key Features
67
92
 
@@ -76,7 +101,7 @@ Crackerjack provides:
76
101
  - **Built-in Testing:** Automatically runs tests using `pytest`.
77
102
  - **Easy Version Bumping:** Provides commands to bump the project version (micro, minor, or major).
78
103
  - **Simplified Publishing:** Automates publishing to PyPI via PDM.
79
- - **Commit and Push:** Commits and pushes your changes.
104
+ - **Commit and Push:** Commits and pushes your changes.
80
105
 
81
106
  ## Pre-commit Hooks
82
107
 
@@ -101,7 +126,7 @@ Crackerjack projects adhere to these guidelines:
101
126
 
102
127
  - **Static Typing:** Use type hints consistently throughout your code.
103
128
  - **Explicit Naming:** Choose clear, descriptive names for classes, functions, variables, and other identifiers.
104
- - **Markdown for Documentation:** Use Markdown (`.md`) for all documentation, including docstrings, READMEs, etc.
129
+ - **Markdown for Documentation:** Use Markdown (`.md`) for all documentation, READMEs, etc.
105
130
  - **Pathlib:** Use `pathlib.Path` for handling file and directory paths instead of `os.path`.
106
131
  - **Consistent Imports:** Use `import typing as t` for type hinting.
107
132
  - **Constants and Config:** Do not use all-caps for constants or configuration settings.
@@ -141,12 +166,14 @@ Run Crackerjack from the root of your Python project using:
141
166
  - `-i`, `--interactive`: Run pre-commit hooks interactively when possible.
142
167
  - `-n`, `--no-config-updates`: Skip updating configuration files (e.g., `pyproject.toml`).
143
168
  - `-u`, `--update-precommit`: Update pre-commit hooks to the latest versions.
144
- - `-v`, `--verbose`: Enable verbose output.
169
+ - `-d`, `--doc`: Generate documentation. (not yet implemented)
170
+ - `-v`, `--verbose`: Enable verbose output. (not yet implemented)
145
171
  - `-p`, `--publish <micro|minor|major>`: Bump the project version and publish to PyPI using PDM.
146
172
  - `-b`, `--bump <micro|minor|major>`: Bump the project version without publishing.
147
173
  - `-x`, `--clean`: Clean code by removing docstrings, line comments, and extra whitespace.
148
174
  - `-t`, `--test`: Run tests using `pytest`.
149
- - `-h`, `--help`: Display help.
175
+ - `-a`, `--all`: Run with `-x -t -p <micro|minor|major> -c` development options.
176
+ - `--help`: Display help.
150
177
 
151
178
  ### Example Workflows
152
179
 
@@ -156,7 +183,7 @@ Run Crackerjack from the root of your Python project using:
156
183
  ```
157
184
 
158
185
  - **Clean code, run checks, run tests, then commit:**
159
- ````
186
+ ```
160
187
  python -m crackerjack -c -x -t
161
188
  ```
162
189
 
@@ -174,15 +201,27 @@ Run Crackerjack from the root of your Python project using:
174
201
  ```
175
202
  python -m crackerjack -b major
176
203
  ```
204
+
177
205
  - **Update pre-commit hooks:**
178
206
  ```
179
207
  python -m crackerjack -u
180
208
  ```
209
+
181
210
  - **Get help:**
182
211
  ```
183
- python -m crackerjack -h
212
+ python -m crackerjack --help
184
213
  ```
185
214
 
215
+ - **Clean code, run checks, run tests, bump version, publish, then commit:**
216
+ ```
217
+ python -m crackerjack -x -t -p minor -c
218
+
219
+ # or even easier
220
+
221
+ python -m crackerjack -a minor
222
+ ```
223
+
224
+
186
225
  ## Contributing
187
226
 
188
227
  Crackerjack is an evolving project. Contributions are welcome! Please open a pull request or issue.
@@ -13,6 +13,31 @@
13
13
 
14
14
  Crackerjack is an opinionated Python project management tool designed to help you create, maintain, and publish high-quality Python projects with ease. It combines best-in-class tools and a streamlined workflow to ensure code quality, consistency, and reliability.
15
15
 
16
+ ---
17
+
18
+ ## Getting Started
19
+
20
+ ### Quick Start
21
+
22
+ If you're new to Crackerjack, follow these steps:
23
+ 1. **Install Python 3.13:** Ensure you have Python 3.13 installed.
24
+ 2. **Install PDM:**
25
+ ```
26
+ pipx install pdm
27
+ ```
28
+ 3. **Install Crackerjack:**
29
+ ```
30
+ pip install crackerjack
31
+ ```
32
+
33
+ 4. **Initialize a New Project:**
34
+ Navigate to your project's root directory and run:
35
+ ```
36
+ python -m crackerjack
37
+ ```
38
+
39
+ ---
40
+
16
41
  ## The Crackerjack Philosophy
17
42
 
18
43
  Crackerjack is built on the following core principles:
@@ -22,7 +47,7 @@ Crackerjack is built on the following core principles:
22
47
  - **Consistency:** Code style, formatting, and project structure should be consistent across projects.
23
48
  - **Reliability:** Tests are essential, and code should be checked rigorously.
24
49
  - **Tool Integration:** Leverage powerful existing tools instead of reinventing the wheel.
25
- - **Static Typing:** Static typing is essential for all development.
50
+ - **Static Typing:** Static typing is essential for all development.
26
51
 
27
52
  ## Key Features
28
53
 
@@ -37,7 +62,7 @@ Crackerjack provides:
37
62
  - **Built-in Testing:** Automatically runs tests using `pytest`.
38
63
  - **Easy Version Bumping:** Provides commands to bump the project version (micro, minor, or major).
39
64
  - **Simplified Publishing:** Automates publishing to PyPI via PDM.
40
- - **Commit and Push:** Commits and pushes your changes.
65
+ - **Commit and Push:** Commits and pushes your changes.
41
66
 
42
67
  ## Pre-commit Hooks
43
68
 
@@ -62,7 +87,7 @@ Crackerjack projects adhere to these guidelines:
62
87
 
63
88
  - **Static Typing:** Use type hints consistently throughout your code.
64
89
  - **Explicit Naming:** Choose clear, descriptive names for classes, functions, variables, and other identifiers.
65
- - **Markdown for Documentation:** Use Markdown (`.md`) for all documentation, including docstrings, READMEs, etc.
90
+ - **Markdown for Documentation:** Use Markdown (`.md`) for all documentation, READMEs, etc.
66
91
  - **Pathlib:** Use `pathlib.Path` for handling file and directory paths instead of `os.path`.
67
92
  - **Consistent Imports:** Use `import typing as t` for type hinting.
68
93
  - **Constants and Config:** Do not use all-caps for constants or configuration settings.
@@ -102,12 +127,14 @@ Run Crackerjack from the root of your Python project using:
102
127
  - `-i`, `--interactive`: Run pre-commit hooks interactively when possible.
103
128
  - `-n`, `--no-config-updates`: Skip updating configuration files (e.g., `pyproject.toml`).
104
129
  - `-u`, `--update-precommit`: Update pre-commit hooks to the latest versions.
105
- - `-v`, `--verbose`: Enable verbose output.
130
+ - `-d`, `--doc`: Generate documentation. (not yet implemented)
131
+ - `-v`, `--verbose`: Enable verbose output. (not yet implemented)
106
132
  - `-p`, `--publish <micro|minor|major>`: Bump the project version and publish to PyPI using PDM.
107
133
  - `-b`, `--bump <micro|minor|major>`: Bump the project version without publishing.
108
134
  - `-x`, `--clean`: Clean code by removing docstrings, line comments, and extra whitespace.
109
135
  - `-t`, `--test`: Run tests using `pytest`.
110
- - `-h`, `--help`: Display help.
136
+ - `-a`, `--all`: Run with `-x -t -p <micro|minor|major> -c` development options.
137
+ - `--help`: Display help.
111
138
 
112
139
  ### Example Workflows
113
140
 
@@ -117,7 +144,7 @@ Run Crackerjack from the root of your Python project using:
117
144
  ```
118
145
 
119
146
  - **Clean code, run checks, run tests, then commit:**
120
- ````
147
+ ```
121
148
  python -m crackerjack -c -x -t
122
149
  ```
123
150
 
@@ -135,15 +162,27 @@ Run Crackerjack from the root of your Python project using:
135
162
  ```
136
163
  python -m crackerjack -b major
137
164
  ```
165
+
138
166
  - **Update pre-commit hooks:**
139
167
  ```
140
168
  python -m crackerjack -u
141
169
  ```
170
+
142
171
  - **Get help:**
143
172
  ```
144
- python -m crackerjack -h
173
+ python -m crackerjack --help
145
174
  ```
146
175
 
176
+ - **Clean code, run checks, run tests, bump version, publish, then commit:**
177
+ ```
178
+ python -m crackerjack -x -t -p minor -c
179
+
180
+ # or even easier
181
+
182
+ python -m crackerjack -a minor
183
+ ```
184
+
185
+
147
186
  ## Contributing
148
187
 
149
188
  Crackerjack is an evolving project. Contributions are welcome! Please open a pull request or issue.
@@ -31,6 +31,7 @@ class Options(BaseModel):
31
31
  update_precommit: bool = False
32
32
  clean: bool = False
33
33
  test: bool = False
34
+ all: t.Optional[BumpOption] = None
34
35
 
35
36
  @classmethod
36
37
  @field_validator("publish", "bump", mode="before")
@@ -80,6 +81,13 @@ cli_options = {
80
81
  help="Remove docstrings, line comments, and unnecessary whitespace.",
81
82
  ),
82
83
  "test": typer.Option(False, "-t", "--test", help="Run tests."),
84
+ "all": typer.Option(
85
+ None,
86
+ "-a",
87
+ "--all",
88
+ help="Run with `-x -t -p <micro|minor|major> -c` development options).",
89
+ case_sensitive=False,
90
+ ),
83
91
  }
84
92
 
85
93
 
@@ -96,6 +104,7 @@ def main(
96
104
  update_precommit: bool = cli_options["update_precommit"],
97
105
  verbose: bool = cli_options["verbose"],
98
106
  publish: t.Optional[BumpOption] = cli_options["publish"],
107
+ all: t.Optional[BumpOption] = cli_options["all"],
99
108
  bump: t.Optional[BumpOption] = cli_options["bump"],
100
109
  clean: bool = cli_options["clean"],
101
110
  test: bool = cli_options["test"],
@@ -111,6 +120,7 @@ def main(
111
120
  bump=bump,
112
121
  clean=clean,
113
122
  test=test,
123
+ all=all,
114
124
  )
115
125
  crackerjack_it(options)
116
126
 
@@ -1,4 +1,5 @@
1
1
  import ast
2
+ import platform
2
3
  import re
3
4
  import subprocess
4
5
  import typing as t
@@ -367,11 +368,10 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
367
368
  if options.clean:
368
369
  if self.pkg_dir:
369
370
  self.code_cleaner.clean_files(self.pkg_dir)
370
- if self.pkg_path.stem == "crackerjack":
371
- tests_dir = self.pkg_path / "tests"
372
- if tests_dir.exists() and tests_dir.is_dir():
373
- self.console.print("\nCleaning tests directory...\n")
374
- self.code_cleaner.clean_files(tests_dir)
371
+ tests_dir = self.pkg_path / "tests"
372
+ if tests_dir.exists() and tests_dir.is_dir():
373
+ self.console.print("\nCleaning tests directory...\n")
374
+ self.code_cleaner.clean_files(tests_dir)
375
375
 
376
376
  def _run_tests(self, options: t.Any) -> None:
377
377
  if options.test:
@@ -394,6 +394,15 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
394
394
 
395
395
  def _publish_project(self, options: t.Any) -> None:
396
396
  if options.publish:
397
+ if platform.system() == "Darwin":
398
+ authorize = self.execute_command(
399
+ ["pdm", "self", "add", "keyring"], capture_output=True, text=True
400
+ )
401
+ if authorize.returncode > 0:
402
+ self.console.print(
403
+ "\n\nAuthorization failed. Please add your keyring credentials to PDM. Run `pdm self add keyring` and try again.\n\n"
404
+ )
405
+ raise SystemExit(1)
397
406
  build = self.execute_command(
398
407
  ["pdm", "build"], capture_output=True, text=True
399
408
  )
@@ -421,6 +430,11 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
421
430
  return execute(cmd, **kwargs)
422
431
 
423
432
  def process(self, options: t.Any) -> None:
433
+ if options.all:
434
+ options.clean = True
435
+ options.test = True
436
+ options.publish = options.all
437
+ options.commit = True
424
438
  self._setup_package()
425
439
  self._update_project(options)
426
440
  self._update_precommit(options)
@@ -120,7 +120,7 @@ pythonPlatform = "Darwin"
120
120
 
121
121
  [project]
122
122
  name = "crackerjack"
123
- version = "0.11.5"
123
+ version = "0.12.1"
124
124
  description = "Default template for PDM package"
125
125
  requires-python = ">=3.13"
126
126
  readme = "README.md"
@@ -124,7 +124,7 @@ pythonPlatform = "Darwin"
124
124
 
125
125
  [project]
126
126
  name = "crackerjack"
127
- version = "0.12.0"
127
+ version = "0.13.0"
128
128
  description = "Default template for PDM package"
129
129
  requires-python = ">=3.13"
130
130
  readme = "README.md"
@@ -0,0 +1,7 @@
1
+ def test_func():
2
+ # This comment should be removed
3
+ return True # remove this inline comment
4
+
5
+ # Full line comment
6
+ x = 1 # type: ignore
7
+ y = 2 # noqa
@@ -0,0 +1,10 @@
1
+ """def test_func():
2
+ \"\"\"This is a docstring.\"\"\"
3
+ return True
4
+
5
+ class TestClass:
6
+ \"\"\"Class docstring.\"\"\"
7
+ def method(self):
8
+ \"\"\"Method docstring.\"\"\"
9
+ pass
10
+ """