Skip to content

Releases: google/python-fire

Python Fire v0.7.0

01 Oct 14:23
90b7f82
Compare
Choose a tag to compare

Notable in this release:

  • This release is the first to drop Python 2 support. For Python 2 users, use <= 0.6.0.
  • CI improvements from @Borda including dependabot and an expanded build matrix

What's Changed

  • adding GH dependabot by @Borda in #432
  • Bump the pip group with 2 updates by @dependabot in #491
  • Update hypothesis requirement from <6.62.0 to <6.100.0 in /.github/scripts by @dependabot in #492
  • #444: Removed pipes dependency by @BasedDepartment1 in #447
  • Update termcolor requirement from <2.2.0 to <2.5.0 in /.github/scripts by @dependabot in #493
  • Update mock requirement from <5.0.0 to <6.0.0 in /.github/scripts by @dependabot in #495
  • Update pytest requirement from <=7.2.1 to <=8.1.1 in /.github/scripts by @dependabot in #494
  • Update pytest-runner requirement from <6.0.0 to <7.0.0 in /.github/scripts by @dependabot in #496
  • fix typo in dependabot group by @Borda in #497
  • Update setuptools requirement from <=69.1.1 to <=69.2.0 in /.github/scripts by @dependabot in #500
  • Update hypothesis requirement from <6.100.0 to <6.101.0 in /.github/scripts by @dependabot in #506
  • Update levenshtein requirement from <=0.25.0 to <=0.25.1 in /.github/scripts by @dependabot in #510
  • Use ast.Constant for recent Python versions by @wdhongtw in #526
  • Remove future imports now that we've dropped support for Python 2 by @dbieber in #539
  • remove six: Replace six.string_types and six.integer_types, etc. by @dbieber in #541
  • Remove sys.version_info checks by @dbieber in #542
  • Update setuptools requirement from <=69.2.0 to <=75.1.0 in /.github/scripts by @dependabot in #540
  • Simplify requirements.txt by assuming Python 3 by @dbieber in #543
  • Update hypothesis requirement from <6.101.0 to <6.113.0 in /.github/scripts by @dependabot in #544
  • Remove mock in favor of unittest.mock by @dbieber in #545
  • Update pytest requirement from <=8.1.1 to <=8.3.3 in /.github/scripts by @dependabot in #546
  • Update label used by dependabot by @dbieber in #547
  • Update levenshtein requirement from <=0.25.1 to <=0.26.0 in /.github/scripts by @dependabot in #548
  • Upgrade pylint version by @dbieber in #549
  • Run github action on pull_request by @dbieber in #550
  • Add current system MSYS check by @bonfy in #278
  • Remove .format in favor of f-strings by @dbieber in #551
  • Remove six from console, eliminates six entirely by @dbieber in #552
  • Move asyncio imports and update docs by @dbieber in #553
  • Include Python 3.13 in github actions by @dbieber in #554
  • Continue upgrade of codebase to Python 3 by @dbieber in #556
  • update required Python 3.7 in setup.py by @Borda in #555
  • Lint improvements and type safety by @dbieber in #558
  • ci: expand build matrix for major OS by @Borda in #490
  • Replace Python 2 type hints with real type annotations by @dbieber in #559

New Contributors

Full Changelog: v0.6.0...v0.7.0

Python Fire v0.6.0

11 Mar 19:52
343e6b6
Compare
Choose a tag to compare

This is the last release supporting Python 2. Subsequent releases will be Python 3 only. The automatically generated release notes follow.

What's Changed

New Contributors

Full Changelog: v0.5.0...v0.6.0

Python Fire v0.5.0

12 Dec 20:36
e1e95ff
Compare
Choose a tag to compare

Changelist

  • Support for custom serializers with fire.Fire(serializer=your_serializer) #345
  • Auto-generated help text now shows short arguments (e.g. -a) when appropriate #318
  • Documentation improvements (#334, #399, #372, #383, #387)
  • Default values are now shown in help for kwonly arguments #414
  • Completion script fix where previously completions might not show at all #336

Highlighted change: fire.Fire(serialize=custom_serialize_fn) #345

You can now pass a custom serialization function to fire to control how the output is serialized.

Your serialize function should accept an object as input, and may return a string as output. If it returns a string, Fire will display that string. If it returns None, Fire will display nothing. If it returns something else, Fire will use the default serialization method to convert it to text.

The default serialization remains unchanged from previous versions. Primitives and collections of primitives are serialized one item per line. Objects that define a custom __str__ function are serialized using that. Complex objects that don't define __str__ trigger their help screen rather than being serialized and displayed.

Python Fire v0.4.0

22 Jan 18:12
Compare
Choose a tag to compare

Changelist

  • Support for Python 3.8 and Python 3.9
  • Argument types and defaults appear in help text
  • Support for asyncio coroutines
  • Support for modules and Python files with python -m fire
  • Keyword argument info from rst docstrings appears in help text
  • Bug fix for missing parts of multiline argument descriptions from Google and Numpy style docstrings.
  • Packaging of enum34
  • Support functions even when they override getattr in non-standard ways. (e.g. supports BeautifulSoup)

Highlighted change: python -m fire

You can use Python Fire without ever modifying your code. To use it, first install Python Fire with pip install fire. Then simply run python -m fire path/to/yourfile.py or python -m fire path.to.yourmodule.

This is both a fast way to use Python Fire to create a CLI from your code, and a way to apply Python Fire quickly to a codebase you don't have access to.

v0.3.1

07 Apr 20:05
Compare
Choose a tag to compare

Removes preexec_fn from pager subprocess call. Resolves #236.

v0.3.0

24 Mar 17:12
Compare
Choose a tag to compare

Assorted Improvements in Python Fire v0.3.0

  • Use Fire on third-party code without making any code changes: python -m fire <module>
  • Docstring parsing fix for all lines are blank f01aad3
  • Improved parsing of numpy-style docstrings
  • #187 Expose built-in functions from the standard library (e.g. sin, cos)
  • #149 Support objects implementing __getattr__
  • #205 Fix ctrl-C handling in help screens
  • Support functools.wraps and lru_cache decorated functions
  • Better support for objects with properties
  • Objects with custom __str__ are now treated as Values. E.g. If such an object appears in a dict, the dict will still print in line-by-line mode rather than showing a help screen by default.
  • Formatting on Windows works properly now

v0.2.1

01 Aug 18:20
Compare
Choose a tag to compare

Bug fixes

  • Improves robustness of docstring parser in the face of unexpected format docstrings. #183

v0.2.0

26 Jul 17:15
Compare
Choose a tag to compare

Python Fire v0.2.0

If you're new to Python Fire:

  1. Welcome! 🎉
  2. Fire automatically generates command line interfaces from any Python object you give it. 🔥

e.g. You can call Fire on a function, as in this example (but you can also call Fire on anything else: classes, objects, dicts, etc. -- they all work.)

def hello(name="World"):
  return "Hello %s!" % name

fire.Fire(hello)
hello.py --name=David  # Hello David!

pip install fire to get started.

Improvements in v0.2.0

  • Help and usage screens
    Help screens now have a man-page appearance and are shown with less-style pagination. Usage screens are shown when a user-error is encountered. The help and usage screens are considerably cleaner than the default output in previous versions of Fire.
  • Custom serialization
    If you define a custom __str__ method on an object, that will be used to serialize the object when it is the final result of a Fire command. This means better support for numpy arrays, and better support for custom types.
  • Docstring parsing
    Notably, docstrings are parsed in order to determine the descriptions to use for arguments in the help screens. We largely support (but not fully) Google, numpy, and RST style docstrings. These are the three most common styles of docstring used in Python code.
  • Access --help naturally
    You no longer need to separate --help from your command with an extra --. Simply running command -h or command --help will give help, provided there isn't an argument named help in your component.
  • NamedTuples can be indexed both by their field names and by their indexes.
  • Callable objects can both be called, and their members can be accessed.
    You must use flag syntax to call a callable object; you cannot pass their arguments positionally.
  • Single-hyphen flags are supported
    You can now specify -flag instead of --flag if preferred. Both work.
  • Short-flags are permitted when their use is unambiguous
    E.g. if your function has argument alpha, then you can specify its value with -a.
  • Fish completion support

v0.1.3

23 Feb 18:29
Compare
Choose a tag to compare

This release has a few small improvements:

  • Do not treat arguments that start with '--' as strings [#99]
  • Fix for BinOps in args [#96]
  • six.u for Python 3 compatability in fuzz tests [#111]

And a small packaging improvement:

  • Files in PyPi archive are world readable. [#107]

v0.1.2

29 Aug 17:41
Compare
Choose a tag to compare

Improvements

  • IPython is fully optional! [#7]
    Now Fire's only dependency is six (the Python 2, 3 compatibility module) which is fairly light weight.
    If you use Fire without IPython, we call it "Fire Lite." Pun intended.
  • The command argument accepts lists [#53]
    fire.Fire's optional command argument now accepts either a sequence of arguments or a single string.
    Previously the command argument only accepted a string.
  • New mkdocs documentation
    We've started using mkdocs for documentation. The documentation is available at https://google.github.io/python-fire.
  • Packaging improvements: the license file is now included in the release.
  • Output is no longer force converted to ASCII.