Commit graph

277 commits

Author SHA1 Message Date
github-actions
27d0fdeb3f 📝 Update release notes 2023-05-01 10:04:11 +00:00
John Purviance
3e37e01979
Add support for custom types and parsers (updates/builds upon PR #443) (#583)
* Support custom parameter types

While most CLI parameters are strings, ints, etc, we sometimes need custom
types.

Currently typer has no support for it (See #77), and while there are a few hacks, the
likely solution is to add a 'str' argument and parse it inside the main function.

This PR adds support for custom types in 3 different ways:
- Manually specifying a `click_type`
- Manually specifying a `parse` function
- Using a Callable type annotation (It is very common for types to have a string constructor, like `int("1")`)

* Document how to parse custom objects with Typer.

Typer supports parsing of cutom types with:
- A user provided parser class
- A click custom type parser

* 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks

* 📝 Tweak and simplify docs

*  Tweak tests to run scripts and remove pragma: nocover in examples

* 📝 Tweak examples for docs, add types and remove # pragma: nocover

* ♻️ Tweak implementation checking for parser and Click type

---------

Co-authored-by: Paulo Costa <me@paulo.costa.nom.br>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2023-05-01 03:03:26 -07:00
github-actions
8dd7642d6e 📝 Update release notes 2023-04-25 23:30:29 +00:00
github-actions
50caff2757 📝 Update release notes 2023-02-21 11:05:36 +00:00
github-actions
b9515e88e3 📝 Update release notes 2023-02-03 17:52:27 +00:00
Sebastián Ramírez
6386bcd741
📝 Update docs about helping Typer (#547) 2023-02-03 18:51:55 +01:00
github-actions
1201e7f3b2 📝 Update release notes 2023-01-31 14:11:55 +00:00
github-actions
898ca8f663 📝 Update release notes 2023-01-30 10:35:54 +00:00
github-actions
4ba8226505 📝 Update release notes 2023-01-30 10:29:22 +00:00
github-actions
35c63685ca 📝 Update release notes 2022-12-16 23:10:44 +00:00
github-actions
fbd713a980 📝 Update release notes 2022-12-16 20:46:01 +00:00
github-actions
f6665d9f37 📝 Update release notes 2022-12-16 18:29:42 +00:00
github-actions
e3f746793f 📝 Update release notes 2022-11-14 21:52:28 +00:00
github-actions
e14cf38029 📝 Update release notes 2022-11-11 12:33:26 +00:00
github-actions
40cca5fa92 📝 Update release notes 2022-11-10 21:46:01 +00:00
Xuan (Sean) Hu
915f89b6f8
✏️ Fix typo in datetime docs (#495) 2022-11-10 22:45:09 +01:00
github-actions
95a0dbf532 📝 Update release notes 2022-11-10 10:28:41 +00:00
github-actions
6d1a87b89d 📝 Update release notes 2022-11-09 11:49:18 +00:00
github-actions
f294638786 📝 Update release notes 2022-11-09 11:47:34 +00:00
github-actions
d7c4d0dd0a 📝 Update release notes 2022-11-07 18:02:28 +00:00
github-actions
e001b15262 📝 Update release notes 2022-11-07 17:54:14 +00:00
github-actions
29bec40e89 📝 Update release notes 2022-11-06 15:12:34 +00:00
Oskar Skjærvø Gjølga
9f2d7ebe05
✏️ Add quotes to package name that includes brackets in docs (#475)
Adds quotes to package name with brackets

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-11-06 15:12:01 +00:00
Sebastián Ramírez
6c5698fc90 🔖 Release version 0.7.0 2022-11-05 20:37:40 +01:00
Sebastián Ramírez
aaf3cdd408 📝 Update release notes 2022-11-05 20:24:18 +01:00
github-actions
24d3c39316 📝 Update release notes 2022-11-05 19:23:51 +00:00
Sebastián Ramírez
5e46deb8f7 📝 Update release notes 2022-11-05 17:18:01 +01:00
github-actions
8999df2513 📝 Update release notes 2022-11-05 16:14:17 +00:00
Sebastián Ramírez
36e40806b7
Make typer.run() not add completion scripts by default, it only makes sense in installed apps (#488) 2022-11-05 16:13:37 +00:00
github-actions
bd7dd4cf1c 📝 Update release notes 2022-11-05 14:51:19 +00:00
github-actions
2b0aa7107a 📝 Update release notes 2022-11-05 14:43:19 +00:00
github-actions
ee2b763f9d 📝 Update release notes 2022-11-05 14:41:32 +00:00
github-actions
5a5db51917 📝 Update release notes 2022-11-05 14:39:43 +00:00
Taranjeet Singh
7c88b2d191
📝 Add note about how subcommands with function names using underscores are converted to dashes (#403)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-11-05 15:39:04 +01:00
github-actions
4b930b245a 📝 Update release notes 2022-11-05 14:35:10 +00:00
Fernando Pérez-García
7345567538
📝 Fix typo in docs at docs/tutorial/commands/help.md (#466)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-11-05 14:33:39 +00:00
github-actions
84579a11a2 📝 Update release notes 2022-11-05 14:32:46 +00:00
Jakub Jakubec
523a6501bf
✏ Fix link in docs to datetime.strptime() (#464)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-11-05 14:32:02 +00:00
github-actions
e1915ae897 📝 Update release notes 2022-11-05 14:26:11 +00:00
github-actions
8a1ecac2c0 📝 Update release notes 2022-11-05 01:02:46 +00:00
github-actions
107e9b4369 📝 Update release notes 2022-11-05 00:13:46 +00:00
github-actions
8848e06be8 📝 Update release notes 2022-11-05 00:13:18 +00:00
github-actions
fa02c88621 📝 Update release notes 2022-11-05 00:11:48 +00:00
github-actions
c503465a53 📝 Update release notes 2022-11-05 00:10:43 +00:00
github-actions
bf578b134a 📝 Update release notes 2022-11-05 00:10:21 +00:00
github-actions
7bac39fd93 📝 Update release notes 2022-11-04 23:09:07 +00:00
Sebastián Ramírez
b988f6fe67
👷 Move from pytest-cov to coverage and Codecov to Smokeshow (#483) 2022-11-05 00:08:30 +01:00
github-actions
1e43c6bb0d 📝 Update release notes 2022-11-04 21:43:51 +00:00
github-actions
a6d7d8381e 📝 Update release notes 2022-11-04 19:59:37 +00:00
github-actions
83bf2fc99d 📝 Update release notes 2022-07-17 08:42:24 +00:00