Merge branch '7.x'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parents 466d0ad, 3d1dcc2 · Browse files · 21 files·+290 added−199 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
21 files+290 added−199 removed
- tests:+49 added−1 removed
- other:+241 added−198 removed
Provenance
- Commit
8f36eab- Tree
1847755- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent 1
466d0ad- Parent 2
3d1dcc2
21 files changed+290 added−199 removed
modified:click/__init__.py-6 removed
1 # -*- coding: utf-8 -*-2 """3-click4-~~~~~5-3 Click is a simple Python module inspired by the stdlib optparse to make4 writing command line scripts fun. Unlike other modules, it's based5 around a simple API that does not come with too much magic and is6 composable.10-11-:copyright: © 2014 by the Pallets team.12-:license: BSD, see LICENSE.rst for more details.7 """8 9 # Core classes10 from .core import Context, BaseCommand, Command, MultiCommand, Group, \81 unmodified linesmodified:click/_bashcomplete.py+46 added-9 removed
59 unmodified lines60 fi61 done62 63 if [ -n "$completions_with_descriptions" ]; then64- _describe -V unsorted completions_with_descriptions -U -Q64+ _describe -V unsorted completions_with_descriptions -U65 fi66 67 if [ -n "$completions" ]; then68- compadd -U -V unsorted -Q -a completions68+ compadd -U -V unsorted -a completions69 fi70 compstate[insert]="automenu"71 }72 73 compdef %(complete_func)s %(script_names)s74 '''75 76+COMPLETION_SCRIPT_FISH = '''77+complete --no-files --command %(script_names)s --arguments "(env %(autocomplete_var)s=complete_fish COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) %(script_names)s)"78+'''79+80+_completion_scripts = {81+ "bash": COMPLETION_SCRIPT_BASH,82+ "zsh": COMPLETION_SCRIPT_ZSH,83+ "fish": COMPLETION_SCRIPT_FISH,84+}85+86 _invalid_ident_char_re = re.compile(r'[^a-zA-Z0-9_]')87 88 89 def get_completion_script(prog_name, complete_var, shell):90 cf_name = _invalid_ident_char_re.sub('', prog_name.replace('-', '_'))81- script = COMPLETION_SCRIPT_ZSH if shell == 'zsh' else COMPLETION_SCRIPT_BASH91+ script = _completion_scripts.get(shell, COMPLETION_SCRIPT_BASH)92 return (script % {93 'complete_func': '_%s_completion' % cf_name,94 'script_names': prog_name,95 'autocomplete_var': complete_var,150 unmodified lines246 ctx = resolve_ctx(cli, prog_name, args)247 if ctx is None:248 return []249 250+ has_double_dash = "--" in all_args251+252 # In newer versions of bash long opts with '='s are partitioned, but it's easier to parse253 # without the '='254 if start_of_option(incomplete) and WORDBREAK in incomplete:255 partition_incomplete = incomplete.partition(WORDBREAK)2 unmodified lines258 elif incomplete == WORDBREAK:259 incomplete = ''260 261 completions = []250- if start_of_option(incomplete):262+ if not has_double_dash and start_of_option(incomplete):263 # completions for partial options264 for param in ctx.command.params:265 if isinstance(param, Option) and not param.hidden:266 param_opts = [param_opt for param_opt in param.opts +25 unmodified lines292 293 for item in get_choices(cli, prog_name, args, incomplete):294 echo(item[0])295 if include_descriptions:284- # ZSH has trouble dealing with empty array parameters when returned from commands, so use a well defined character '_' to indicate no description is present.296+ # ZSH has trouble dealing with empty array parameters when297+ # returned from commands, use '_' to indicate no description298+ # is present.299 echo(item[1] if item[1] else '_')300 301 return True302 303 304+def do_complete_fish(cli, prog_name):305+ cwords = split_arg_string(os.environ["COMP_WORDS"])306+ incomplete = os.environ["COMP_CWORD"]307+ args = cwords[1:]308+309+ for item in get_choices(cli, prog_name, args, incomplete):310+ if item[1]:311+ echo("%(arg)s\t%(desc)s" % {"arg": item[0], "desc": item[1]})312+ else:313+ echo(item[0])314+315+ return True316+317+318 def bashcomplete(cli, prog_name, complete_var, complete_instr):291- if complete_instr.startswith('source'):292- shell = 'zsh' if complete_instr == 'source_zsh' else 'bash'319+ if "_" in complete_instr:320+ command, shell = complete_instr.split("_", 1)321+ else:322+ command = complete_instr323+ shell = "bash"324+325+ if command == "source":326 echo(get_completion_script(prog_name, complete_var, shell))327 return True295- elif complete_instr == 'complete' or complete_instr == 'complete_zsh':296- return do_complete(cli, prog_name, complete_instr == 'complete_zsh')328+ elif command == "complete":329+ if shell == "fish":330+ return do_complete_fish(cli, prog_name)331+ elif shell in {"bash", "zsh"}:332+ return do_complete(cli, prog_name, shell == "zsh")333+334 return Falsemodified:click/_termui_impl.py-6 removed
1 # -*- coding: utf-8 -*-2 """3-click._termui_impl4-~~~~~~~~~~~~~~~~~~5-3 This module contains implementations for the termui module. To keep the4 import time of Click down, some infrequently used functionality is5 placed in this module and only imported as needed.9-10-:copyright: © 2014 by the Pallets team.11-:license: BSD, see LICENSE.rst for more details.6 """7 8 import os9 import sys642 unmodified linesmodified:click/core.py+6 added
679 unmodified lines680 context_settings = {}681 #: an optional dictionary with defaults passed to the context.682 self.context_settings = context_settings683 684+ def __repr__(self):685+ return "<%s %s>" % (self.__class__.__name__, self.name)686+687 def get_usage(self, ctx):688 raise NotImplementedError('Base commands cannot get usage')689 690 def get_help(self, ctx):769 unmodified lines1460 self.metavar = metavar1461 self.envvar = envvar1462 self.autocompletion = autocompletion1463 1464+ def __repr__(self):1465+ return "<%s %s>" % (self.__class__.__name__, self.name)1466+1467 @property1468 def human_readable_name(self):1469 """Returns the human readable name of this parameter. This is the1470 same as the name for options, but the metavar for arguments.503 unmodified linesmodified:click/parser.py+6 added-3 removed
1 # -*- coding: utf-8 -*-2 """3-click.parser4-~~~~~~~~~~~~5-3 This module started out as largely a copy paste from the stdlib's4 optparse module with the features removed that we do not need from5 optparse because we implement them in Click on a higher level (for6 instance type handling, help formatting and a lot more).3 unmodified lines10 The reason this is a different module and not optparse from the stdlib11 is that there are differences in 2.x and 3.x about the error messages12 generated and optparse in the stdlib uses gettext for no good reason13 and might cause us issues.14+15+Click uses parts of optparse written by Gregory P. Ward and maintained16+by the Python Software Foundation. This is limited to code in parser.py.17+18+Copyright 2001-2006 Gregory P. Ward. All rights reserved.19+Copyright 2002-2006 Python Software Foundation. All rights reserved.20 """21 22 # This code uses parts of optparse written by Gregory P. Ward and23 # maintained by the Python Software Foundation.412 unmodified linesmodified:click/types.py+2 added
117 unmodified lines118 try:119 value = value.decode(fs_enc)120 except UnicodeError:121 value = value.decode('utf-8', 'replace')122+ else:123+ value = value.decode('utf-8', 'replace')124 return value125 return value126 127 def __repr__(self):552 unmodified linesmodified:docs/bashcomplete.rst+92 added-60 removed
1-Bash Complete2-=============1+Shell Completion2+================3 4 .. versionadded:: 2.05 6-As of Click 2.0, there is built-in support for Bash completion for7-any Click script. There are certain restrictions on when this completion8-is available, but for the most part it should just work.6+Click can provide tab completion for commands, options, and choice7+values. Bash, Zsh, and Fish are supported8 10-Limitations11------------9+Completion is only available if a script is installed and invoked10+through an entry point, not through the ``python`` command. See11+:ref:`setuptools-integration`.12 13-Bash completion is only available if a script has been installed properly,14-and not executed through the ``python`` command. For information about15-how to do that, see :ref:`setuptools-integration`. Click currently16-only supports completion for Bash and Zsh.13 14 What it Completes15 -----------------16 21-Generally, the Bash completion support will complete subcommands,17+Generally, the shell completion support will complete commands,18 options, and any option or argument values where the type is23-:class:`click.Choice`. Subcommands and choices are always listed whereas24-options are only listed if at least a dash has been provided. ::19+:class:`click.Choice`. Options are only listed if at least a dash has20+been entered.21 22+.. code-block:: text23+24 $ repo <TAB><TAB>25 clone commit copy delete setuser26 $ repo clone -<TAB><TAB>27 --deep --help --rev --shallow -r28 31-Additionally, custom suggestions can be provided for arguments and options with32-the ``autocompletion`` parameter. ``autocompletion`` should be a callback function33-that returns a list of strings. This is useful when the suggestions need to be34-dynamically generated at bash completion time. The callback function will be35-passed 3 keyword arguments:29+Custom completions can be provided for argument and option values by30+providing an ``autocompletion`` function that returns a list of strings.31+This is useful when the suggestions need to be dynamically generated32+completion time. The callback function will be passed 3 keyword33+arguments:34 37-- ``ctx`` - The current click context.38-- ``args`` - The list of arguments passed in.39-- ``incomplete`` - The partial word that is being completed, as a string. May40- be an empty string ``''`` if no characters have been entered yet.35+- ``ctx`` - The current command context.36+- ``args`` - The list of arguments passed in.37+- ``incomplete`` - The partial word that is being completed. May38+ be an empty string if no characters have been entered yet.39 42-Here is an example of using a callback function to generate dynamic suggestions:40+Here is an example of using a callback function to generate dynamic41+suggestions:42 44-.. click:example::43+.. code-block:: python44 45 import os46 47 def get_env_vars(ctx, args, incomplete):5 unmodified lines53 click.echo('Environment variable: %s' % envvar)54 click.echo('Value: %s' % os.environ[envvar])55 56 58-Completion help strings (ZSH only)59-----------------------------------57+Completion help strings58+-----------------------59 61-ZSH supports showing documentation strings for completions. These are taken62-from the help parameters of options and subcommands. For dynamically generated63-completions a help string can be provided by returning a tuple instead of a64-string. The first element of the tuple is the completion and the second is the65-help string to display.60+ZSH and fish support showing documentation strings for completions.61+These are taken from the help parameters of options and subcommands. For62+dynamically generated completions a help string can be provided by63+returning a tuple instead of a string. The first element of the tuple is64+the completion and the second is the help string to display.65 67-Here is an example of using a callback function to generate dynamic suggestions with help strings:66+Here is an example of using a callback function to generate dynamic67+suggestions with help strings:68 69-.. click:example::69+.. code-block:: python70 71 import os72 73 def get_colors(ctx, args, incomplete):74- colors = [('red', 'help string for the color red'),75- ('blue', 'help string for the color blue'),76- ('green', 'help string for the color green')]74+ colors = [('red', 'a warm color'),75+ ('blue', 'a cool color'),76+ ('green', 'the other starter color')]77 return [c for c in colors if incomplete in c[0]]78 79 @click.command()80 @click.argument("color", type=click.STRING, autocompletion=get_colors)3 unmodified lines84 85 Activation86 ----------87 88-In order to activate Bash completion, you need to inform Bash that89-completion is available for your script, and how. Any Click application90-automatically provides support for that. The general way this works is91-through a magic environment variable called ``_<PROG_NAME>_COMPLETE``,92-where ``<PROG_NAME>`` is your application executable name in uppercase93-with dashes replaced by underscores.88+In order to activate shell completion, you need to inform your shell89+that completion is available for your script. Any Click application90+automatically provides support for that. If the program is executed with91+a special ``_<PROG_NAME>_COMPLETE`` variable, the completion mechanism92+is triggered instead of the normal command. ``<PROG_NAME>`` is the93+executable name in uppercase with dashes replaced by underscores.94 95-If your tool is called ``foo-bar``, then the magic variable is called96-``_FOO_BAR_COMPLETE``. By exporting it with the ``source`` value it will97-spit out the activation script which can be trivially activated.95+If your tool is called ``foo-bar``, then the variable is called96+``_FOO_BAR_COMPLETE``. By exporting it with the ``source_{shell}``97+value it will output the activation script to evaluate.98 99-For instance, to enable Bash completion for your ``foo-bar`` script, this100-is what you would need to put into your ``.bashrc``::99+Here are examples for a ``foo-bar`` script.100 102- eval "$(_FOO_BAR_COMPLETE=source foo-bar)"101+For Bash, add this to ``~/.bashrc``:102 104-For zsh users add this to your ``.zshrc``::103+.. code-block:: text104 105+ eval "$(_FOO_BAR_COMPLETE=source_bash foo-bar)"106+107+For Zsh, add this to ``~/.zshrc``:108+109+.. code-block:: text110+111 eval "$(_FOO_BAR_COMPLETE=source_zsh foo-bar)"112 108-From this point onwards, your script will have autocompletion enabled.113+For Fish, add this to ``~/.config/fish/completions/foo-bar.fish``:114 115+.. code-block:: text116+117+ eval (env _FOO_BAR_COMPLETE=source_fish foo-bar)118+119+Open a new shell to enable completion. Or run the ``eval`` command120+directly in your current shell to enable it temporarily.121+122+123 Activation Script124 -----------------125 113-The above activation example will always invoke your application on114-startup. This might be slowing down the shell activation time115-significantly if you have many applications. Alternatively, you could also116-ship a file with the contents of that, which is what Git and other systems117-are doing.126+The above ``eval`` examples will invoke your application every time a127+shell is started. This may slow down shell startup time significantly.128 119-This can be easily accomplished::129+Alternatively, export the generated completion code as a static script130+to be executed. You can ship this file with your builds; tools like Git131+do this. At least Zsh will also cache the results of completion files,132+but not ``eval`` scripts.133 121- _FOO_BAR_COMPLETE=source foo-bar > foo-bar-complete.sh134+For Bash:135 123-For zsh:136+.. code-block:: text137 138+ _FOO_BAR_COMPLETE=source_bash foo-bar > foo-bar-complete.sh139+140+For Zsh:141+142+.. code-block:: text143+144 _FOO_BAR_COMPLETE=source_zsh foo-bar > foo-bar-complete.sh145 127-And then you would put this into your .bashrc or .zshrc instead::146+For Fish:147 148+.. code-block:: text149+150+ _FOO_BAR_COMPLETE=source_zsh foo-bar > foo-bar-complete.sh151+152+In ``.bashrc`` or ``.zshrc``, source the script instead of the ``eval``153+command:154+155+.. code-block:: text156+157 . /path/to/foo-bar-complete.sh158 159+For Fish, add the file to the completions directory:160 161+.. code-block:: text162+163+ _FOO_BAR_COMPLETE=source_fish foo-bar > ~/.config/fish/completions/foo-bar-complete.fishmodified:docs/changelog.rst+2 added-2 removed
1-Changelog2-=========1+Changes2+=======3 4 .. include:: ../CHANGES.rstmodified:docs/license.rst+2 added-12 removed
1-License2-=======1+BSD-3-Clause License2+====================3 4-Click is licensed under a three-clause BSD License. It basically means:5-do whatever you want with it as long as the copyright in Click sticks6-around, the conditions are not modified and the disclaimer is present.7-Furthermore, you must not use the names of the authors to promote derivatives8-of the software without written consent.9-10-License Text11-------------12-4 .. include:: ../LICENSE.rst14-modified:docs/options.rst+26 added-6 removed
11 unmodified lines12 13 Name Your Options14 -----------------15 16-The naming rules can be found in :ref:`parameter_names`. In short, you17-can refer the option **implicitly** by the longest dash-prefixed argument:16+Options have a name that will be used as the Python argument name when17+calling the decorated function. This can be inferred from the option18+names or given explicitly. Names are given as position arguments to the19+decorator.20 19-.. click:example::21+A name is chosen in the following order22 23+1. If a name is not prefixed, it is used as the Python argument name24+ and not treated as an option name on the command line.25+2. If there is at least one name prefixed with two dashes, the first26+ one given is used as the name.27+3. The first name prefixed with one dash is used otherwise.28+29+To get the Python argument name, the chosen name is converted to lower30+case, up to two dashes are removed as the prefix, and other dashes are31+converted to underscores.32+33+.. code-block:: python34+35 @click.command()36 @click.option('-s', '--string-to-echo')37 def echo(string_to_echo):38 click.echo(string_to_echo)39 26-Or, **explicitly**, by giving one non-dash-prefixed argument:40+.. code-block:: python41 28-.. click:example::29-42 @click.command()43 @click.option('-s', '--string-to-echo', 'string')44 def echo(string):45 click.echo(string)46 47+- ``"-f", "--foo-bar"``, the name is ``foo_bar``48+- ``"-x"``, the name is ``x``49+- ``"-f", "--filename", "dest"``, the name is ``dest``50+- ``"--CamelCase"``, the name is ``camelcase``51+- ``"-f", "-fb"``, the name is ``f``52+- ``"--f", "--foo-bar"``, the name is ``f``53+- ``"---f"``, the name is ``_f``54+55 Basic Value Options56 -------------------57 58 The most basic option is a value option. These options accept one790 unmodified linesmodified:docs/parameters.rst+12 added-20 removed
81 unmodified lines82 83 Parameter Names84 ---------------85 86-Parameters (both options and arguments) accept a number of positional arguments87-which are passed to the command function as parameters. Each string with a88-single dash is added as a short argument; each string starting with a double89-dash as a long one.86+Parameters (both options and arguments) have a name that will be used as87+the Python argument name when calling the decorated function with88+values.89 91-If a string is added without any dashes, it becomes the internal parameter name92-which is also used as variable name.90+Arguments take only one positional name. To provide a different name for91+use in help text, see :ref:`doc-meta-variables`.92 94-If all names for a parameter contain dashes, the internal name is generated95-automatically by taking the longest argument and converting all dashes to96-underscores.93+Options can have many names that may be prefixed with one or two dashes.94+Names with one dash are parsed as short options, names with two are95+parsed as long options. If a name is not prefixed, it is used as the96+Python argument name and not parsed as an option name. Otherwise, the97+first name with a two dash prefix is used, or the first with a one dash98+prefix if there are none with two. The prefix is removed and dashes are99+converted to underscores to get the Python argument name.100 98-The internal name is converted to lowercase.101 100-Examples:101-102-* For an option with ``('-f', '--foo-bar')``, the parameter name is `foo_bar`.103-* For an option with ``('-x',)``, the parameter is `x`.104-* For an option with ``('-f', '--filename', 'dest')``, the parameter name is `dest`.105-* For an option with ``('--CamelCaseOption',)``, the parameter is `camelcaseoption`.106-* For an arguments with ``(`foogle`)``, the parameter name is `foogle`. To107- provide a different human readable name for use in help text, see the section108- about :ref:`doc-meta-variables`.109-102 Implementing Custom Types103 -------------------------104 105 To implement a custom type, you need to subclass the :class:`ParamType`37 unmodified linesmodified:tests/test_arguments.py+22 added-1 removed
1 # -*- coding: utf-8 -*-2 import pytest3 import click4+import sys4-from click._compat import PY25+from click._compat import PY2, text_type6 7 8 def test_nargs_star(runner):9 @click.command()74 unmodified lines84 assert result.exit_code == 285 assert 'Got unexpected extra argument (bar)' in result.output86 87 88+def test_bytes_args(runner, monkeypatch):89+ @click.command()90+ @click.argument('arg')91+ def from_bytes(arg):92+ assert isinstance(arg, text_type), "UTF-8 encoded argument should be implicitly converted to Unicode"93+94+ # Simulate empty locale environment variables95+ if PY2:96+ monkeypatch.setattr(sys.stdin, 'encoding', 'ANSI_X3.4-1968')97+ monkeypatch.setattr(sys, 'getfilesystemencoding', lambda: 'ANSI_X3.4-1968')98+ monkeypatch.setattr(sys, 'getdefaultencoding', lambda: 'ascii')99+ else:100+ monkeypatch.setattr(sys.stdin, 'encoding', 'utf-8')101+ monkeypatch.setattr(sys, 'getfilesystemencoding', lambda: 'utf-8')102+ monkeypatch.setattr(sys, 'getdefaultencoding', lambda: 'utf-8')103+104+ runner.invoke(from_bytes, [u'Something outside of ASCII range: 林'.encode('UTF-8')],105+ catch_exceptions=False)106+107+108 def test_file_args(runner):109 @click.command()110 @click.argument('input', type=click.File('rb'))111 @click.argument('output', type=click.File('wb'))217 unmodified linesmodified:tests/test_bashcomplete.py+27 added
1 # -*- coding: utf-8 -*-2 3+import pytest4+5 import click6 from click._bashcomplete import get_choices7 8 399 unmodified lines408 assert choices_without_help(cli, [], 'h') == []409 # If the user exactly types out the hidden command, complete its subcommands.410 assert choices_without_help(cli, ['hgroup'], '') == ['hgroupsub']411 assert choices_without_help(cli, ['hsub'], '--h') == ['--hname']412+413+414+@pytest.mark.parametrize(415+ ("args", "part", "expect"),416+ [417+ ([], "-", ["--opt"]),418+ (["value"], "--", ["--opt"]),419+ ([], "-o", []),420+ (["--opt"], "-o", []),421+ (["--"], "", ["name", "-o", "--opt", "--"]),422+ (["--"], "--o", ["--opt"]),423+ ],424+)425+def test_args_with_double_dash_complete(args, part, expect):426+ def _complete(ctx, args, incomplete):427+ values = ["name", "-o", "--opt", "--"]428+ return [x for x in values if x.startswith(incomplete)]429+430+ @click.command()431+ @click.option("--opt")432+ @click.argument("args", nargs=-1, autocompletion=_complete)433+ def cli(opt, args):434+ pass435+436+ assert choices_without_help(cli, args, part) == expectmodified:.azure-pipelines.yml+12 added-12 removed
1 trigger:2 - master3- - "*.x"3+ - '*.x'4 5 variables:6 vmImage: ubuntu-latest7- python.version: "3.7"8- TOXENV: py,coverage-ci9- hasTestResults: true7+ python.version: '3.8'8+ TOXENV: py9 10 strategy:11 matrix:13- Python 3.7 Linux:12+ Python 3.8 Linux:13 vmImage: ubuntu-latest15- Python 3.7 Windows:14+ Python 3.8 Windows:15 vmImage: windows-latest17- Python 3.7 Mac:16+ Python 3.8 Mac:17 vmImage: macos-latest18 PyPy 3 Linux:19 python.version: pypy320+ Python 3.7 Linux:21+ python.version: '3.7'22 Python 3.6 Linux:22- python.version: 3.623+ python.version: '3.6'24 Python 3.5 Linux:24- python.version: 3.525+ python.version: '3.5'26 Python 2.7 Linux:26- python.version: 2.727+ python.version: '2.7'28 Python 2.7 Windows:28- python.version: 2.729 vmImage: windows-latest30+ python.version: '2.7'31 Docs:32 TOXENV: docs32- hasTestResults: false33 34 pool:35 vmImage: $(vmImage)36 25 unmodified linesmodified:.gitignore+11 added-14 removed
1-*.pyc2-*.pyo1+/.idea/2+/.vscode/3+/env/4+/venv/5 __pycache__/4-.idea/5-.ropeproject6-.DS_Store7-env/8-venv/6+*.pyc7 *.egg-info/10-*.eggs/11-build/12-dist/13-docs/_build/14-.pytest_cache/15-.tox/8+/build/9+/dist/10+/.pytest_cache/11+/.tox/12 .coverage13 .coverage.*18-htmlcov/14+/htmlcov/15+/docs/_build/modified:CHANGES.rst+9 added
69 unmodified lines70 ``click.edit()``. :pr:`1469`71 - Arguments to system calls such as the executable path passed to72 ``click.edit`` can contains spaces. :pr:`1470`73 - Add ZSH completion autoloading and error handling. :issue:`1348`74+- Add a repr to ``Command``, ``Group``, ``Option``, and ``Argument``,75+ showing the name for friendlier debugging. :issue:`1267`76+- Completion doesn't consider option names if a value starts with77+ ``-`` after the ``--`` separator. :issue:`1247`78+- ZSH completion escapes special characters in values. :pr:`1418`79+- Add completion support for Fish shell. :pr:`1423`80+- Decoding bytes option values falls back to UTF-8 in more cases.81+ :pr:`1468`82 83+84 Version 7.085 -----------86 87 Released 2018-09-25539 unmodified linesmodified:MANIFEST.in+1 added-4 removed
1 include CHANGES.rst2-include CONTRIBUTING.rst3-include LICENSE.rst4-include README.rst2 include tox.ini3 graft artwork4 graft docs5 prune docs/_build6 graft examples7 graft tests11-global-exclude *.py[co] .DS_Store8+global-exclude *.pycmodified:README.rst+8 added-15 removed
22 unmodified lines23 Install and update using `pip`_:24 25 .. code-block:: text26 27- $ pip install click27+ $ pip install -U click28 29-Click supports Python 3.4 and newer, Python 2.7, and PyPy.30-29 .. _pip: https://pip.pypa.io/en/stable/quickstart/30 31 32 A Simple Example33 ----------------34 37-What does it look like? Here is an example of a simple Click program:38-35 .. code-block:: python36 37 import click38 8 unmodified lines47 48 if __name__ == '__main__':49 hello()50 55-And what it looks like when run:56-51 .. code-block:: text52 53 $ python hello.py --count=354 Your name: Click15 unmodified lines70 71 Links72 -----73 80-* Website: https://palletsprojects.com/p/click/81-* Documentation: https://click.palletsprojects.com/82-* License: `BSD <https://github.com/pallets/click/blob/master/LICENSE.rst>`_83-* Releases: https://pypi.org/project/click/84-* Code: https://github.com/pallets/click85-* Issue tracker: https://github.com/pallets/click/issues86-* Test status: https://dev.azure.com/pallets/click/_build87-* Official chat: https://discord.gg/t6rrQZH74+- Website: https://palletsprojects.com/p/click/75+- Documentation: https://click.palletsprojects.com/76+- Releases: https://pypi.org/project/click/77+- Code: https://github.com/pallets/click78+- Issue tracker: https://github.com/pallets/click/issues79+- Test status: https://dev.azure.com/pallets/click/_build80+- Official chat: https://discord.gg/t6rrQZHmodified:setup.cfg+3 added-2 removed
4 unmodified lines5 universal = 16 7 [tool:pytest]8 testpaths = tests9+filterwarnings =10+ error11 12 [coverage:run]13 branch = True14 source =2 unmodified lines17 18 [coverage:paths]19 source =20 click19- .tox/*/lib/python*/site-packages/click20- .tox/pypy/site-packages/click21+ */site-packagesmodified:setup.py+1 added-8 removed
16 unmodified lines17 "Code": "https://github.com/pallets/click",18 "Issue tracker": "https://github.com/pallets/click/issues",19 },20 license="BSD-3-Clause",21- author="Armin Ronacher",22- author_email="armin.ronacher@active-4.com",21 maintainer="Pallets",22 maintainer_email="contact@palletsprojects.com",23 description="Composable command line interface toolkit",24 long_description=readme,25 packages=["click"],26 include_package_data=True,29- python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",27+ python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",28 classifiers=[29 "Development Status :: 5 - Production/Stable",30 "Intended Audience :: Developers",31 "License :: OSI Approved :: BSD License",32 "Operating System :: OS Independent",33 "Programming Language :: Python",34 "Programming Language :: Python :: 2",37- "Programming Language :: Python :: 2.7",35 "Programming Language :: Python :: 3",39- "Programming Language :: Python :: 3.4",40- "Programming Language :: Python :: 3.5",41- "Programming Language :: Python :: 3.6",42- "Programming Language :: Python :: 3.7",36 ],37 )modified:tox.ini+2 added-19 removed
1 [tox]2 envlist =3- py{37,36,35,27,py3,py}3+ py{38,37,36,35,27,py3,py}4 docs5- coverage5 skip_missing_interpreters = true6 7 [testenv]8 deps =9 pytest11- coverage10 colorama13-commands = coverage run -p -m pytest --tb=short -Werror --basetemp={envtmpdir} {posargs}11+commands = pytest --tb=short --basetemp={envtmpdir} {posargs}12 13 [testenv:docs]14 deps = -r docs/requirements.txt15 commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html18-19-[testenv:coverage]20-deps = coverage21-skip_install = true22-commands =23- coverage combine24- coverage html25- coverage report26-27-[testenv:coverage-ci]28-deps = codecov29-skip_install = true30-commands =31- coverage combine32- coverage xml