{ "info": { "author": "Tilman Blumenbach", "author_email": "tilman+pypi@ax86.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Topic :: Software Development" ], "description": "jProperties for Python |pypi-badge|\n=====================================\n\njProperties is a Java Property file parser and writer for Python. It aims to provide the same functionality\nas `Java's Properties class `_, although\ncurrently the XML property format is not supported.\n\n.. sectnum::\n.. contents:: **Table of Contents**\n\nInstallation\n------------\n\nYou can install jProperties using `pip `_::\n\n pip install jproperties\n\nOverview\n--------\n\nObjects of the type ``Properties`` can be used like a Python dictionary (but see Caveats_ below).\nThe ``load()`` method populates the object by parsing input in the Java Property file format; the ``store()``\nmethod writes the key-value pairs stored in the object to a stream in the same format.\n\nThe ``load()`` and ``store()`` methods both take an ``encoding`` parameter. By default this is set to\n``iso-8859-1``, but it can be set to any encoding supported by Python, including e. g. the widely used\n``utf-8``.\n\nParsing a property file\n+++++++++++++++++++++++\n\n.. code:: python\n\n from jproperties import Properties\n\n p = Properties()\n with open(\"foobar.properties\", \"rb\") as f:\n p.load(f, \"utf-8\")\n\nThat's it, ``p`` now can be used like a dictionary containing properties from ``foobar.properties``.\n\nWriting a property file\n+++++++++++++++++++++++\n\n.. code:: python\n\n from jproperties import Properties\n\n p = Properties()\n p[\"foobar\"] = \"A very important message from our sponsors: Python is great!\"\n\n with open(\"foobar.properties\", \"wb\") as f:\n p.store(f, encoding=\"utf-8\")\n\nReading from and writing to the same file-like object\n+++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n.. code:: python\n\n from jproperties import Properties\n\n with open(\"foobar.properties\", \"r+b\") as f:\n p = Properties()\n p.load(f, \"utf-8\")\n\n # Do stuff with the p object...\n\n f.truncate(0)\n p.store(f, encoding=\"utf-8\")\n\nSpecial features\n----------------\n\nMetadata\n++++++++\n\nThe property file parser supports including programmatically readable and settable metadata in property files.\nMetadata for a key is represented as a Python dictionary; the keys and values of this dictionary should be strings,\nalthough when the property file is written, all non-string objects will be converted to strings. **This is a\none-way conversion**; when the metadata is read back again during a ``load()``, all keys and values will be treated\nas simple strings.\n\nBy default, the ``store()`` method does not write out the metadata. To enable that feature, set the keyword argument\n``strip_meta=False`` when calling the method.\n\nNote that metadata support is always enabled. The only thing that is optional is actually writing out the metadata.\n\nMetadata keys beginning with two underscores (``__``) are not written to the output stream by the ``store()`` method.\nThus, they can be used to attach \"runtime-only\" metadata to properties. Currently, however, metadata with such keys is\nstill read from the input stream by ``load()``; this should probably be considered erroneous behaviour.\n\nCaveats\n^^^^^^^\n\nMetadata support influences how ``Properties`` objects are used as dictionary objects:\n\n- To set a value for a key, do ``prop_object[key] = value`` or ``prop_object[key] = value, metadata``. The first form\n will leave the key's metadata unchanged. You can also use the ``setmeta()`` method to set a key's metadata.\n- To get the value of a key, do ``value, metadata = prop_object[key]``. If there is no metadata for a key,\n ``metadata`` will be an empty dictionary. To retrieve only the metadata for a key, the ``getmeta()`` method can\n be used.\n- When used as an iterator, ``Properties`` objects will simply return all keys in an unspecified order. No metadata is\n returned (but can be retrieved using ``getmeta()``).\n\nSetting defaults\n++++++++++++++++\n\nThe internal dictionary holding the key-value pairs can be accessed using the ``properties`` property. Deleting that\nproperty deletes all key-value pairs from the object.\n\nHowever, modifying properties using this special property will **not** modify metadata in any way. That means that\ndeleting properties by doing ``del prop_obj.properties[key]`` will not remove the associated metadata from the object.\nInstead, do ``del prop_obj[key]``.\n\nThe ``properties`` property is nevertheless useful to set many default values before parsing a property file:\n\n.. code:: python\n\n from jproperties import Properties\n\n prop_obj = Properties()\n prop_obj.properties = a_big_dictionary_with_defaults\n file_obj = codecs.open(\"foobar.properties\", \"rb\", \"iso-8859-1\")\n prop_obj.load(file_obj, encoding=None)\n\nVersion history\n---------------\n\nVersion 2.0.0\n+++++++++++++\n\n- **Python 3 support!** Thanks to @tboz203, who did a lot of the work. (#1)\n- Drop support for Python 2.6.\n\nVersion 1.0.1\n+++++++++++++\n\n- This is the first \"proper\" PyPI release, with proper PyPI metadata and proper PyPI distributions.\n Nothing else has changed.\n\nVersion 1.0\n+++++++++++\n\n- Initial release\n\n\n..\n NB: Without a trailing question mark in the following image URL, the\n generated HTML will contain an element instead of an \n element, which apparently cannot be made into a link (i. e. a\n \"clickable\" image).\n.. |pypi-badge| image:: https://img.shields.io/pypi/v/jproperties.svg?\n :align: middle\n :target: https://pypi.python.org/pypi/jproperties\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/Tblue/python-jproperties/archive/v2.0.0.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Tblue/python-jproperties", "keywords": "java property properties file parser reader writer", "license": "BSD 3-Clause License; partially licensed under the Python Software Foundation License", "maintainer": "", "maintainer_email": "", "name": "jproperties", "package_url": "https://pypi.org/project/jproperties/", "platform": "", "project_url": "https://pypi.org/project/jproperties/", "project_urls": { "Download": "https://github.com/Tblue/python-jproperties/archive/v2.0.0.tar.gz", "Homepage": "https://github.com/Tblue/python-jproperties" }, "release_url": "https://pypi.org/project/jproperties/2.0.0/", "requires_dist": [ "six (~=1.10)" ], "requires_python": "", "summary": "Java Property file parser and writer for Python", "version": "2.0.0" }, "last_serial": 4739201, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "bdefdf3c191bd369642ff966064abb35", "sha256": "f51d9c0875ae4602930f18e198c69ce2bd1d7008a71f7628316abec56e73db83" }, "downloads": -1, "filename": "jproperties-1.0.1-py2-none-any.whl", "has_sig": true, "md5_digest": "bdefdf3c191bd369642ff966064abb35", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 16551, "upload_time": "2015-12-23T19:04:38", "url": "https://files.pythonhosted.org/packages/c1/ae/4d682c901b9e6b8ead960ffd82c514123fa3f39a9689f85626f27ba3d937/jproperties-1.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "47916fa9def818178dfab2abd8134d04", "sha256": "327e14082653a4f2212ff81a96fbf141382f727f421e8afc933bf56ff7c010f4" }, "downloads": -1, "filename": "jproperties-1.0.1.tar.gz", "has_sig": true, "md5_digest": "47916fa9def818178dfab2abd8134d04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16484, "upload_time": "2015-12-23T19:04:50", "url": "https://files.pythonhosted.org/packages/b8/a8/bc4c49c2d2d79f0e67e7f0ca2a945b847aade3e2776541281a21c19acae1/jproperties-1.0.1.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "70c42fd1083cf266fc0a8e7d311ec8f1", "sha256": "4e297b3f221ce81370f0ff3224d18872cd1ceb45d1833a26d127505ca9082220" }, "downloads": -1, "filename": "jproperties-2.0.0-py2-none-any.whl", "has_sig": true, "md5_digest": "70c42fd1083cf266fc0a8e7d311ec8f1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 18114, "upload_time": "2019-01-24T22:31:32", "url": "https://files.pythonhosted.org/packages/67/c3/bcbc07932e291dbd30ad6ad493b485b8deff560b1ec323b4645dae5bce85/jproperties-2.0.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "da03cdd2167792c075975209773237d7", "sha256": "e1b1fd274e8c99cf393cb957b8b8ad7e67cb14d6022d7653e0709d8bc7437d65" }, "downloads": -1, "filename": "jproperties-2.0.0-py3-none-any.whl", "has_sig": true, "md5_digest": "da03cdd2167792c075975209773237d7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17035, "upload_time": "2019-01-24T22:31:34", "url": "https://files.pythonhosted.org/packages/8a/f4/30e0414495acf4b4224d948edb035d7fcde72afad36207f10c8055918aa6/jproperties-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b2a03441e66eef716a93d56d8f3d4344", "sha256": "b6709652f5c602e5271f519cf14cb9bf5d5a101df06e6c1d300123477a239588" }, "downloads": -1, "filename": "jproperties-2.0.0.tar.gz", "has_sig": true, "md5_digest": "b2a03441e66eef716a93d56d8f3d4344", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19610, "upload_time": "2019-01-25T09:21:33", "url": "https://files.pythonhosted.org/packages/9b/21/1d93419d3e9e368bb86933882e446191fc55ff890e6c39b6e25e6ad1b93b/jproperties-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "70c42fd1083cf266fc0a8e7d311ec8f1", "sha256": "4e297b3f221ce81370f0ff3224d18872cd1ceb45d1833a26d127505ca9082220" }, "downloads": -1, "filename": "jproperties-2.0.0-py2-none-any.whl", "has_sig": true, "md5_digest": "70c42fd1083cf266fc0a8e7d311ec8f1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 18114, "upload_time": "2019-01-24T22:31:32", "url": "https://files.pythonhosted.org/packages/67/c3/bcbc07932e291dbd30ad6ad493b485b8deff560b1ec323b4645dae5bce85/jproperties-2.0.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "da03cdd2167792c075975209773237d7", "sha256": "e1b1fd274e8c99cf393cb957b8b8ad7e67cb14d6022d7653e0709d8bc7437d65" }, "downloads": -1, "filename": "jproperties-2.0.0-py3-none-any.whl", "has_sig": true, "md5_digest": "da03cdd2167792c075975209773237d7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17035, "upload_time": "2019-01-24T22:31:34", "url": "https://files.pythonhosted.org/packages/8a/f4/30e0414495acf4b4224d948edb035d7fcde72afad36207f10c8055918aa6/jproperties-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b2a03441e66eef716a93d56d8f3d4344", "sha256": "b6709652f5c602e5271f519cf14cb9bf5d5a101df06e6c1d300123477a239588" }, "downloads": -1, "filename": "jproperties-2.0.0.tar.gz", "has_sig": true, "md5_digest": "b2a03441e66eef716a93d56d8f3d4344", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19610, "upload_time": "2019-01-25T09:21:33", "url": "https://files.pythonhosted.org/packages/9b/21/1d93419d3e9e368bb86933882e446191fc55ff890e6c39b6e25e6ad1b93b/jproperties-2.0.0.tar.gz" } ] }