Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-fire for openSUSE:Factory checked in at 2025-09-17 17:06:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-fire (Old) and /work/SRC/openSUSE:Factory/.python-fire.new.27445 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-fire" Wed Sep 17 17:06:53 2025 rev:15 rq:1305411 version:0.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-fire/python-fire.changes 2025-06-17 18:23:35.365717824 +0200 +++ /work/SRC/openSUSE:Factory/.python-fire.new.27445/python-fire.changes 2025-09-17 17:06:54.816332343 +0200 @@ -1,0 +2,12 @@ +Wed Sep 17 12:04:56 UTC 2025 - John Paul Adrian Glaubitz <[email protected]> + +- Update to 0.7.1 + * Use Neutral theme for IPython Inspector, supporting newer IPython + versions in #588 + * Call inspectutils.GetClassAttrsDict on component, not None in #606 + * Move to pyproject.toml, adding wheel support in pypi + * Use ty in place of pytype + * Update requirements @dependabot[bot] +- Use Python 3.11 on SLE-15 by default + +------------------------------------------------------------------- Old: ---- fire-0.7.0.tar.gz New: ---- fire-0.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-fire.spec ++++++ --- /var/tmp/diff_new_pack.YTM0yk/_old 2025-09-17 17:06:55.856375853 +0200 +++ /var/tmp/diff_new_pack.YTM0yk/_new 2025-09-17 17:06:55.860376021 +0200 @@ -15,9 +15,9 @@ # Please submit bugfixes or comments via https://bugs.opensuse.org/ # - +%{?sle15_python_module_pythons} Name: python-fire -Version: 0.7.0 +Version: 0.7.1 Release: 0 Summary: A library for automatically generating command line interfaces License: Apache-2.0 ++++++ fire-0.7.0.tar.gz -> fire-0.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/MANIFEST.in new/fire-0.7.1/MANIFEST.in --- old/fire-0.7.0/MANIFEST.in 2022-04-16 18:23:34.000000000 +0200 +++ new/fire-0.7.1/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -include LICENSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/PKG-INFO new/fire-0.7.1/PKG-INFO --- old/fire-0.7.0/PKG-INFO 2024-10-01 16:20:58.646412100 +0200 +++ new/fire-0.7.1/PKG-INFO 2025-08-16 22:15:56.592162000 +0200 @@ -1,16 +1,15 @@ -Metadata-Version: 2.1 +Metadata-Version: 2.4 Name: fire -Version: 0.7.0 +Version: 0.7.1 Summary: A library for automatically generating command line interfaces. -Home-page: https://github.com/google/python-fire -Author: David Bieber -Author-email: [email protected] -License: Apache Software License -Keywords: command line interface cli python fire interactive bash tool +Author-email: David Bieber <[email protected]> +License: Apache-2.0 +Project-URL: Homepage, https://github.com/google/python-fire +Project-URL: Repository, https://github.com/google/python-fire +Keywords: command,line,interface,cli,python,fire,interactive,bash,tool Classifier: Development Status :: 4 - Beta Classifier: Intended Audience :: Developers Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: License :: OSI Approved :: Apache Software License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.7 @@ -24,12 +23,137 @@ Classifier: Operating System :: POSIX Classifier: Operating System :: MacOS Classifier: Operating System :: Unix +Requires-Python: >=3.7 +Description-Content-Type: text/markdown License-File: LICENSE Requires-Dist: termcolor +Provides-Extra: test +Requires-Dist: setuptools<=80.9.0; extra == "test" +Requires-Dist: pip; extra == "test" +Requires-Dist: pylint<3.3.8; extra == "test" +Requires-Dist: pytest<=8.4.1; extra == "test" +Requires-Dist: pytest-pylint<=1.1.2; extra == "test" +Requires-Dist: pytest-runner<7.0.0; extra == "test" +Requires-Dist: termcolor<3.2.0; extra == "test" +Requires-Dist: hypothesis<6.136.0; extra == "test" +Requires-Dist: levenshtein<=0.27.1; extra == "test" +Dynamic: license-file -Python Fire is a library for automatically generating command line interfaces -(CLIs) with a single line of code. +# Python Fire [](https://github.com/google/python-fire) -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. +_Python Fire is a library for automatically generating command line interfaces +(CLIs) from absolutely any Python object._ + +- Python Fire is a simple way to create a CLI in Python. + [[1]](docs/benefits.md#simple-cli) +- Python Fire is a helpful tool for developing and debugging Python code. + [[2]](docs/benefits.md#debugging) +- Python Fire helps with exploring existing code or turning other people's + code into a CLI. [[3]](docs/benefits.md#exploring) +- Python Fire makes transitioning between Bash and Python easier. + [[4]](docs/benefits.md#bash) +- Python Fire makes using a Python REPL easier by setting up the REPL with the + modules and variables you'll need already imported and created. + [[5]](docs/benefits.md#repl) + +## Installation + +To install Python Fire with pip, run: `pip install fire` + +To install Python Fire with conda, run: `conda install fire -c conda-forge` + +To install Python Fire from source, first clone the repository and then run: +`python setup.py install` + +## Basic Usage + +You can call `Fire` on any Python object:<br> +functions, classes, modules, objects, dictionaries, lists, tuples, etc. +They all work! + +Here's an example of calling Fire on a function. + +```python +import fire + +def hello(name="World"): + return "Hello %s!" % name + +if __name__ == '__main__': + fire.Fire(hello) +``` + +Then, from the command line, you can run: + +```bash +python hello.py # Hello World! +python hello.py --name=David # Hello David! +python hello.py --help # Shows usage information. +``` + +Here's an example of calling Fire on a class. + +```python +import fire + +class Calculator(object): + """A simple calculator class.""" + + def double(self, number): + return 2 * number + +if __name__ == '__main__': + fire.Fire(Calculator) +``` + +Then, from the command line, you can run: + +```bash +python calculator.py double 10 # 20 +python calculator.py double --number=15 # 30 +``` + +To learn how Fire behaves on functions, objects, dicts, lists, etc, and to learn +about Fire's other features, see the [Using a Fire CLI page](docs/using-cli.md). + +For additional examples, see [The Python Fire Guide](docs/guide.md). + +## Why is it called Fire? + +When you call `Fire`, it fires off (executes) your command. + +## Where can I learn more? + +Please see [The Python Fire Guide](docs/guide.md). + +## Reference + +| Setup | Command | Notes +| :------ | :------------------ | :--------- +| install | `pip install fire` | + +| Creating a CLI | Command | Notes +| :--------------| :--------------------- | :--------- +| import | `import fire` | +| Call | `fire.Fire()` | Turns the current module into a Fire CLI. +| Call | `fire.Fire(component)` | Turns `component` into a Fire CLI. + +| Using a CLI | Command | Notes +| :---------------------------------------------- | :-------------------------------------- | :---- +| [Help](docs/using-cli.md#help-flag) | `command --help` or `command -- --help` | +| [REPL](docs/using-cli.md#interactive-flag) | `command -- --interactive` | Enters interactive mode. +| [Separator](docs/using-cli.md#separator-flag) | `command -- --separator=X` | Sets the separator to `X`. The default separator is `-`. +| [Completion](docs/using-cli.md#completion-flag) | `command -- --completion [shell]` | Generates a completion script for the CLI. +| [Trace](docs/using-cli.md#trace-flag) | `command -- --trace` | Gets a Fire trace for the command. +| [Verbose](docs/using-cli.md#verbose-flag) | `command -- --verbose` | + +_Note that these flags are separated from the Fire command by an isolated `--`._ + +## License + +Licensed under the +[Apache 2.0](https://github.com/google/python-fire/blob/master/LICENSE) License. + +## Disclaimer + +This is not an official Google product. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/__init__.py new/fire-0.7.1/fire/__init__.py --- old/fire-0.7.0/fire/__init__.py 2024-09-21 17:12:19.000000000 +0200 +++ new/fire-0.7.1/fire/__init__.py 2025-07-19 03:24:32.000000000 +0200 @@ -17,4 +17,4 @@ from fire.core import Fire __all__ = ['Fire'] -__version__ = '0.7.0' +__version__ = '0.7.1' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/__main__.py new/fire-0.7.1/fire/__main__.py --- old/fire-0.7.0/fire/__main__.py 2024-09-21 17:12:19.000000000 +0200 +++ new/fire-0.7.1/fire/__main__.py 2025-07-19 14:20:32.000000000 +0200 @@ -60,11 +60,11 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/completion.py new/fire-0.7.1/fire/completion.py --- old/fire-0.7.0/fire/completion.py 2024-09-21 16:58:23.000000000 +0200 +++ new/fire-0.7.1/fire/completion.py 2025-06-01 16:54:12.000000000 +0200 @@ -321,7 +321,7 @@ 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/console/README.md new/fire-0.7.1/fire/console/README.md --- old/fire-0.7.0/fire/console/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/fire-0.7.1/fire/console/README.md 2023-03-18 19:01:05.000000000 +0100 @@ -0,0 +1,3 @@ +This is the console package from googlecloudsdk, as used by Python Fire. +Python Fire does not accept pull requests modifying the console package; rather, +changes to console should go through the upstream project googlecloudsdk. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/console/console_attr_os.py new/fire-0.7.1/fire/console/console_attr_os.py --- old/fire-0.7.0/fire/console/console_attr_os.py 2023-02-13 20:23:51.000000000 +0100 +++ new/fire-0.7.1/fire/console/console_attr_os.py 2025-07-19 14:20:32.000000000 +0200 @@ -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 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/console/encoding.py new/fire-0.7.1/fire/console/encoding.py --- old/fire-0.7.0/fire/console/encoding.py 2024-09-22 18:01:27.000000000 +0200 +++ new/fire-0.7.1/fire/console/encoding.py 2025-07-19 14:20:32.000000000 +0200 @@ -67,7 +67,7 @@ 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 @@ # 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 @@ # 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 @@ # 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/core.py new/fire-0.7.1/fire/core.py --- old/fire-0.7.0/fire/core.py 2024-09-21 17:12:19.000000000 +0200 +++ new/fire-0.7.1/fire/core.py 2025-07-19 14:20:32.000000000 +0200 @@ -504,7 +504,7 @@ # 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 @@ # 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/core_test.py new/fire-0.7.1/fire/core_test.py --- old/fire-0.7.0/fire/core_test.py 2024-09-20 03:37:12.000000000 +0200 +++ new/fire-0.7.1/fire/core_test.py 2025-07-19 14:20:32.000000000 +0200 @@ -215,12 +215,12 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/custom_descriptions.py new/fire-0.7.1/fire/custom_descriptions.py --- old/fire-0.7.0/fire/custom_descriptions.py 2024-09-20 02:57:43.000000000 +0200 +++ new/fire-0.7.1/fire/custom_descriptions.py 2025-07-19 14:20:32.000000000 +0200 @@ -131,14 +131,14 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/decorators.py new/fire-0.7.1/fire/decorators.py --- old/fire-0.7.0/fire/decorators.py 2024-10-01 16:18:11.000000000 +0200 +++ new/fire-0.7.1/fire/decorators.py 2025-07-19 14:20:32.000000000 +0200 @@ -68,7 +68,7 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/docstrings.py new/fire-0.7.1/fire/docstrings.py --- old/fire-0.7.0/fire/docstrings.py 2024-09-20 02:25:11.000000000 +0200 +++ new/fire-0.7.1/fire/docstrings.py 2025-07-19 14:20:32.000000000 +0200 @@ -436,7 +436,7 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/formatting_windows.py new/fire-0.7.1/fire/formatting_windows.py --- old/fire-0.7.0/fire/formatting_windows.py 2024-09-22 18:01:27.000000000 +0200 +++ new/fire-0.7.1/fire/formatting_windows.py 2025-07-19 14:20:32.000000000 +0200 @@ -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 @@ # 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/helptext.py new/fire-0.7.1/fire/helptext.py --- old/fire-0.7.0/fire/helptext.py 2024-09-22 18:01:27.000000000 +0200 +++ new/fire-0.7.1/fire/helptext.py 2025-07-19 14:20:32.000000000 +0200 @@ -29,6 +29,8 @@ information. """ +from __future__ import annotations + import collections import itertools @@ -85,13 +87,14 @@ + 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 _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 @@ 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 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/helptext_test.py new/fire-0.7.1/fire/helptext_test.py --- old/fire-0.7.0/fire/helptext_test.py 2024-09-22 18:01:27.000000000 +0200 +++ new/fire-0.7.1/fire/helptext_test.py 2025-07-19 14:20:32.000000000 +0200 @@ -125,7 +125,7 @@ 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 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 @@ 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 @@ 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 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/inspectutils.py new/fire-0.7.1/fire/inspectutils.py --- old/fire-0.7.0/fire/inspectutils.py 2024-09-21 17:12:19.000000000 +0200 +++ new/fire-0.7.1/fire/inspectutils.py 2025-07-19 14:20:32.000000000 +0200 @@ -100,9 +100,9 @@ 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 @@ 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 @@ return inspect.FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwdefaults, annotations) # pylint: enable=no-member - # pytype: enable=module-attr def GetFullArgSpec(fn): @@ -256,7 +255,10 @@ """ 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() # type: ignore info = inspector.info(component) # IPython's oinspect.Inspector.info may return '<no docstring>' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/main_test.py new/fire-0.7.1/fire/main_test.py --- old/fire-0.7.0/fire/main_test.py 2024-09-21 17:12:19.000000000 +0200 +++ new/fire-0.7.1/fire/main_test.py 2025-07-19 14:20:32.000000000 +0200 @@ -78,7 +78,7 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/parser.py new/fire-0.7.1/fire/parser.py --- old/fire-0.7.0/fire/parser.py 2024-09-20 03:09:42.000000000 +0200 +++ new/fire-0.7.1/fire/parser.py 2025-07-19 14:20:32.000000000 +0200 @@ -96,7 +96,7 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire/trace.py new/fire-0.7.1/fire/trace.py --- old/fire-0.7.0/fire/trace.py 2024-09-22 18:01:27.000000000 +0200 +++ new/fire-0.7.1/fire/trace.py 2025-07-19 14:20:32.000000000 +0200 @@ -62,9 +62,7 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire.egg-info/PKG-INFO new/fire-0.7.1/fire.egg-info/PKG-INFO --- old/fire-0.7.0/fire.egg-info/PKG-INFO 2024-10-01 16:20:58.000000000 +0200 +++ new/fire-0.7.1/fire.egg-info/PKG-INFO 2025-08-16 22:15:56.000000000 +0200 @@ -1,16 +1,15 @@ -Metadata-Version: 2.1 +Metadata-Version: 2.4 Name: fire -Version: 0.7.0 +Version: 0.7.1 Summary: A library for automatically generating command line interfaces. -Home-page: https://github.com/google/python-fire -Author: David Bieber -Author-email: [email protected] -License: Apache Software License -Keywords: command line interface cli python fire interactive bash tool +Author-email: David Bieber <[email protected]> +License: Apache-2.0 +Project-URL: Homepage, https://github.com/google/python-fire +Project-URL: Repository, https://github.com/google/python-fire +Keywords: command,line,interface,cli,python,fire,interactive,bash,tool Classifier: Development Status :: 4 - Beta Classifier: Intended Audience :: Developers Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: License :: OSI Approved :: Apache Software License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.7 @@ -24,12 +23,137 @@ Classifier: Operating System :: POSIX Classifier: Operating System :: MacOS Classifier: Operating System :: Unix +Requires-Python: >=3.7 +Description-Content-Type: text/markdown License-File: LICENSE Requires-Dist: termcolor +Provides-Extra: test +Requires-Dist: setuptools<=80.9.0; extra == "test" +Requires-Dist: pip; extra == "test" +Requires-Dist: pylint<3.3.8; extra == "test" +Requires-Dist: pytest<=8.4.1; extra == "test" +Requires-Dist: pytest-pylint<=1.1.2; extra == "test" +Requires-Dist: pytest-runner<7.0.0; extra == "test" +Requires-Dist: termcolor<3.2.0; extra == "test" +Requires-Dist: hypothesis<6.136.0; extra == "test" +Requires-Dist: levenshtein<=0.27.1; extra == "test" +Dynamic: license-file -Python Fire is a library for automatically generating command line interfaces -(CLIs) with a single line of code. +# Python Fire [](https://github.com/google/python-fire) -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. +_Python Fire is a library for automatically generating command line interfaces +(CLIs) from absolutely any Python object._ + +- Python Fire is a simple way to create a CLI in Python. + [[1]](docs/benefits.md#simple-cli) +- Python Fire is a helpful tool for developing and debugging Python code. + [[2]](docs/benefits.md#debugging) +- Python Fire helps with exploring existing code or turning other people's + code into a CLI. [[3]](docs/benefits.md#exploring) +- Python Fire makes transitioning between Bash and Python easier. + [[4]](docs/benefits.md#bash) +- Python Fire makes using a Python REPL easier by setting up the REPL with the + modules and variables you'll need already imported and created. + [[5]](docs/benefits.md#repl) + +## Installation + +To install Python Fire with pip, run: `pip install fire` + +To install Python Fire with conda, run: `conda install fire -c conda-forge` + +To install Python Fire from source, first clone the repository and then run: +`python setup.py install` + +## Basic Usage + +You can call `Fire` on any Python object:<br> +functions, classes, modules, objects, dictionaries, lists, tuples, etc. +They all work! + +Here's an example of calling Fire on a function. + +```python +import fire + +def hello(name="World"): + return "Hello %s!" % name + +if __name__ == '__main__': + fire.Fire(hello) +``` + +Then, from the command line, you can run: + +```bash +python hello.py # Hello World! +python hello.py --name=David # Hello David! +python hello.py --help # Shows usage information. +``` + +Here's an example of calling Fire on a class. + +```python +import fire + +class Calculator(object): + """A simple calculator class.""" + + def double(self, number): + return 2 * number + +if __name__ == '__main__': + fire.Fire(Calculator) +``` + +Then, from the command line, you can run: + +```bash +python calculator.py double 10 # 20 +python calculator.py double --number=15 # 30 +``` + +To learn how Fire behaves on functions, objects, dicts, lists, etc, and to learn +about Fire's other features, see the [Using a Fire CLI page](docs/using-cli.md). + +For additional examples, see [The Python Fire Guide](docs/guide.md). + +## Why is it called Fire? + +When you call `Fire`, it fires off (executes) your command. + +## Where can I learn more? + +Please see [The Python Fire Guide](docs/guide.md). + +## Reference + +| Setup | Command | Notes +| :------ | :------------------ | :--------- +| install | `pip install fire` | + +| Creating a CLI | Command | Notes +| :--------------| :--------------------- | :--------- +| import | `import fire` | +| Call | `fire.Fire()` | Turns the current module into a Fire CLI. +| Call | `fire.Fire(component)` | Turns `component` into a Fire CLI. + +| Using a CLI | Command | Notes +| :---------------------------------------------- | :-------------------------------------- | :---- +| [Help](docs/using-cli.md#help-flag) | `command --help` or `command -- --help` | +| [REPL](docs/using-cli.md#interactive-flag) | `command -- --interactive` | Enters interactive mode. +| [Separator](docs/using-cli.md#separator-flag) | `command -- --separator=X` | Sets the separator to `X`. The default separator is `-`. +| [Completion](docs/using-cli.md#completion-flag) | `command -- --completion [shell]` | Generates a completion script for the CLI. +| [Trace](docs/using-cli.md#trace-flag) | `command -- --trace` | Gets a Fire trace for the command. +| [Verbose](docs/using-cli.md#verbose-flag) | `command -- --verbose` | + +_Note that these flags are separated from the Fire command by an isolated `--`._ + +## License + +Licensed under the +[Apache 2.0](https://github.com/google/python-fire/blob/master/LICENSE) License. + +## Disclaimer + +This is not an official Google product. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire.egg-info/SOURCES.txt new/fire-0.7.1/fire.egg-info/SOURCES.txt --- old/fire-0.7.0/fire.egg-info/SOURCES.txt 2024-10-01 16:20:58.000000000 +0200 +++ new/fire-0.7.1/fire.egg-info/SOURCES.txt 2025-08-16 22:15:56.000000000 +0200 @@ -1,8 +1,6 @@ LICENSE -MANIFEST.in README.md -setup.cfg -setup.py +pyproject.toml fire/__init__.py fire/__main__.py fire/completion.py @@ -45,6 +43,7 @@ fire.egg-info/dependency_links.txt fire.egg-info/requires.txt fire.egg-info/top_level.txt +fire/console/README.md fire/console/__init__.py fire/console/console_attr.py fire/console/console_attr_os.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/fire.egg-info/requires.txt new/fire-0.7.1/fire.egg-info/requires.txt --- old/fire-0.7.0/fire.egg-info/requires.txt 2024-10-01 16:20:58.000000000 +0200 +++ new/fire-0.7.1/fire.egg-info/requires.txt 2025-08-16 22:15:56.000000000 +0200 @@ -1 +1,12 @@ termcolor + +[test] +setuptools<=80.9.0 +pip +pylint<3.3.8 +pytest<=8.4.1 +pytest-pylint<=1.1.2 +pytest-runner<7.0.0 +termcolor<3.2.0 +hypothesis<6.136.0 +levenshtein<=0.27.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/pyproject.toml new/fire-0.7.1/pyproject.toml --- old/fire-0.7.0/pyproject.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/fire-0.7.1/pyproject.toml 2025-08-16 22:15:40.000000000 +0200 @@ -0,0 +1,65 @@ +[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 = "[email protected]"} +] +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.8", + "pytest<=8.4.1", + "pytest-pylint<=1.1.2", + "pytest-runner<7.0.0", + "termcolor<3.2.0", + "hypothesis<6.136.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" +] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/setup.cfg new/fire-0.7.1/setup.cfg --- old/fire-0.7.0/setup.cfg 2024-10-01 16:20:58.646703200 +0200 +++ new/fire-0.7.1/setup.cfg 2025-08-16 22:15:56.592506200 +0200 @@ -1,14 +1,3 @@ -[aliases] -test = pytest - -[tool:pytest] -addopts = --ignore=fire/test_components_py3.py - --ignore=fire/parser_fuzz_test.py - -[pytype] -inputs = . -output = .pytype - [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fire-0.7.0/setup.py new/fire-0.7.1/setup.py --- old/fire-0.7.0/setup.py 2024-09-21 17:12:19.000000000 +0200 +++ new/fire-0.7.1/setup.py 1970-01-01 01:00:00.000000000 +0100 @@ -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.0' -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='[email protected]', - 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, -)
