crackerjack 0.12.0__py3-none-any.whl → 0.13.0__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/__main__.py CHANGED
@@ -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"
@@ -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.
@@ -1,7 +1,7 @@
1
- crackerjack-0.12.0.dist-info/METADATA,sha256=WvBhT8kVf9gxBhKuM_yH4EwNdnuYGEpBEBKYIlptc8A,10289
2
- crackerjack-0.12.0.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- crackerjack-0.12.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- crackerjack-0.12.0.dist-info/licenses/LICENSE,sha256=fDt371P6_6sCu7RyqiZH_AhT1LdN3sN1zjBtqEhDYCk,1531
1
+ crackerjack-0.13.0.dist-info/METADATA,sha256=tosPl42vttJ7H3wxdi5HBsCg83BTAIFRfMoxvh5U5jQ,11055
2
+ crackerjack-0.13.0.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ crackerjack-0.13.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ crackerjack-0.13.0.dist-info/licenses/LICENSE,sha256=fDt371P6_6sCu7RyqiZH_AhT1LdN3sN1zjBtqEhDYCk,1531
5
5
  crackerjack/.coverage,sha256=dLzPzp72qZEXohNfxnOAlRwvM9dqF06-HoFqfvXZd1U,53248
6
6
  crackerjack/.gitignore,sha256=l8ErBAypC3rI6N9lhc7ZMdOw87t0Tz69ZW5C6uj15Wg,214
7
7
  crackerjack/.libcst.codemod.yaml,sha256=a8DlErRAIPV1nE6QlyXPAzTOgkB24_spl2E9hphuf5s,772
@@ -40,13 +40,13 @@ crackerjack/.ruff_cache/0.7.1/1024065805990144819,sha256=3Sww592NB0PWBNHU_UIqvqg
40
40
  crackerjack/.ruff_cache/0.7.1/285614542852677309,sha256=mOHKRzKoSvW-1sHtqI_LHWRt-mBinJ4rQRtp9Yqzv5I,224
41
41
  crackerjack/.ruff_cache/0.7.3/16061516852537040135,sha256=AWJR9gmaO7-wpv8mY1homuwI8CrMPI3VrnbXH-wRPlg,224
42
42
  crackerjack/.ruff_cache/0.8.4/16354268377385700367,sha256=Ksz4X8N6Z1i83N0vV1PxmBRlqgjrtzmDCOg7VBF4baQ,224
43
- crackerjack/.ruff_cache/0.9.10/12813592349865671909,sha256=c68BYIC0rNDH3TrWX-RKYI1gb7KGKAck8MOpwzySX7U,224
43
+ crackerjack/.ruff_cache/0.9.10/12813592349865671909,sha256=ljyRwrfGnholtUN-9x9096LMPL8qRpp8G_h_zDCZvnE,224
44
44
  crackerjack/.ruff_cache/0.9.3/13948373885254993391,sha256=kGhtIkzPUtKAgvlKs3D8j4QM4qG8RhsHrmQJI69Sv3o,224
45
45
  crackerjack/.ruff_cache/0.9.9/12813592349865671909,sha256=tmr8_vhRD2OxsVuMfbJPdT9fDFX-d5tfC5U9jgziyho,224
46
46
  crackerjack/.ruff_cache/0.9.9/8843823720003377982,sha256=e4ymkXfQsUg5e_mtO34xTsaTvs1uA3_fI216Qq9qCAM,136
47
47
  crackerjack/.ruff_cache/CACHEDIR.TAG,sha256=WVMVbX4MVkpCclExbq8m-IcOZIOuIZf5FrYw5Pk-Ma4,43
48
48
  crackerjack/__init__.py,sha256=EOKnIXfBAvxS55uPkpk5DbcNqVS29wja_IcCPaGwyus,141
49
- crackerjack/__main__.py,sha256=nraD_3T7XokPEniztNRxfh6hMCRS7ihRucQWswb7j9I,3485
50
- crackerjack/crackerjack.py,sha256=W7azMMGcZ5xZjthU6vIqHhXm0UAmENFSPJvb4pFaxjY,17401
51
- crackerjack/pyproject.toml,sha256=z5FPRNjNaa9_6cb4gnEOdRdjqAOKI57Lunk-E3F3ZeM,3442
52
- crackerjack-0.12.0.dist-info/RECORD,,
49
+ crackerjack/__main__.py,sha256=11gg9itMrUY7-7vPFGc1MrNOuOFIzdm0vheW_PMS_Gk,3783
50
+ crackerjack/crackerjack.py,sha256=RUj2OQ6gnTavj5dfQuAVd1-rWxmGiamR7gnVd8Cfkrs,18003
51
+ crackerjack/pyproject.toml,sha256=T55z6QM_uW0MYsh5y4ufm4NAKU5_6MADcbEw2i5GOYY,3442
52
+ crackerjack-0.13.0.dist-info/RECORD,,