From 0aff6b9452080a1fe53bf8537b5e71bd04986c24 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 13:56:00 -0400 Subject: [PATCH 01/25] Update hypothesis requirement in /.github/scripts (#566) Updates the requirements on [hypothesis](https://github.com/HypothesisWorks/hypothesis) to permit the latest version. - [Release notes](https://github.com/HypothesisWorks/hypothesis/releases) - [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-ruby-0.0.1...hypothesis-python-6.116.0) --- updated-dependencies: - dependency-name: hypothesis dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index 0b32ac05..5c947b3e 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -5,5 +5,5 @@ pytest <=8.3.3 pytest-pylint <=1.1.2 pytest-runner <7.0.0 termcolor <2.5.0 -hypothesis <6.113.0 +hypothesis <6.117.0 levenshtein <=0.26.0 From dfa1071b7a9aee0ca1538dc4e08236c0c5dedda4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 14:09:07 -0400 Subject: [PATCH 02/25] Update termcolor requirement from <2.5.0 to <2.6.0 in /.github/scripts (#569) Updates the requirements on [termcolor](https://github.com/termcolor/termcolor) to permit the latest version. - [Release notes](https://github.com/termcolor/termcolor/releases) - [Changelog](https://github.com/termcolor/termcolor/blob/main/CHANGES.md) - [Commits](https://github.com/termcolor/termcolor/compare/0.1...2.5.0) --- updated-dependencies: - dependency-name: termcolor dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index 5c947b3e..6147fcbb 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -4,6 +4,6 @@ pylint <3.3.2 pytest <=8.3.3 pytest-pylint <=1.1.2 pytest-runner <7.0.0 -termcolor <2.5.0 +termcolor <2.6.0 hypothesis <6.117.0 levenshtein <=0.26.0 From 98d7fbce9c93a6b0c3b209a8ed1144cd233decc0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 14:14:29 -0400 Subject: [PATCH 03/25] Update setuptools requirement in /.github/scripts (#567) Updates the requirements on [setuptools](https://github.com/pypa/setuptools) to permit the latest version. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/0.6...v75.3.0) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index 6147fcbb..6df54e28 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -1,4 +1,4 @@ -setuptools <=75.1.0 +setuptools <=75.3.0 pip pylint <3.3.2 pytest <=8.3.3 From c3b4474ea42c2f5330ee28fea7a9fc31e4c59451 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 18:49:46 -0400 Subject: [PATCH 04/25] Update levenshtein requirement in /.github/scripts (#568) Updates the requirements on [levenshtein](https://github.com/rapidfuzz/Levenshtein) to permit the latest version. - [Release notes](https://github.com/rapidfuzz/Levenshtein/releases) - [Changelog](https://github.com/rapidfuzz/Levenshtein/blob/main/HISTORY.md) - [Commits](https://github.com/rapidfuzz/Levenshtein/compare/v0.13.0...v0.26.1) --- updated-dependencies: - dependency-name: levenshtein dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index 6df54e28..cf8a3420 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -6,4 +6,4 @@ pytest-pylint <=1.1.2 pytest-runner <7.0.0 termcolor <2.6.0 hypothesis <6.117.0 -levenshtein <=0.26.0 +levenshtein <=0.26.1 From deb25efee883191f9dac1cec579d3f96f1e32226 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:52:02 -0500 Subject: [PATCH 05/25] Update setuptools requirement in /.github/scripts (#573) Updates the requirements on [setuptools](https://github.com/pypa/setuptools) to permit the latest version. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/0.6...v75.6.0) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index cf8a3420..0480a001 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -1,4 +1,4 @@ -setuptools <=75.3.0 +setuptools <=75.6.0 pip pylint <3.3.2 pytest <=8.3.3 From 6cf45c663075c96b20dd0dfa733c2374545a4ad6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:53:58 -0500 Subject: [PATCH 06/25] Update hypothesis requirement in /.github/scripts (#574) Updates the requirements on [hypothesis](https://github.com/HypothesisWorks/hypothesis) to permit the latest version. - [Release notes](https://github.com/HypothesisWorks/hypothesis/releases) - [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-ruby-0.0.1...hypothesis-python-6.122.0) --- updated-dependencies: - dependency-name: hypothesis dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index 0480a001..958c6248 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -5,5 +5,5 @@ pytest <=8.3.3 pytest-pylint <=1.1.2 pytest-runner <7.0.0 termcolor <2.6.0 -hypothesis <6.117.0 +hypothesis <6.123.0 levenshtein <=0.26.1 From 2e0867d3371db9db6e95fad7f82d58ccb894d94c Mon Sep 17 00:00:00 2001 From: David Bieber Date: Sun, 23 Mar 2025 14:43:44 -0400 Subject: [PATCH 07/25] Use Neutral theme for Inspector (#588) * Use Neutral theme for Inspector * Catch when theme_name not available --- fire/inspectutils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fire/inspectutils.py b/fire/inspectutils.py index d1438972..06c30ef1 100644 --- a/fire/inspectutils.py +++ b/fire/inspectutils.py @@ -256,7 +256,10 @@ def Info(component): """ try: from IPython.core import oinspect # pylint: disable=import-outside-toplevel,g-import-not-at-top - inspector = oinspect.Inspector() + try: + inspector = oinspect.Inspector(theme_name="Neutral") + except TypeError: # Only recent versions of IPython support theme_name. + inspector = oinspect.Inspector() info = inspector.info(component) # IPython's oinspect.Inspector.info may return '' From 45152e18255e5c5803f3805604eb738c50befeff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 19:34:56 -0400 Subject: [PATCH 08/25] Update pylint requirement from <3.3.2 to <3.3.5 in /.github/scripts (#581) Updates the requirements on [pylint](https://github.com/pylint-dev/pylint) to permit the latest version. - [Release notes](https://github.com/pylint-dev/pylint/releases) - [Commits](https://github.com/pylint-dev/pylint/compare/pylint-version-0.18.1...v3.3.4) --- updated-dependencies: - dependency-name: pylint dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index 958c6248..5810abf5 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -1,6 +1,6 @@ setuptools <=75.6.0 pip -pylint <3.3.2 +pylint <3.3.5 pytest <=8.3.3 pytest-pylint <=1.1.2 pytest-runner <7.0.0 From 525708c3d7bcfc36a71e23694f09d0b587a7bf72 Mon Sep 17 00:00:00 2001 From: David Bieber Date: Mon, 14 Apr 2025 14:40:30 -0400 Subject: [PATCH 09/25] Use lowercase neutral instead of upper (#596) --- fire/inspectutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fire/inspectutils.py b/fire/inspectutils.py index 06c30ef1..d9c62ca7 100644 --- a/fire/inspectutils.py +++ b/fire/inspectutils.py @@ -257,7 +257,7 @@ def Info(component): try: from IPython.core import oinspect # pylint: disable=import-outside-toplevel,g-import-not-at-top try: - inspector = oinspect.Inspector(theme_name="Neutral") + inspector = oinspect.Inspector(theme_name="neutral") except TypeError: # Only recent versions of IPython support theme_name. inspector = oinspect.Inspector() info = inspector.info(component) From c5ab602240a160902986e48db8980d59338be944 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 14:40:45 -0400 Subject: [PATCH 10/25] Update hypothesis requirement in /.github/scripts (#594) Updates the requirements on [hypothesis](https://github.com/HypothesisWorks/hypothesis) to permit the latest version. - [Release notes](https://github.com/HypothesisWorks/hypothesis/releases) - [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-ruby-0.0.1...hypothesis-python-6.130.6) --- updated-dependencies: - dependency-name: hypothesis dependency-version: 6.130.6 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index 5810abf5..b922f04a 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -5,5 +5,5 @@ pytest <=8.3.3 pytest-pylint <=1.1.2 pytest-runner <7.0.0 termcolor <2.6.0 -hypothesis <6.123.0 +hypothesis <6.131.0 levenshtein <=0.26.1 From 8527235d18835223dad5055e29d50664ab5bfb2d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 14:41:02 -0400 Subject: [PATCH 11/25] Update setuptools requirement in /.github/scripts (#593) Updates the requirements on [setuptools](https://github.com/pypa/setuptools) to permit the latest version. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/0.6...v78.1.0) --- updated-dependencies: - dependency-name: setuptools dependency-version: 78.1.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index b922f04a..8db34c71 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -1,4 +1,4 @@ -setuptools <=75.6.0 +setuptools <=78.1.0 pip pylint <3.3.5 pytest <=8.3.3 From fb01c7c619eda3107c7e32c42370573f6f63f33c Mon Sep 17 00:00:00 2001 From: David Bieber Date: Wed, 21 May 2025 12:23:08 -0700 Subject: [PATCH 12/25] Call inspectutils.GetClassAttrsDict on component, not None (#606) * inspectutils.GetClassAttrsDict on component, not None * Remove ubuntu-20.04 in favor of ubuntu-22.04 for Python 3.7 --- .github/workflows/build.yml | 2 +- fire/completion.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 59b0a4ba..75a687f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: os: ["macos-latest", "ubuntu-latest"] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13.0-rc.2"] include: - - {os: "ubuntu-20.04", python-version: "3.7"} + - {os: "ubuntu-22.04", python-version: "3.7"} steps: # Checkout the repo. diff --git a/fire/completion.py b/fire/completion.py index 625e9d86..1597d464 100644 --- a/fire/completion.py +++ b/fire/completion.py @@ -321,7 +321,7 @@ def MemberVisible(component, name, member, class_attrs=None, verbose=False): if inspect.isclass(component): # If class_attrs has not been provided, compute it. if class_attrs is None: - class_attrs = inspectutils.GetClassAttrsDict(class_attrs) or {} + class_attrs = inspectutils.GetClassAttrsDict(component) or {} class_attr = class_attrs.get(name) if class_attr: # Methods and properties should only be accessible on instantiated From 51974c67bf72ac649ed28015d960884712bcbc0f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 12:23:37 -0700 Subject: [PATCH 13/25] Update pylint requirement from <3.3.5 to <3.3.7 in /.github/scripts (#591) Updates the requirements on [pylint](https://github.com/pylint-dev/pylint) to permit the latest version. - [Release notes](https://github.com/pylint-dev/pylint/releases) - [Commits](https://github.com/pylint-dev/pylint/compare/pylint-version-0.18.1...v3.3.6) --- updated-dependencies: - dependency-name: pylint dependency-version: 3.3.6 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index 8db34c71..82b1be4a 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -1,6 +1,6 @@ setuptools <=78.1.0 pip -pylint <3.3.5 +pylint <3.3.7 pytest <=8.3.3 pytest-pylint <=1.1.2 pytest-runner <7.0.0 From dba7e1d0da014e555d174225fdf5ab4c4574b18b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Jun 2025 10:55:56 -0400 Subject: [PATCH 14/25] Update hypothesis requirement in /.github/scripts (#608) Updates the requirements on [hypothesis](https://github.com/HypothesisWorks/hypothesis) to permit the latest version. - [Release notes](https://github.com/HypothesisWorks/hypothesis/releases) - [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-ruby-0.0.1...hypothesis-python-6.132.0) --- updated-dependencies: - dependency-name: hypothesis dependency-version: 6.132.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index 82b1be4a..613c4da0 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -5,5 +5,5 @@ pytest <=8.3.3 pytest-pylint <=1.1.2 pytest-runner <7.0.0 termcolor <2.6.0 -hypothesis <6.131.0 +hypothesis <6.133.0 levenshtein <=0.26.1 From 2e6f8d2b248411fb4bbfb7fbf3701ee96c0e9a61 Mon Sep 17 00:00:00 2001 From: David Bieber Date: Fri, 18 Jul 2025 21:23:40 -0400 Subject: [PATCH 15/25] Bump version to 0.7.1 (#609) * Bump version to 0.7.1 * Bump dependency versions --- .github/scripts/requirements.txt | 8 ++++---- fire/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index 613c4da0..882dd440 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -1,9 +1,9 @@ -setuptools <=78.1.0 +setuptools <=80.9.0 pip pylint <3.3.7 -pytest <=8.3.3 +pytest <=8.3.5 pytest-pylint <=1.1.2 pytest-runner <7.0.0 -termcolor <2.6.0 +termcolor <3.2.0 hypothesis <6.133.0 -levenshtein <=0.26.1 +levenshtein <=0.27.1 diff --git a/fire/__init__.py b/fire/__init__.py index 9ff696d3..b1470692 100644 --- a/fire/__init__.py +++ b/fire/__init__.py @@ -17,4 +17,4 @@ from fire.core import Fire __all__ = ['Fire'] -__version__ = '0.7.0' +__version__ = '0.7.1' diff --git a/setup.py b/setup.py index 8d4a381b..23b7b472 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ 'levenshtein', ] -VERSION = '0.7.0' +VERSION = '0.7.1' URL = 'https://github.com/google/python-fire' setup( From d33056cb32f217c57b432040484901f34b9f5411 Mon Sep 17 00:00:00 2001 From: David Bieber Date: Fri, 18 Jul 2025 22:27:20 -0400 Subject: [PATCH 16/25] Move to pyproject.toml (#613) * Migrate from setup.py and setup.cfg to pyproject.toml * Point dependabot at the pyproject file --- .github/dependabot.yml | 2 +- .github/scripts/build.sh | 3 +- .github/scripts/requirements.txt | 9 ---- pyproject.toml | 69 ++++++++++++++++++++++++++ requirements.txt | 1 - setup.cfg | 10 ---- setup.py | 85 -------------------------------- 7 files changed, 71 insertions(+), 108 deletions(-) delete mode 100644 .github/scripts/requirements.txt create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ba1b7f19..8be46672 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,7 +4,7 @@ version: 2 updates: # Enable version updates for python - package-ecosystem: "pip" - directory: ".github/scripts/" + directory: "/" schedule: interval: "monthly" labels: ["dependabot"] diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh index 111257ae..7f5cf491 100755 --- a/.github/scripts/build.sh +++ b/.github/scripts/build.sh @@ -19,8 +19,7 @@ set -e PYTHON_VERSION=${PYTHON_VERSION:-3.7} -pip install -U -r .github/scripts/requirements.txt -python setup.py develop +pip install -e .[test] python -m pytest # Run the tests without IPython. pip install ipython python -m pytest # Now run the tests with IPython. diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt deleted file mode 100644 index 882dd440..00000000 --- a/.github/scripts/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -setuptools <=80.9.0 -pip -pylint <3.3.7 -pytest <=8.3.5 -pytest-pylint <=1.1.2 -pytest-runner <7.0.0 -termcolor <3.2.0 -hypothesis <6.133.0 -levenshtein <=0.27.1 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..6a6ba63e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,69 @@ +[build-system] +requires = ["setuptools>=45", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "fire" +version = "0.7.1" +description = "A library for automatically generating command line interfaces." +readme = "README.md" +license = {text = "Apache-2.0"} +authors = [ + {name = "David Bieber", email = "dbieber@google.com"} +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries :: Python Modules", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Operating System :: OS Independent", + "Operating System :: POSIX", + "Operating System :: MacOS", + "Operating System :: Unix", +] +keywords = ["command", "line", "interface", "cli", "python", "fire", "interactive", "bash", "tool"] +requires-python = ">=3.7" +dependencies = [ + "termcolor", +] + +[project.urls] +Homepage = "https://github.com/google/python-fire" +Repository = "https://github.com/google/python-fire" + +[project.optional-dependencies] +test = [ + "setuptools<=80.9.0", + "pip", + "pylint<3.3.7", + "pytest<=8.3.5", + "pytest-pylint<=1.1.2", + "pytest-runner<7.0.0", + "termcolor<3.2.0", + "hypothesis<6.133.0", + "levenshtein<=0.27.1", +] + +[tool.setuptools.packages.find] +include = ["fire*"] + +[tool.setuptools.package-data] +fire = ["console/*"] + +[tool.pytest.ini_options] +addopts = [ + "--ignore=fire/test_components_py3.py", + "--ignore=fire/parser_fuzz_test.py" +] + +[tool.pytype] +inputs = "." +output = ".pytype" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9c558e35..00000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -. diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index ed53d83b..00000000 --- a/setup.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[aliases] -test = pytest - -[tool:pytest] -addopts = --ignore=fire/test_components_py3.py - --ignore=fire/parser_fuzz_test.py - -[pytype] -inputs = . -output = .pytype diff --git a/setup.py b/setup.py deleted file mode 100644 index 23b7b472..00000000 --- a/setup.py +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright (C) 2018 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""The setup.py file for Python Fire.""" - -from setuptools import setup - -LONG_DESCRIPTION = """ -Python Fire is a library for automatically generating command line interfaces -(CLIs) with a single line of code. - -It will turn any Python module, class, object, function, etc. (any Python -component will work!) into a CLI. It's called Fire because when you call Fire(), -it fires off your command. -""".strip() - -SHORT_DESCRIPTION = """ -A library for automatically generating command line interfaces.""".strip() - -DEPENDENCIES = [ - 'termcolor', -] - -TEST_DEPENDENCIES = [ - 'hypothesis', - 'levenshtein', -] - -VERSION = '0.7.1' -URL = 'https://github.com/google/python-fire' - -setup( - name='fire', - version=VERSION, - description=SHORT_DESCRIPTION, - long_description=LONG_DESCRIPTION, - url=URL, - - author='David Bieber', - author_email='dbieber@google.com', - license='Apache Software License', - - classifiers=[ - 'Development Status :: 4 - Beta', - - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Libraries :: Python Modules', - - 'License :: OSI Approved :: Apache Software License', - - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - 'Programming Language :: Python :: 3.13', - - 'Operating System :: OS Independent', - 'Operating System :: POSIX', - 'Operating System :: MacOS', - 'Operating System :: Unix', - ], - - keywords='command line interface cli python fire interactive bash tool', - - requires_python='>=3.7', - packages=['fire', 'fire.console'], - - install_requires=DEPENDENCIES, - tests_require=TEST_DEPENDENCIES, -) From 84496196045c96ade6ef7c42ebd374f9b6bddee0 Mon Sep 17 00:00:00 2001 From: David Bieber Date: Fri, 18 Jul 2025 23:21:02 -0400 Subject: [PATCH 17/25] Use ty in place of pytype (#617) * Use ty in place of pytype --- .github/scripts/build.sh | 8 ++++---- fire/__main__.py | 4 ++-- fire/console/console_attr_os.py | 5 +---- fire/console/encoding.py | 12 ++++++------ fire/core.py | 4 ++-- fire/core_test.py | 4 ++-- fire/custom_descriptions.py | 8 ++++---- fire/decorators.py | 2 +- fire/docstrings.py | 2 +- fire/formatting_windows.py | 6 +++--- fire/helptext.py | 15 +++++++++------ fire/helptext_test.py | 12 ++++++------ fire/inspectutils.py | 17 ++++++++--------- fire/main_test.py | 2 +- fire/parser.py | 2 +- fire/trace.py | 2 -- pyproject.toml | 4 ---- 17 files changed, 51 insertions(+), 58 deletions(-) diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh index 7f5cf491..d9207dfe 100755 --- a/.github/scripts/build.sh +++ b/.github/scripts/build.sh @@ -24,8 +24,8 @@ python -m pytest # Run the tests without IPython. pip install ipython python -m pytest # Now run the tests with IPython. pylint fire --ignore=test_components_py3.py,parser_fuzz_test.py,console -if [[ ${PYTHON_VERSION} == 3.7 ]]; then - # Run type-checking. - pip install pytype; - pytype -x fire/test_components_py3.py; +if [[ ${PYTHON_VERSION} == 3.12 ]]; then + # Run type-checking + pip install ty + python -m ty check --python $(which python) --exclude fire/test_components_py3.py --exclude fire/console/ --exclude fire/formatting_windows.py fi diff --git a/fire/__main__.py b/fire/__main__.py index 140b4a76..eb98b1a4 100644 --- a/fire/__main__.py +++ b/fire/__main__.py @@ -60,11 +60,11 @@ def import_from_file_path(path): spec = util.spec_from_file_location(module_name, path) - if spec is None: + if spec is None or spec.loader is None: raise OSError('Unable to load module from specified path.') module = util.module_from_spec(spec) # pylint: disable=no-member - spec.loader.exec_module(module) # pytype: disable=attribute-error + spec.loader.exec_module(module) return module, module_name diff --git a/fire/console/console_attr_os.py b/fire/console/console_attr_os.py index 869c5949..a7f38d4f 100644 --- a/fire/console/console_attr_os.py +++ b/fire/console/console_attr_os.py @@ -14,9 +14,6 @@ # limitations under the License. """OS specific console_attr helper functions.""" -# This file contains platform specific code which is not currently handled -# by pytype. -# pytype: skip-file from __future__ import absolute_import from __future__ import division @@ -73,7 +70,7 @@ def _GetXY(fd): try: # This magic incantation converts a struct from ioctl(2) containing two # binary shorts to a (rows, columns) int tuple. - rc = struct.unpack(b'hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, 'junk')) + rc = struct.unpack(b'hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, b'junk')) return (rc[1], rc[0]) if rc else None except: # pylint: disable=bare-except return None diff --git a/fire/console/encoding.py b/fire/console/encoding.py index 3ce30cb5..662342c6 100644 --- a/fire/console/encoding.py +++ b/fire/console/encoding.py @@ -67,7 +67,7 @@ def Decode(data, encoding=None): try: # Just return the string if its pure ASCII. - return string.decode('ascii') # pytype: disable=attribute-error + return string.decode('ascii') except UnicodeError: # The string is not ASCII encoded. pass @@ -75,7 +75,7 @@ def Decode(data, encoding=None): # Try the suggested encoding if specified. if encoding: try: - return string.decode(encoding) # pytype: disable=attribute-error + return string.decode(encoding) except UnicodeError: # Bad suggestion. pass @@ -84,21 +84,21 @@ def Decode(data, encoding=None): # be exceptional if a valid extended ascii encoding with extended chars # were also a valid UITF-8 encoding. try: - return string.decode('utf8') # pytype: disable=attribute-error + return string.decode('utf8') except UnicodeError: # Not a UTF-8 encoding. pass # Try the filesystem encoding. try: - return string.decode(sys.getfilesystemencoding()) # pytype: disable=attribute-error + return string.decode(sys.getfilesystemencoding()) except UnicodeError: # string is not encoded for filesystem paths. pass # Try the system default encoding. try: - return string.decode(sys.getdefaultencoding()) # pytype: disable=attribute-error + return string.decode(sys.getdefaultencoding()) except UnicodeError: # string is not encoded using the default encoding. pass @@ -118,7 +118,7 @@ def Decode(data, encoding=None): # string = '\xdc' # string = string.decode('iso-8859-1') # string = string.encode('ascii', 'backslashreplace') - return string.decode('iso-8859-1') # pytype: disable=attribute-error + return string.decode('iso-8859-1') def GetEncodedValue(env, name, default=None): diff --git a/fire/core.py b/fire/core.py index 26a25753..32e0e9cc 100644 --- a/fire/core.py +++ b/fire/core.py @@ -504,7 +504,7 @@ def _Fire(component, args, parsed_flag_args, context, name=None): # Treat namedtuples as dicts when handling them as a map. if inspectutils.IsNamedTuple(component): - component_dict = component._asdict() # pytype: disable=attribute-error + component_dict = component._asdict() else: component_dict = component @@ -519,7 +519,7 @@ def _Fire(component, args, parsed_flag_args, context, name=None): # a key as another type. # TODO(dbieber): Consider alternatives for accessing non-string keys. for key, value in ( - component_dict.items()): # pytype: disable=attribute-error + component_dict.items()): if target == str(key): component = value handled = True diff --git a/fire/core_test.py b/fire/core_test.py index 90b7f466..f48d6e2d 100644 --- a/fire/core_test.py +++ b/fire/core_test.py @@ -215,12 +215,12 @@ def serialize(x): def testLruCacheDecoratorBoundArg(self): self.assertEqual( - core.Fire(tc.py3.LruCacheDecoratedMethod, # pytype: disable=module-attr + core.Fire(tc.py3.LruCacheDecoratedMethod, command=['lru_cache_in_class', 'foo']), 'foo') def testLruCacheDecorator(self): self.assertEqual( - core.Fire(tc.py3.lru_cache_decorated, # pytype: disable=module-attr + core.Fire(tc.py3.lru_cache_decorated, command=['foo']), 'foo') diff --git a/fire/custom_descriptions.py b/fire/custom_descriptions.py index 768f0e23..ef1130a3 100644 --- a/fire/custom_descriptions.py +++ b/fire/custom_descriptions.py @@ -131,14 +131,14 @@ def GetStringTypeDescription(obj, available_space, line_length): def GetSummary(obj, available_space, line_length): obj_type_name = type(obj).__name__ if obj_type_name in CUSTOM_DESC_SUM_FN_DICT: - return CUSTOM_DESC_SUM_FN_DICT.get(obj_type_name)[0](obj, available_space, - line_length) + return CUSTOM_DESC_SUM_FN_DICT[obj_type_name][0](obj, available_space, + line_length) return None def GetDescription(obj, available_space, line_length): obj_type_name = type(obj).__name__ if obj_type_name in CUSTOM_DESC_SUM_FN_DICT: - return CUSTOM_DESC_SUM_FN_DICT.get(obj_type_name)[1](obj, available_space, - line_length) + return CUSTOM_DESC_SUM_FN_DICT[obj_type_name][1](obj, available_space, + line_length) return None diff --git a/fire/decorators.py b/fire/decorators.py index 914b1de6..547153c6 100644 --- a/fire/decorators.py +++ b/fire/decorators.py @@ -68,7 +68,7 @@ def SetParseFns(*positional, **named): def _Decorator(fn): parse_fns = GetParseFns(fn) parse_fns['positional'] = positional - parse_fns['named'].update(named) # pytype: disable=attribute-error + parse_fns['named'].update(named) _SetMetadata(fn, FIRE_PARSE_FNS, parse_fns) return fn diff --git a/fire/docstrings.py b/fire/docstrings.py index 2d7c7e63..2adfe5ec 100644 --- a/fire/docstrings.py +++ b/fire/docstrings.py @@ -436,7 +436,7 @@ def _consume_line(line_info, state): if state.section.new and state.section.format == Formats.RST: # The current line starts with an RST directive, e.g. ":param arg:". directive = _get_directive(line_info) - directive_tokens = directive.split() # pytype: disable=attribute-error + directive_tokens = directive.split() if state.section.title == Sections.ARGS: name = directive_tokens[-1] arg = _get_or_create_arg_by_name( diff --git a/fire/formatting_windows.py b/fire/formatting_windows.py index cee6f393..749ab6d0 100644 --- a/fire/formatting_windows.py +++ b/fire/formatting_windows.py @@ -21,7 +21,7 @@ import sys try: - import colorama # pylint: disable=g-import-not-at-top, # pytype: disable=import-error + import colorama # pylint: disable=g-import-not-at-top HAS_COLORAMA = True except ImportError: HAS_COLORAMA = False @@ -38,9 +38,9 @@ def initialize_or_disable(): # Windows 10, 2016, and 2019 only. wrap = False - kernel32 = ctypes.windll.kernel32 # pytype: disable=module-attr + kernel32 = ctypes.windll.kernel32 enable_virtual_terminal_processing = 0x04 - out_handle = kernel32.GetStdHandle(subprocess.STD_OUTPUT_HANDLE) # pylint: disable=line-too-long, # pytype: disable=module-attr + out_handle = kernel32.GetStdHandle(subprocess.STD_OUTPUT_HANDLE) # pylint: disable=line-too-long, # GetConsoleMode fails if the terminal isn't native. mode = ctypes.wintypes.DWORD() if kernel32.GetConsoleMode(out_handle, ctypes.byref(mode)) == 0: diff --git a/fire/helptext.py b/fire/helptext.py index 318d6276..347278da 100644 --- a/fire/helptext.py +++ b/fire/helptext.py @@ -29,6 +29,8 @@ information. """ +from __future__ import annotations + import collections import itertools @@ -85,13 +87,14 @@ def HelpText(component, trace=None, verbose=False): + usage_details_sections + notes_sections ) + valid_sections = [section for section in sections if section is not None] return '\n\n'.join( - _CreateOutputSection(*section) - for section in sections if section is not None + _CreateOutputSection(name, content) + for name, content in valid_sections ) -def _NameSection(component, info, trace=None, verbose=False): +def _NameSection(component, info, trace=None, verbose=False) -> tuple[str, str]: """The "Name" section of the help string.""" # Only include separators in the name in verbose mode. @@ -113,7 +116,7 @@ def _NameSection(component, info, trace=None, verbose=False): def _SynopsisSection(component, actions_grouped_by_kind, spec, metadata, - trace=None): + trace=None) -> tuple[str, str]: """The "Synopsis" section of the help string.""" current_command = _GetCurrentCommand(trace=trace, include_separators=True) @@ -136,7 +139,7 @@ def _SynopsisSection(component, actions_grouped_by_kind, spec, metadata, return ('SYNOPSIS', text) -def _DescriptionSection(component, info): +def _DescriptionSection(component, info) -> tuple[str, str] | None: """The "Description" sections of the help string. Args: @@ -408,7 +411,7 @@ def _GetCurrentCommand(trace=None, include_separators=True): return current_command -def _CreateOutputSection(name, content): +def _CreateOutputSection(name: str, content: str) -> str: return f"""{formatting.Bold(name)} {formatting.Indent(content, SECTION_INDENTATION)}""" diff --git a/fire/helptext_test.py b/fire/helptext_test.py index aeff5240..c7098fc4 100644 --- a/fire/helptext_test.py +++ b/fire/helptext_test.py @@ -125,7 +125,7 @@ def testHelpTextFunctionWithKwargsAndDefaults(self): def testHelpTextFunctionWithDefaultsAndTypes(self): component = ( - tc.py3.WithDefaultsAndTypes().double) # pytype: disable=module-attr + tc.py3.WithDefaultsAndTypes().double) help_screen = helptext.HelpText( component=component, trace=trace.FireTrace(component, name='double')) @@ -139,7 +139,7 @@ def testHelpTextFunctionWithDefaultsAndTypes(self): def testHelpTextFunctionWithTypesAndDefaultNone(self): component = ( - tc.py3.WithDefaultsAndTypes().get_int) # pytype: disable=module-attr + tc.py3.WithDefaultsAndTypes().get_int) help_screen = helptext.HelpText( component=component, trace=trace.FireTrace(component, name='get_int')) @@ -153,7 +153,7 @@ def testHelpTextFunctionWithTypesAndDefaultNone(self): self.assertNotIn('NOTES', help_screen) def testHelpTextFunctionWithTypes(self): - component = tc.py3.WithTypes().double # pytype: disable=module-attr + component = tc.py3.WithTypes().double help_screen = helptext.HelpText( component=component, trace=trace.FireTrace(component, name='double')) @@ -168,7 +168,7 @@ def testHelpTextFunctionWithTypes(self): help_screen) def testHelpTextFunctionWithLongTypes(self): - component = tc.py3.WithTypes().long_type # pytype: disable=module-attr + component = tc.py3.WithTypes().long_type help_screen = helptext.HelpText( component=component, trace=trace.FireTrace(component, name='long_type')) @@ -263,14 +263,14 @@ def testHelpTextNoInit(self): self.assertIn('SYNOPSIS\n OldStyleEmpty', help_screen) def testHelpTextKeywordOnlyArgumentsWithDefault(self): - component = tc.py3.KeywordOnly.with_default # pytype: disable=module-attr + component = tc.py3.KeywordOnly.with_default output = helptext.HelpText( component=component, trace=trace.FireTrace(component, 'with_default')) self.assertIn('NAME\n with_default', output) self.assertIn('FLAGS\n -x, --x=X', output) def testHelpTextKeywordOnlyArgumentsWithoutDefault(self): - component = tc.py3.KeywordOnly.double # pytype: disable=module-attr + component = tc.py3.KeywordOnly.double output = helptext.HelpText( component=component, trace=trace.FireTrace(component, 'double')) self.assertIn('NAME\n double', output) diff --git a/fire/inspectutils.py b/fire/inspectutils.py index d9c62ca7..6dd8fd67 100644 --- a/fire/inspectutils.py +++ b/fire/inspectutils.py @@ -100,9 +100,9 @@ def Py3GetFullArgSpec(fn): An inspect.FullArgSpec namedtuple with the full arg spec of the function. """ # pylint: disable=no-member - # pytype: disable=module-attr + try: - sig = inspect._signature_from_callable( # pylint: disable=protected-access + sig = inspect._signature_from_callable( # pylint: disable=protected-access # type: ignore fn, skip_bound_arg=True, follow_wrapper_chains=True, @@ -129,19 +129,19 @@ def Py3GetFullArgSpec(fn): name = param.name # pylint: disable=protected-access - if kind is inspect._POSITIONAL_ONLY: + if kind is inspect._POSITIONAL_ONLY: # type: ignore args.append(name) - elif kind is inspect._POSITIONAL_OR_KEYWORD: + elif kind is inspect._POSITIONAL_OR_KEYWORD: # type: ignore args.append(name) if param.default is not param.empty: defaults += (param.default,) - elif kind is inspect._VAR_POSITIONAL: + elif kind is inspect._VAR_POSITIONAL: # type: ignore varargs = name - elif kind is inspect._KEYWORD_ONLY: + elif kind is inspect._KEYWORD_ONLY: # type: ignore kwonlyargs.append(name) if param.default is not param.empty: kwdefaults[name] = param.default - elif kind is inspect._VAR_KEYWORD: + elif kind is inspect._VAR_KEYWORD: # type: ignore varkw = name if param.annotation is not param.empty: annotations[name] = param.annotation @@ -157,7 +157,6 @@ def Py3GetFullArgSpec(fn): return inspect.FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwdefaults, annotations) # pylint: enable=no-member - # pytype: enable=module-attr def GetFullArgSpec(fn): @@ -259,7 +258,7 @@ def Info(component): try: inspector = oinspect.Inspector(theme_name="neutral") except TypeError: # Only recent versions of IPython support theme_name. - inspector = oinspect.Inspector() + inspector = oinspect.Inspector() # type: ignore info = inspector.info(component) # IPython's oinspect.Inspector.info may return '' diff --git a/fire/main_test.py b/fire/main_test.py index a2723347..9e1c382b 100644 --- a/fire/main_test.py +++ b/fire/main_test.py @@ -78,7 +78,7 @@ def testFileNameModuleDuplication(self): def testFileNameModuleFileFailure(self): # Confirm that an invalid file that masks a non-existent module fails. with self.assertRaisesRegex(ValueError, - r'Fire can only be called on \.py files\.'): # pylint: disable=line-too-long, # pytype: disable=attribute-error + r'Fire can only be called on \.py files\.'): # pylint: disable=line-too-long, dirname = os.path.dirname(self.file.name) with testutils.ChangeDirectory(dirname): with open('foobar', 'w'): diff --git a/fire/parser.py b/fire/parser.py index d945b8ce..b8e7f19c 100644 --- a/fire/parser.py +++ b/fire/parser.py @@ -96,7 +96,7 @@ def _LiteralEval(value): SyntaxError: If the value string has a syntax error. """ root = ast.parse(value, mode='eval') - if isinstance(root.body, ast.BinOp): # pytype: disable=attribute-error + if isinstance(root.body, ast.BinOp): raise ValueError(value) for node in ast.walk(root): diff --git a/fire/trace.py b/fire/trace.py index 4a6d4776..601026fd 100644 --- a/fire/trace.py +++ b/fire/trace.py @@ -62,9 +62,7 @@ def __init__(self, initial_component, name=None, separator='-', verbose=False, def GetResult(self): """Returns the component from the last element of the trace.""" - # pytype: disable=attribute-error return self.GetLastHealthyElement().component - # pytype: enable=attribute-error def GetLastHealthyElement(self): """Returns the last element of the trace that is not an error. diff --git a/pyproject.toml b/pyproject.toml index 6a6ba63e..dfb1eeba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,3 @@ addopts = [ "--ignore=fire/test_components_py3.py", "--ignore=fire/parser_fuzz_test.py" ] - -[tool.pytype] -inputs = "." -output = ".pytype" From cec0119b10d2007e9de7c58ea4d7eac22682dc04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Jul 2025 23:22:05 -0400 Subject: [PATCH 18/25] Update hypothesis requirement from <6.133.0 to <6.136.0 (#616) Updates the requirements on [hypothesis](https://github.com/HypothesisWorks/hypothesis) to permit the latest version. - [Release notes](https://github.com/HypothesisWorks/hypothesis/releases) - [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-ruby-0.0.1...hypothesis-python-6.135.33) --- updated-dependencies: - dependency-name: hypothesis dependency-version: 6.135.33 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dfb1eeba..b42c0aec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ test = [ "pytest-pylint<=1.1.2", "pytest-runner<7.0.0", "termcolor<3.2.0", - "hypothesis<6.133.0", + "hypothesis<6.136.0", "levenshtein<=0.27.1", ] From 8c62e05569cd7111731e2f704cbba5e3e4157b01 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Jul 2025 23:25:48 -0400 Subject: [PATCH 19/25] Update pytest requirement from <=8.3.5 to <=8.4.1 (#615) Updates the requirements on [pytest](https://github.com/pytest-dev/pytest) to permit the latest version. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/1.0.0b3...8.4.1) --- updated-dependencies: - dependency-name: pytest dependency-version: 8.4.1 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b42c0aec..34ad8426 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ test = [ "setuptools<=80.9.0", "pip", "pylint<3.3.7", - "pytest<=8.3.5", + "pytest<=8.4.1", "pytest-pylint<=1.1.2", "pytest-runner<7.0.0", "termcolor<3.2.0", From 86bf4ca693106a85827d9419ae36ff2c7ac29a9a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Jul 2025 23:30:59 -0400 Subject: [PATCH 20/25] Update pylint requirement from <3.3.7 to <3.3.8 (#614) Updates the requirements on [pylint](https://github.com/pylint-dev/pylint) to permit the latest version. - [Release notes](https://github.com/pylint-dev/pylint/releases) - [Commits](https://github.com/pylint-dev/pylint/compare/pylint-version-0.18.1...v3.3.7) --- updated-dependencies: - dependency-name: pylint dependency-version: 3.3.7 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 34ad8426..b9a7217b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ Repository = "https://github.com/google/python-fire" test = [ "setuptools<=80.9.0", "pip", - "pylint<3.3.7", + "pylint<3.3.8", "pytest<=8.4.1", "pytest-pylint<=1.1.2", "pytest-runner<7.0.0", From ea8c7f5e74157c9f6bf2e251fce8ddcac81ef3d5 Mon Sep 17 00:00:00 2001 From: David Bieber Date: Sat, 19 Jul 2025 08:20:55 -0400 Subject: [PATCH 21/25] Remove unused MANIFEST --- MANIFEST.in | 1 - 1 file changed, 1 deletion(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 1aba38f6..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include LICENSE From 8ea2f631e6dc904f69ec59f645fa81eb0a3c2b8e Mon Sep 17 00:00:00 2001 From: David Bieber Date: Sat, 16 Aug 2025 16:15:49 -0400 Subject: [PATCH 22/25] Update email address --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b9a7217b..eccee91b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ description = "A library for automatically generating command line interfaces." readme = "README.md" license = {text = "Apache-2.0"} authors = [ - {name = "David Bieber", email = "dbieber@google.com"} + {name = "David Bieber", email = "david810+fire@gmail.com"} ] classifiers = [ "Development Status :: 4 - Beta", From 0b2837778776bc7be024093f7342d746826a1c38 Mon Sep 17 00:00:00 2001 From: David Bieber Date: Sat, 16 Aug 2025 16:39:17 -0400 Subject: [PATCH 23/25] Add type hints to satisfy ty (#622) --- fire/inspectutils.py | 6 +++--- fire/parser.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fire/inspectutils.py b/fire/inspectutils.py index 6dd8fd67..0a79d24b 100644 --- a/fire/inspectutils.py +++ b/fire/inspectutils.py @@ -269,12 +269,12 @@ def Info(component): try: unused_code, lineindex = inspect.findsource(component) - info['line'] = lineindex + 1 + info['line'] = lineindex + 1 # type: ignore except (TypeError, OSError): - info['line'] = None + info['line'] = None # type: ignore if 'docstring' in info: - info['docstring_info'] = docstrings.parse(info['docstring']) + info['docstring_info'] = docstrings.parse(info['docstring']) # type: ignore return info diff --git a/fire/parser.py b/fire/parser.py index b8e7f19c..1a4f7d9b 100644 --- a/fire/parser.py +++ b/fire/parser.py @@ -19,7 +19,7 @@ import sys if sys.version_info[0:2] < (3, 8): - _StrNode = ast.Str + _StrNode = ast.Str # type: ignore # deprecated but needed for Python < 3.8 else: _StrNode = ast.Constant From 27f41ac38f7c77a32d2020c9c13bbf6154065166 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 16 Aug 2025 16:55:48 -0400 Subject: [PATCH 24/25] Update hypothesis requirement from <6.136.0 to <6.137.0 (#621) Updates the requirements on [hypothesis](https://github.com/HypothesisWorks/hypothesis) to permit the latest version. - [Release notes](https://github.com/HypothesisWorks/hypothesis/releases) - [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-ruby-0.0.1...hypothesis-python-6.136.6) --- updated-dependencies: - dependency-name: hypothesis dependency-version: 6.136.6 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index eccee91b..d0bf34c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ test = [ "pytest-pylint<=1.1.2", "pytest-runner<7.0.0", "termcolor<3.2.0", - "hypothesis<6.136.0", + "hypothesis<6.137.0", "levenshtein<=0.27.1", ] From 716bbc23d7eca949fdb682172283c8d18f742cb6 Mon Sep 17 00:00:00 2001 From: David Bieber Date: Sat, 16 Aug 2025 17:26:04 -0400 Subject: [PATCH 25/25] Add Python 3.13 and 3.14 checking in build workflow (#623) * Add Python 3.13 and 3.14 checking in build workflow --- .github/workflows/build.yml | 2 +- fire/core.py | 10 ++++++++-- fire/inspectutils.py | 3 +-- fire/parser.py | 2 +- pyproject.toml | 1 + 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 75a687f3..6b9d1eae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: os: ["macos-latest", "ubuntu-latest"] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13.0-rc.2"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14.0-rc.2"] include: - {os: "ubuntu-22.04", python-version: "3.7"} diff --git a/fire/core.py b/fire/core.py index 32e0e9cc..8e23e76b 100644 --- a/fire/core.py +++ b/fire/core.py @@ -678,8 +678,14 @@ def _CallAndUpdateTrace(component, args, component_trace, treatment='class', # Call the function. if inspectutils.IsCoroutineFunction(fn): - loop = asyncio.get_event_loop() - component = loop.run_until_complete(fn(*varargs, **kwargs)) + try: + loop = asyncio.get_running_loop() + except RuntimeError: + # No event loop running, create a new one + component = asyncio.run(fn(*varargs, **kwargs)) + else: + # Event loop is already running + component = loop.run_until_complete(fn(*varargs, **kwargs)) else: component = fn(*varargs, **kwargs) diff --git a/fire/inspectutils.py b/fire/inspectutils.py index 0a79d24b..17508e30 100644 --- a/fire/inspectutils.py +++ b/fire/inspectutils.py @@ -14,7 +14,6 @@ """Inspection utility functions for Python Fire.""" -import asyncio import inspect import sys import types @@ -345,6 +344,6 @@ def GetClassAttrsDict(component): def IsCoroutineFunction(fn): try: - return asyncio.iscoroutinefunction(fn) + return inspect.iscoroutinefunction(fn) except: # pylint: disable=bare-except return False diff --git a/fire/parser.py b/fire/parser.py index 1a4f7d9b..a335cc2c 100644 --- a/fire/parser.py +++ b/fire/parser.py @@ -19,7 +19,7 @@ import sys if sys.version_info[0:2] < (3, 8): - _StrNode = ast.Str # type: ignore # deprecated but needed for Python < 3.8 + _StrNode = ast.Str # type: ignore # pylint: disable=no-member # deprecated but needed for Python < 3.8 else: _StrNode = ast.Constant diff --git a/pyproject.toml b/pyproject.toml index d0bf34c8..912c08aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Operating System :: OS Independent", "Operating System :: POSIX", "Operating System :: MacOS",