Skip to content

Commit

Permalink
Drop Python 2.7, click 6 support
Browse files Browse the repository at this point in the history
These are both unsupported now. Drop them.

Signed-off-by: Stephen Finucane <stephen@that.guru>
  • Loading branch information
stephenfin committed May 14, 2021
1 parent 164373f commit 7fef5bc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 26 deletions.
5 changes: 1 addition & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ summary = Sphinx extension that automatically documents click applications
description-file = README.rst
license = MIT License
classifiers =
Programming Language :: Python :: 2
Programming Language :: Python :: 3
Programming Language :: Python
Development Status :: 5 - Production/Stable
Expand All @@ -13,6 +12,7 @@ classifiers =
Intended Audience :: Information Technology
License :: OSI Approved :: MIT License
Operating System :: OS Independent
python_requires = >=3.6
keywords = sphinx
author = Stephen Finucane
author-email = stephen@that.guru
Expand All @@ -23,9 +23,6 @@ project-url = https://that.guru/
packages =
sphinx_click

[wheel]
universal = 1

[flake8]
max-line-length = 88
ignore = E203,E501,E741,W503
13 changes: 4 additions & 9 deletions sphinx_click/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from sphinx.util import nodes as sphinx_nodes

LOG = logging.getLogger(__name__)
CLICK_VERSION = tuple(int(x) for x in click.__version__.split('.')[0:2])

NESTED_FULL = 'full'
NESTED_SHORT = 'short'
Expand Down Expand Up @@ -221,11 +220,7 @@ def _format_subcommand(command):
"""Format a sub-command of a `click.Command` or `click.Group`."""
yield '.. object:: {}'.format(command.name)

# click 7.0 stopped setting short_help by default
if CLICK_VERSION < (7, 0):
short_help = command.short_help
else:
short_help = command.get_short_help_str()
short_help = command.get_short_help_str()

if short_help:
yield ''
Expand Down Expand Up @@ -276,7 +271,7 @@ def _filter_commands(ctx, commands=None):

def _format_command(ctx, nested, commands=None):
"""Format the output of `click.Command`."""
if CLICK_VERSION >= (7, 0) and ctx.command.hidden:
if ctx.command.hidden:
return

# description
Expand Down Expand Up @@ -340,7 +335,7 @@ def _format_command(ctx, nested, commands=None):

for command in commands:
# Don't show hidden subcommands
if CLICK_VERSION >= (7, 0) and command.hidden:
if command.hidden:
continue

for line in _format_subcommand(command):
Expand Down Expand Up @@ -432,7 +427,7 @@ def _generate_nodes(
"""
ctx = click.Context(command, info_name=name, parent=parent)

if CLICK_VERSION >= (7, 0) and command.hidden:
if command.hidden:
return []

# Title
Expand Down
10 changes: 0 additions & 10 deletions tests/test_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ def foobar(bar):
'\n'.join(output),
)

@unittest.skipIf(
ext.CLICK_VERSION < (7, 0),
'Allowing show_default to be a string was added in Click 7.0',
)
def test_defaults(self):
"""Validate formatting of user documented defaults."""

Expand Down Expand Up @@ -204,9 +200,6 @@ def foobar(bar):
'\n'.join(output),
)

@unittest.skipIf(
ext.CLICK_VERSION < (7, 0), 'The hidden flag was added in Click 7.0'
)
def test_hidden(self):
"""Validate a `click.Command` with the `hidden` flag."""

Expand Down Expand Up @@ -691,9 +684,6 @@ def get_command(self, ctx, name):
'\n'.join(output),
)

@unittest.skipIf(
ext.CLICK_VERSION < (7, 0), 'The hidden flag was added in Click 7.0'
)
def test_hidden(self):
"""Ensure 'hidden' subcommands are not shown."""

Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[tox]
minversion = 2.0
envlist = py{27,35,36,37,36-pre,37-pre,py}-click{6,7},style,docs
envlist = py{36,37,38,39}-click{7,8},style,docs

[testenv]
deps =
coverage>4.3,<5.0
click6: click>=6.0,<7.0
click7: click>=7.0,<8.0
click8: click>=8.0,<9.0
commands =
coverage run --source={toxinidir}/sphinx_click -m unittest discover -s tests/
coverage report
Expand Down Expand Up @@ -34,5 +34,5 @@ commands =

[travis]
python =
2.7: py27, docs
3.6: py36, docs
3.7: py37, style

0 comments on commit 7fef5bc

Please sign in to comment.