Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update typer #885

Merged
merged 2 commits into from
Nov 7, 2024
Merged

Update typer #885

merged 2 commits into from
Nov 7, 2024

Conversation

ptgolden
Copy link
Member

@ptgolden ptgolden commented Nov 5, 2024

Related issues

Summary

  • Updates typer to 0.12.0
  • Moves CLI to new Annotated API
  • Removes duplicated function signatures in cli.py that are also in solr_cli.py

Checks

  • All tests have passed (or issues created for failing tests)

Patrick Golden added 2 commits November 4, 2024 12:32
This is a rather large commit, but should not change any functionality.

First and foremost, all options and arguments are defined using the
typing.Annotated API introduced in typer 0.9.0, which is the recommended
way to use the library: <https://typer.tiangolo.com/release-notes/#090>

That means that this argument:

  foo: str = typer.Argument("default value", "--foo", "-f")

Becomes this:

  foo = Annotated[
    str,
    typer.Argument("--foo","-f")
  ] = "default value"

The Annotated API was already being used in the CLI, but was silently
failing because we were using an older version of Typer that didn't
support it.

Second, the Google-style argument documentation in docstrings was taken
out, as those field descriptions are generated by typer automatically.

Finally, this commit also removes the typer-cli dependency, as it is
deprecated and its functionality is included in typer itself.
Instead of duplicating the exact function signature and then calling out
to the solr_cli functions, just register them using `app.command`
(without the function decorator syntax)
@ptgolden ptgolden requested a review from kevinschaper November 5, 2024 21:07
Copy link

netlify bot commented Nov 5, 2024

Deploy Preview for monarch-app ready!

Name Link
🔨 Latest commit 3c154ee
🔍 Latest deploy log https://app.netlify.com/sites/monarch-app/deploys/672a890c24069f0008e9906a
😎 Deploy Preview https://deploy-preview-885--monarch-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.30%. Comparing base (4425a2a) to head (3c154ee).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #885   +/-   ##
=======================================
  Coverage   71.30%   71.30%           
=======================================
  Files          91       91           
  Lines        3136     3136           
=======================================
  Hits         2236     2236           
  Misses        900      900           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kevinschaper
Copy link
Member

oops, sorry, I thought I had approved this already - thank you so much for the cleanup!

@kevinschaper kevinschaper merged commit 64b4d01 into main Nov 7, 2024
11 checks passed
@kevinschaper kevinschaper deleted the update-typer branch November 7, 2024 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants