|
2 | 2 |
|
3 | 3 | import asyncio |
4 | 4 | import os |
5 | | -from typing import TYPE_CHECKING |
| 5 | +from typing import TYPE_CHECKING, Annotated |
6 | 6 |
|
7 | 7 | import typer |
8 | 8 | from packaging.version import Version |
|
25 | 25 |
|
26 | 26 | @app.command() |
27 | 27 | def list_dependencies(): |
28 | | - """Checks whether a dependency needs updating.""" |
| 28 | + """List all the dependencies for the project.""" |
29 | 29 | project = Project(gh_pat=GH_PAT) |
30 | 30 |
|
31 | 31 | # base dependencies |
@@ -119,12 +119,10 @@ def list_dependencies(): |
119 | 119 |
|
120 | 120 |
|
121 | 121 | @app.command() |
122 | | -def check_dependency(dependency: str): |
123 | | - """Checks whether a dependency needs updating. |
124 | | -
|
125 | | - Args: |
126 | | - dependency: Name of the dependency to check. |
127 | | - """ |
| 122 | +def check_dependency( |
| 123 | + dependency: Annotated[str, typer.Argument(help="Name of the dependency to check")], |
| 124 | +): |
| 125 | + """Checks whether a dependency needs updating.""" |
128 | 126 | project = Project(gh_pat=GH_PAT) |
129 | 127 |
|
130 | 128 | try: |
@@ -156,24 +154,22 @@ def check_dependency(dependency: str): |
156 | 154 |
|
157 | 155 | @app.command() |
158 | 156 | def needs_updating( |
159 | | - base: bool = True, |
160 | | - optional_deps: bool = True, |
161 | | - group_deps: bool = True, |
162 | | - github_actions: bool = True, |
163 | | - pre_commit: bool = True, |
| 157 | + base: Annotated[bool, typer.Option(help="Include base dependencies")] = True, |
| 158 | + optional_deps: Annotated[ |
| 159 | + bool, |
| 160 | + typer.Option(help="Include optional dependencies"), |
| 161 | + ] = True, |
| 162 | + group_deps: Annotated[bool, typer.Option(help="Include dependency groups")] = True, |
| 163 | + github_actions: Annotated[ |
| 164 | + bool, |
| 165 | + typer.Option(help="Include GitHub actions dependencies"), |
| 166 | + ] = True, |
| 167 | + pre_commit: Annotated[ |
| 168 | + bool, |
| 169 | + typer.Option(help="Include pre-commit dependencies"), |
| 170 | + ] = True, |
164 | 171 | ): |
165 | | - """List the dependencies that need updating. |
166 | | -
|
167 | | - Args: |
168 | | - base: If set to True, includes the base dependencies. Defaults to True. |
169 | | - optional_deps: If set to True, includes the optional dependencies. Defaults to |
170 | | - True. |
171 | | - group_deps: If set to True, includes the dependency groups. Defaults to True. |
172 | | - github_actions: If set to True, includes the github actions dependencies. |
173 | | - Defaults to True. |
174 | | - pre_commit: If set to True, includes the pre-commit dependencies. Defaults to |
175 | | - True. |
176 | | - """ |
| 172 | + """Lists the dependencies that need updating.""" |
177 | 173 | # create project object |
178 | 174 | project = Project(gh_pat=GH_PAT) |
179 | 175 |
|
@@ -225,24 +221,22 @@ def needs_updating( |
225 | 221 |
|
226 | 222 | @app.command() |
227 | 223 | def latest_versions( |
228 | | - base: bool = True, |
229 | | - optional_deps: bool = True, |
230 | | - group_deps: bool = True, |
231 | | - github_actions: bool = False, |
232 | | - pre_commit: bool = True, |
| 224 | + base: Annotated[bool, typer.Option(help="Include base dependencies")] = True, |
| 225 | + optional_deps: Annotated[ |
| 226 | + bool, |
| 227 | + typer.Option(help="Include optional dependencies"), |
| 228 | + ] = True, |
| 229 | + group_deps: Annotated[bool, typer.Option(help="Include dependency groups")] = True, |
| 230 | + github_actions: Annotated[ |
| 231 | + bool, |
| 232 | + typer.Option(help="Include GitHub actions dependencies"), |
| 233 | + ] = False, |
| 234 | + pre_commit: Annotated[ |
| 235 | + bool, |
| 236 | + typer.Option(help="Include pre-commit dependencies"), |
| 237 | + ] = True, |
233 | 238 | ): |
234 | | - """List the dependencies that aren't pinned to the latest version. |
235 | | -
|
236 | | - Args: |
237 | | - base: If set to True, includes the base dependencies. Defaults to True. |
238 | | - optional_deps: If set to True, includes the optional dependencies. Defaults to |
239 | | - True. |
240 | | - group_deps: If set to True, includes the dependency groups. Defaults to True. |
241 | | - github_actions: If set to True, includes the github actions dependencies. |
242 | | - Defaults to False. |
243 | | - pre_commit: If set to True, includes the pre-commit dependencies. Defaults to |
244 | | - True. |
245 | | - """ |
| 239 | + """List the dependencies that aren't specified to the latest version.""" |
246 | 240 | # create project object |
247 | 241 | project = Project(gh_pat=GH_PAT) |
248 | 242 |
|
@@ -294,18 +288,24 @@ def latest_versions( |
294 | 288 |
|
295 | 289 | @app.command() |
296 | 290 | def update( |
297 | | - dependency: str, |
298 | | - version: str | None = None, |
299 | | - target_branch: str = "master", |
| 291 | + dependency: Annotated[str, typer.Argument(help="Dependency to update")], |
| 292 | + version: Annotated[ |
| 293 | + str | None, |
| 294 | + typer.Option(help="Version to update to, latest version if not specified"), |
| 295 | + ] = None, |
| 296 | + target_branch: Annotated[ |
| 297 | + str, |
| 298 | + typer.Option(help="Name of the branch to merge PR to"), |
| 299 | + ] = "master", |
300 | 300 | ): |
301 | | - """_summary_. |
| 301 | + """Updates a dependency to a specific (or latest) version. |
302 | 302 |
|
303 | | - Make sure branch locally and on github do not already exist! |
| 303 | + Makes changes to the dependency specification locally and creates a GitHub pull |
| 304 | + request on a new branch (branch name = dependency/{package_name}-{version}). Make |
| 305 | + sure this branch name does not exist locally or on GitHub. |
304 | 306 |
|
305 | | - Args: |
306 | | - dependency: _description_ |
307 | | - version: _description_ |
308 | | - target_branch: _description_ |
| 307 | + Requires git and the GitHub CLI to be installed. It is recommended to have a clean |
| 308 | + git before running this command. |
309 | 309 | """ |
310 | 310 | with Progress( |
311 | 311 | SpinnerColumn(), |
|
0 commit comments