Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAINTENANCE] Remove Click upper bound constraint. #8515

Merged
merged 4 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion great_expectations/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def get_command(self, ctx: click.Context, name: str) -> Optional[str]: # type:
return None


@click.group(cls=CLI, name="great_expectations")
@click.command(cls=CLI, name="great_expectations")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to be a real error in our code that is now being caught. Here are the docs for multicommands and groups: https://click.palletsprojects.com/en/8.1.x/commands/#custom-multi-commands

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's with v8 - I think this may have been different before?

Copy link
Contributor Author

@billdirks billdirks Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've run mypy using click 7.1.2, as well as 8.1.6, and this passes. Looking at their release notes, it looks like they have done some work with typing recently.

@click.version_option(version=ge_version)
@click.option(
"--verbose",
Expand Down
11 changes: 10 additions & 1 deletion great_expectations/cli/python_subprocess.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
from __future__ import annotations

import os
import sys
import time
import traceback
from subprocess import PIPE, CalledProcessError, CompletedProcess, Popen, run
from typing import Optional, Union
from typing import TYPE_CHECKING, Optional, Union

import click

if TYPE_CHECKING:
# I need to import this type for typechecking or mypy will complain. It is the return type of a public method
# even though it is in a private module
from click._termui_impl import ProgressBar


from great_expectations.core import logger


Expand Down Expand Up @@ -81,6 +89,7 @@ def execute_shell_command_with_progress_polling(command: str) -> int:

gathered: int = 0
progress: float
bar: ProgressBar
with click.progressbar(length=bar_length_100_percent, label=command) as bar:
try:
with Popen(
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
altair>=4.2.1,<5.0.0
Click>=7.1.2,<=8.1.3 # 8.1.4 introduced mypy typing issues (https://github.com/pallets/click/issues/2558)
Click>=7.1.2,!=8.1.4 # 8.1.4 has a mypy typing bug (https://github.com/pallets/click/issues/2558)
colorama>=0.4.3
cryptography>=3.2
Ipython>=7.16.3
Expand Down
5 changes: 1 addition & 4 deletions tests/test_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def test_polish_and_ratchet_pins_and_upper_bounds():
)

# Polish and ratchet this number down as low as possible
assert len(sorted_packages_with_pins_or_upper_bounds) == 80
assert len(sorted_packages_with_pins_or_upper_bounds) == 77
assert sorted_packages_with_pins_or_upper_bounds == [
("requirements-dev-api-docs-test.txt", "docstring-parser", (("==", "0.15"),)),
("requirements-dev-athena.txt", "pyathena", (("<", "3"), (">=", "2.0.0"))),
Expand Down Expand Up @@ -228,7 +228,6 @@ def test_polish_and_ratchet_pins_and_upper_bounds():
("requirements-dev-test.txt", "pika", (("==", "1.3.1"),)),
("requirements-dev-test.txt", "ruff", (("==", "0.0.280"),)),
("requirements-dev-test.txt", "snapshottest", (("==", "0.6.0"),)),
("requirements-dev.txt", "Click", (("<=", "8.1.3"), (">=", "7.1.2"))),
("requirements-dev.txt", "PyMySQL", (("<", "0.10"), (">=", "0.9.3"))),
("requirements-dev.txt", "adr-tools-python", (("==", "1.0.3"),)),
("requirements-dev.txt", "altair", (("<", "5.0.0"), (">=", "4.2.1"))),
Expand All @@ -250,7 +249,6 @@ def test_polish_and_ratchet_pins_and_upper_bounds():
("requirements-dev.txt", "sqlalchemy-dremio", (("==", "1.2.1"),)),
("requirements-dev.txt", "teradatasqlalchemy", (("==", "17.0.0.5"),)),
("requirements-dev.txt", "xlrd", (("<", "2.0.0"), (">=", "1.1.0"))),
("requirements-types.txt", "Click", (("<=", "8.1.3"), (">=", "7.1.2"))),
("requirements-types.txt", "PyMySQL", (("<", "0.10"), (">=", "0.9.3"))),
("requirements-types.txt", "adr-tools-python", (("==", "1.0.3"),)),
("requirements-types.txt", "altair", (("<", "5.0.0"), (">=", "4.2.1"))),
Expand All @@ -269,7 +267,6 @@ def test_polish_and_ratchet_pins_and_upper_bounds():
("requirements-types.txt", "sqlalchemy", (("<", "2.0.0"),)),
("requirements-types.txt", "sqlalchemy-dremio", (("==", "1.2.1"),)),
("requirements-types.txt", "teradatasqlalchemy", (("==", "17.0.0.5"),)),
("requirements.txt", "Click", (("<=", "8.1.3"), (">=", "7.1.2"))),
("requirements.txt", "altair", (("<", "5.0.0"), (">=", "4.2.1"))),
("requirements.txt", "makefun", (("<", "2"), (">=", "1.7.0"))),
("requirements.txt", "marshmallow", (("<", "4.0.0"), (">=", "3.7.1"))),
Expand Down