Commit graph

50 commits

Author SHA1 Message Date
Matthias Bach
416c612fb2
👷‍♂️ Consistently use sys.executable to run subprocesses, needed by OpenSUSE (#408)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-11-07 19:01:54 +01:00
Matthias Bach
52f488d1b0
👷‍♂️ Ensure the PYTHONPATH is set properly when testing the tutorial scripts (#407) 2022-11-07 18:53:34 +01:00
Sebastián Ramírez
c1ddf1d452
Add extra tests just for coverage because monkeypatching with strange imports confuses coverage (#490) 2022-11-05 19:23:18 +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
Sebastián Ramírez
c750f8206e
Refactor and document handling pretty exceptions (#422)
* ♻️ Rename pretty_errors_ to pretty_exceptions_ to avoid confusion with validation errors

*  Add source examples for pretty_exceptions

* 📝 Add docs for pretty exceptions

* 🔧 Add Exceptions docs to MkDocs

*  Add tests for tutorial about exceptions

*  Update trackeback tests, remove tests covered by tutorial

*  Fix test for module
2022-07-12 21:06:51 +02:00
Sebastián Ramírez
6208b5b208
Richify, add integrations with Rich everywhere (#419) 2022-07-12 16:45:43 +00:00
Sebastián Ramírez
95a5233d9e
Allow configuring pretty errors when creating the Typer instance (#416) 2022-07-08 15:20:32 +00:00
Sebastián Ramírez
252ed30936
Add pretty error tracebacks for user errors and support for Rich (#412) 2022-07-06 13:32:19 +02:00
Irvin Ho
722a4febf5
🐛 Fix type conversion for List and Tuple and their internal types (#143)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-07-02 19:26:03 +02:00
Leron Gray
778d5bdb61
🐛 Fix context_settings for a Typer app with a single command (#210)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-07-02 18:36:55 +02:00
Sebastián Ramírez
9910f38374
🐛 Fix import of get_terminal_size for click 8.1.0 support and upgrade Black for CI (#380)
Co-authored-by: Michael Adkins <michael@prefect.io>
2022-03-30 14:11:34 -05:00
Sebastián Ramírez
b97298181b
Add support for Click 8 while keeping compatibility with Click 7 (#317) 2021-08-30 09:57:12 +02:00
Sebastián Ramírez
6da736487d
Report coverage in XML (#146)
*  Report XML Coverate to support GitHub Actions

* 🙈 Add coverage report to .gitignore

*  Add custom testing .zshrc logic for coverage
2020-07-19 14:37:50 +02:00
Sebastián Ramírez
89ddc35372
⬆ Upgrade Isort to version 5.x.x (#137)
* 🚚 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
2020-07-09 22:09:53 +02:00
Sebastián Ramírez
15380ddc07
Add support for help for CLI arguments (#123)
*  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
2020-06-24 21:05:21 +02:00
Teymour Aldridge
4ed37fe043
Support __main__.py, passing prog_name to callable (#120)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-23 13:29:45 +02:00
Sebastián Ramírez
a93e6b2f86
Add support for forward references (#93)
*  Add support for forward references

*  Add forward references test

* 🐛 Fix coverage in completion

* 🐛 Fix testing with Pytest and Pytest-sugar

* 📌 Pin Pytest
2020-04-26 15:42:13 +02:00
Sebastián Ramírez
cf95aa3f48
Make installed completion lazy load (#92)
*  Re-implement completion install to lazy load

to support completion for programs under environments

*  Update tests for new lazy loaded completion

*  Update test after removing period from message
2020-04-26 12:16:38 +02:00
Sebastián Ramírez
646c737329
🐛 Do not show an error on completion eval if the program is not installed (#83)
* 🐛 Fix Fish completion script

* 🐛 Do not show an error on completion eval if the program is not installed

*  Add stderr redirect to /dev/null for Fish too

*  Update completion tests
2020-03-29 15:39:49 +02:00
Sebastián Ramírez
d90344dab0
🐛 Fix Bash completion install to .bashrc (#81)
* 🐛 Fix Bash completion setup to .bashrc

* 📝 Update docs and script for Windows development environment
2020-03-29 14:26:54 +02:00
Sebastián Ramírez
a89fc4ebb7
white_check_mark: Add coverage instructions to tests (#72)
*  Add coverage instructions to tests

* 📝 Update docs note about coverage in features

* 🎨 Fix format

* 🎨 Update testing docs format
2020-03-19 14:44:43 +01:00
Sebastián Ramírez
48698ff2ad
📝 Add docs for using Click with Typer (#70)
* 📝 Add docs for using Click with Typer

*  Add tests for integrating Click and Typer
2020-03-19 10:30:42 +01:00
Sebastián Ramírez
c304d80dea
🐛 Fix Zsh completion install (#69) 2020-03-18 21:28:34 +01:00
Sebastián Ramírez
5a6379ffc6
Add docs for testing, password, version, context. Extra tests, include callback and autocompletion PR (#68)
*  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
2020-03-18 21:17:47 +01:00
Sebastián Ramírez
1d3337a4da
Re-implement completion, fixes, add PowerShell support (#66)
*  Re-implement completion

*  Add tests for re-implemented completion

* 🎨 Move mypy config to file

* 🙈 Update .gitignore

*  Remove click-completion, add support for autodetection with shellingham

*  Fix test for PowerShell

* 🐛 Fix PowerShell permissions/test

* 🎨 Format test

* 🏁 Fix PowerShell script for Windows and PowerShell 5

* 📝 Update docs, internal implementation of completion
2020-03-16 13:21:58 +01:00
Sebastián Ramírez
96b29e9639
Add support for Click 7.1.1 (#60)
* ⬆️ 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
2020-03-10 18:49:29 +01:00
Sebastián Ramírez
222765eacf Fix tests using binary config files 2020-01-18 19:50:57 +01:00
Sebastián Ramírez
3efee0a551 Add 4 extra tests for edge cases 2020-01-05 22:20:54 +01:00
Sebastián Ramírez
724c4bc8b6 Add tests for examples with multiple values 2020-01-05 22:10:54 +01:00
Sebastián Ramírez
be75c9c3a3 Add tests for extra param types, bool, number 2020-01-05 21:53:57 +01:00
Sebastián Ramírez
d0ee82ba82 Add tests for commands: callbacks 2020-01-05 21:38:57 +01:00
Sebastián Ramírez
44319119e9 Add tests for subcommands examples 2020-01-05 20:49:29 +01:00
Sebastián Ramírez
f3c97dc283 Add tests for subcommands 2020-01-04 02:39:55 +01:00
Sebastián Ramírez
e9afd24958 🐛 Fix overwritten test function 2020-01-02 18:17:43 +01:00
Sebastián Ramírez
7673cab540 Add tests for prompts 2020-01-02 16:59:26 +01:00
Sebastián Ramírez
ff8a1e4c27 📝 Update path docs 2020-01-02 16:28:35 +01:00
Sebastián Ramírez
9abba68f0b Add tests for printing and terminating 2020-01-02 15:22:39 +01:00
Sebastián Ramírez
d8a5236c08 ♻️ Refactor docs structure and add CLI option names 2020-01-02 12:49:28 +01:00
Sebastián Ramírez
73f047ad39 Add tests for CLI parameter types 2019-12-31 22:16:44 +01:00
Sebastián Ramírez
f9d7f69d7e Update completion tests, checking for printed message 2019-12-31 11:25:48 +01:00
Sebastián Ramírez
cde63b0760 🐛 Fix test completion, check for bash completion file before running 2019-12-31 11:19:07 +01:00
Sebastián Ramírez
7b369b79f2 Add tests for completion 2019-12-31 11:13:38 +01:00
Sebastián Ramírez
6e7d6df51c Add tests for Commands 2019-12-30 14:25:13 +01:00
Sebastián Ramírez
3332ab3cae Add tests for CLI arguments 2019-12-29 17:09:56 +01:00
Sebastián Ramírez
8596200b7c Add tests for examples in CLI Options 2019-12-29 10:24:31 +01:00
Sebastián Ramírez
f00e10083c Fix test coverage handling 2019-12-28 14:44:08 +01:00
Sebastián Ramírez
e02475a784 Add tests for tutorial006 in First Steps, to test help from docstring 2019-12-28 14:25:32 +01:00
Sebastián Ramírez
45f995c6aa Add tests for the first steps 2019-12-28 13:57:56 +01:00
Sebastián Ramírez
b52fc16bba 🎨 Fix types and format 2019-12-24 17:16:58 +01:00
Sebastián Ramírez
a3d337f98b Add first test, scaffold testing 2019-12-24 15:35:53 +01:00