Released jprops library
I've uploaded a new Python library jprops to GitHub. It reads and writes Java's .properties file format.
We were using pyjavaproperties
at work, but ran into a few limitations. One of our developers had patched it
to be able to read from a StringIO
object instead of a file
object. I had
also encountered an issue where it has extended the standard property parsing
to interpolate patterns like {var}
to expand the value of var
as a
reference to another property. This interfered with some of our properties
files that use ${var}
as a pattern recognized by our configuration system.
Since pyjavaproperties was also missing some other features like unicode
support I decided to go ahead and read over the the Java documentation of
the file format and build a new cleanroom implementation. I have a decent
set of unit tests
and I think this implementation should cover all of the features documented in
the spec. It has full support for reading and writing unicode values, though it
it will return Python str
objects by default when your key or value contains
only ASCII. This was more convenient, but I may revisit that to always return
unicode
or have a switch for that behavior.
So, if you need to work with Java .properties files from Python, just
pip install jprops
and check out the docs.
If it's missing something let me know.