commit | b7f621c5ab8827bc20feb7ac13ae746c19b78c9f | [log] [tgz] |
---|---|---|
author | Richard Levasseur <rlevasseur@google.com> | Thu May 31 13:06:49 2018 -0700 |
committer | Copybara-Service <copybara-piper@google.com> | Thu May 31 13:07:03 2018 -0700 |
tree | 1c99142c8407708e9204a01757ca7014148d1d46 | |
parent | 7edfc4cb6f83d23b3a7031e9489cae024552bd4c [diff] |
Allow unicode strings in flag help when used with --helpfull. Previously, the full help output was gotten by calling str(FLAGS), which did two things: invoke FLAGS.__str__, which returned a unicode object, and then make str() try to coerce the unicode object to a byte string, which only worked if the default encoding and text were compatible. Rather than coerce the object to a string, just call the get_help() method directly (which is what FLAGS.__str__ invokes). This avoids any coercion behaviors. Whether the unicode text can be printed is still subject to the output stream's encoding, but thats outside absl's purview: users should configure their environment to be compatible with unicode as appropriate. NOTE: One oddity of unicode support with flags is that the default value for a flag doesn't get printed quite correctly due to repr() being called on the unicode value: this results in an escaped unicode string (u'\uxxx') up in the help output instead of the value as expected to be passed on the command line. That's pre-existing, doesn't break anything, and out of scope. * Also improves the error messages of failed app_test helper invocations. PiperOrigin-RevId: 198766828
This repository is a collection of Python library code for building Python applications. The code is collected from Google's own Python code base, and has been extensively tested and used in production.
To install the package, simply run:
pip install absl-py
Or install from source:
python setup.py install
To run Abseil tests, you can clone the git repo and run bazel:
git clone git@github.com:abseil/abseil-py.git cd abseil-py bazel test absl/...
Please refer to smoke_tests/sample_app.py as an example to get started.
Full documentation is forthcoming on https://abseil.io. For now, please refer to the in-code Python docstrings.
The current repository includes an initial set of libraries for early adoption. More components and interoperability with Abseil C++ Common Libraries will come in future releases.
The Abseil Python library is licensed under the terms of the Apache license. See LICENSE for more information.