* ✨ Add support for PEP-593 `Annotated` for specifying options and arguments
Implements #184
* Revert things I did to get a 3.6 virtualenv 😅
A lot of the dev dependency packages weren't installable on 3.6, so I
had to remove them from the pyproject.toml.
This commit adds them back
* Fix mypy/lint errors
* Skip coverage on test lines that shouldn't execute
* Missed a spot
* ♻️ Tweak examples and tests with Annotated, add extra examples and tests
* 🔥 Remove Pydantic-specific logic from _typing.py
* 📝 Update docs to use new Annotated examples
* 📝 Add docs introducing Annotated and previous versions
* 🔧 Add commented out MkDocs config for highlighting docs examples
* ✅ Fix tests for Click 7
---------
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
* 📝 Tweak name for Custom Types
* ✏️ Fix broken internal links in CLI Option autocompletion
* 📝 Update main page docs, remove colors as that renders badly in README
* 📝 Update README, sync with index.md, remove colors for GitHub and PyPI
* 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>