All notable changes to Python Absl are recorded here.
The format is based on Keep a Changelog.
Nothing notable unreleased.
@flagsaver.as_parsed: this allows saving/restoring flags using string values as if parsed from the command line and will also reflect other flag states after command line parsing, e.g. .present is set.logging.find_log_dir() now falls back to tempfile.gettempdir() instead of /tmp/.short_name=) to DEFINE_multi_enum_class are now correctly passed to the underlying Flag object.absl.flags.set_default function that updates the flag default for a provided FlagHolder. This parallels the absl.flags.FlagValues.set_default interface which takes a flag name.FlagHolder instance(s) in addition to flag name(s) as their first positional argument:flags.register_validatorflags.validatorflags.register_multi_flags_validatorflags.multi_flags_validatorflags.mark_flag_as_requiredflags.mark_flags_as_requiredflags.mark_flags_as_mutual_exclusiveflags.mark_bool_flags_as_mutual_exclusiveflags.declare_key_flagassertRaisesWithPredicateMatch and assertRaisesWithLiteralMatch now capture the raised Exception for further analysis when used as a context manager.flag_name arguments in the following functions is deprecated. This parameter will be renamed in a future 2.0.0 release.flags.register_validatorflags.validatorflags.register_multi_flags_validatorflags.multi_flags_validatorflags.mark_flag_as_requiredflags.mark_flags_as_requiredflags.mark_flags_as_mutual_exclusiveflags.mark_bool_flags_as_mutual_exclusiveflags.declare_key_flagTempFileCleanup.SUCCESS is used.Flag instances now raise an error if used in a bool context. This prevents the occasional mistake of testing an instance for truthiness rather than testing flag.value.absl-py no longer depends on six.absl-py no longer supports Python 2.7, 3.4, 3.5. All versions have reached end-of-life for more than a year now.vX.Y.Z instead of pypi-vX.Y.Z in the git repo going forward.--test_filter= flag, it now treats the filters as unittest's -k flag in Python 3.7+.LICENSE file is now exported in bazel.argparse_flags.ArgumentParser with argument_default= no longer raises an exception when other absl.flags flags are defined.absltest now correctly sets up test filtering and fail fast flags when an explicit argv= parameter is passed to absltest.main.app interfaces.@absltest.skipThisClass to indicate a class contains shared functionality to be used as a base class for other TestCases, and therefore should be skipped.flag_parser paramteter of run as keyword-only. This keyword-only constraint will be enforced at runtime in a future release.EnumClassSerializer and EnumClassListSerializer public.required: Optional[bool] = False parameter to DEFINE_* functions.parameterized.product: Allows testing a method over cartesian product of parameters values, specified as a sequences of values for each parameter or as kwargs-like dicts of parameter values.--test_srcdir and --test_tmpdir. Users should use absltest.TEST_SRCDIR.value and absltest.TEST_TMPDIR.value instead of FLAGS.test_srcdir and FLAGS.test_tmpdir.CsvListSerializer respect its delimiter argument.logging.fatal when logging directories cannot be found._TempDir and _TempFile now implement __fspath__ to satisfy os.PathLike--logger_levels: allows specifying the log levels of loggers.FLAGS.validate_all_flags: a new method that validates all flags and raises an exception if one fails.FLAGS.get_flags_for_module: Allows fetching the flags a module defines.parameterized.TestCase: Supports async test definitions.--pdb flag: When true, uncaught exceptions will be handled by pdb.post_mortem. This is an alias for --pdb_post_mortem.@parameterized.parameters now treats a single abc.Mapping as a single test case, consistent with named_parameters. Previously the abc.Mapping is treated as if only its keys are passed as a list of test cases. If you were relying on the old inconsistent behavior, explicitly convert the abc.Mapping to a list.DEFINE_enum_class and DEFINE_mutlti_enum_class accept a case_sensitive argument. When False (the default), strings are mapped to enum member names without case sensitivity, and member names are serialized in lowercase form. Flag definitions for enums whose members include duplicates when case is ignored must now explicitly pass case_sensitive=True.present counter now correctly reflects command line usage.TestCase.enter_context: Allows using context managers in setUp and having them automatically exited when a test finishes.logging.debug(msg, stack_info=...) no longer throws an exception in Python 3.8.absl.testing's pretty print reporter no longer buffers RUN/OK/FAILED messages.create_tempfile will overwrite pre-existing read-only files.absltest.expectedFailureIf: a variant of unittest.expectedFailure that allows a condition to be given.--incompatible_allow_python_version_transitions=true is set.bazel test --test_tag_filters=-python[23] to ignore the other version.assertTotallyOrdered no longer requires objects to implement __hash__.absltest now integrates better with --pdb_post_mortem.xml_reporter now includes timestamps to testcases, test_suite, test_suites elements.absl.logging no longer registers itself to logging.root at import time.flags.mark_bool_flags_as_mutual_exclusive: convenience function to check that only one, or at most one, flag among a set of boolean flags are True.@bazel_tools//tools/python:python_version for selecting the Python version.Enum derived class to define the allowed values for a flag.app.call_after_init: Register functions to be called after app.run() is called. Useful for program-wide initialization that library code may need.logging.log_every_n_seconds: like log_every_n, but based on elapsed time between logging calls.absltest.mock: alias to unittest.mock (PY3) for better unittest drop-in replacement. For PY2, it will be available if mock is importable.ABSLLogger.findCaller(): allow stack_info arg and return value for PY2