* 📝 Add source examples for custom parameter types with Annotated
* ✅ Add tests for custom parameters with Annotated
* 📝 Update docs for custom parameters with Annotated
* ♻️ Fix overloads default in Argument after Annotated
* ✅ Fix test for custom param types
* ✨ 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>
* 🚚 Move docs src files to root docs_src
* 🚚 Update example includes from root docs_src
* 🚚 Import docs src examples for tests from docs_src
* ⬆️ Upgrade isort and configs
* 🎨 Update format in testing
* 🔧 Update configs with root docs_src
* 🔥 Remove obsolete/unecessary section in contributing guide
* 🎨 Re-format multi-file example
* ⏪ Revert format for multi-file examples
* 🔧 Add isort skips for multi-file examples
* ✨ Implement custom TyperCommand and TyperArgument
to support help in CLI Arguments
* ✨ Update data models to store help for CLI Arguments
* ✨ Add help to typer.Argument()
* ✨ Use new TyperCommand and TyperArgument classes by default
to support CLI Arguments with help
* ✅ Update failing test
* ✨ Make showing default values default to true and support arguments hidden from help text
* ✨ Add docs for CLI arguments with defaults, help, and new features
* 📝 Update CLI options with new show_default=True by default
* 📝 Add example of CLI arguments with tuples
* 📝 Update docs with new generated help text for CLI arguments
* 📝 Use Optional for None example in micro-intro to types
* ✅ Add tests for new CLI argument features from docs examples
* ✅ Update tests with new generated help text for CLI arguments
* ✅ Add tests for CLI arguments with tuple defaults
* 🔧 Update MkDocs with new sections
* ✨ make show_envvar default to True
* ✨ Add docs for envvar in CLI arguments
* ✅ Add tests for CLI arguments with env vars from docs
* 🎨 Add format to CLI usage examples in docs
* 🔧 Add section about CLI arguments with env vars to MkDocs
* 📝 Fix link in docs with new structure
* 🎨 Fix format in first-steps
* ✨ Implement custom handling for callbacks with types
* ✨ Implement type-based handling for completion functions
* ✨ Add examples for custom completion
* 📝 Add docs for custom autocompletion
* ✅ Add tests for autocompletion
* ✨ Document using the context
* ✅ Add tests for using the context
* ✅ Add tests init for context
* 🔧 Update Mypy config
* ✅ Add extra tests for completion
* ✏️ Fix format, typos, and minor texts
* ✨ Update docs for printing, include stdout, stderr, and stdin
* ✏️ Add references to FastAPI, fix typos
* ✏️ Fix typo in Typer CLI
* 📝 Update docs for version
* 📝 Update docs for callbacks
* 📝 Update references to stdout/stderr in autocompletion
* 📝 Add docs for password in CLI option
* 📝 Add docs and tests for Testing
* 📝 Add new sections to docs
* 🎨 Fix formatting
* ✨ Add docs for Typer CLI
* 📝 Update references to Typer CLI in docs
* 🔧 Update tests to check files and linting before tests, to error out early
* 📝 Sync README.md with docs/index.md
* ⬆️ Upgrade required Click to 7.1.1 and pin it to patch versions
as a MINOR version broke compatibility, so I'll have to upgrade manually every time
* 📌 Fix pinning Click to MINOR version
* ✨ Upgrade code to be compatible with latest Click changes
* ✅ Update tests with new format for errors
* 📝 Update docs to keep them in sync with actual output