METADATA 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. Metadata-Version: 2.1
  2. Name: configparser
  3. Version: 4.0.2
  4. Summary: Updated configparser from Python 3.7 for Python 2.6+.
  5. Home-page: https://github.com/jaraco/configparser/
  6. Author: Łukasz Langa
  7. Author-email: lukasz@langa.pl
  8. Maintainer: Jason R. Coombs
  9. Maintainer-email: jaraco@jaraco.com
  10. License: UNKNOWN
  11. Keywords: configparser ini parsing conf cfg configuration file
  12. Platform: any
  13. Classifier: Development Status :: 5 - Production/Stable
  14. Classifier: Intended Audience :: Developers
  15. Classifier: License :: OSI Approved :: MIT License
  16. Classifier: Programming Language :: Python :: 2.7
  17. Classifier: Programming Language :: Python :: 3
  18. Requires-Python: >=2.6
  19. Provides-Extra: docs
  20. Requires-Dist: sphinx ; extra == 'docs'
  21. Requires-Dist: jaraco.packaging (>=3.2) ; extra == 'docs'
  22. Requires-Dist: rst.linker (>=1.9) ; extra == 'docs'
  23. Provides-Extra: testing
  24. Requires-Dist: pytest (!=3.7.3,>=3.5) ; extra == 'testing'
  25. Requires-Dist: pytest-checkdocs (>=1.2) ; extra == 'testing'
  26. Requires-Dist: pytest-flake8 ; extra == 'testing'
  27. Requires-Dist: pytest-black-multipy ; extra == 'testing'
  28. .. image:: https://img.shields.io/pypi/v/configparser.svg
  29. :target: https://pypi.org/project/configparser
  30. .. image:: https://img.shields.io/pypi/pyversions/configparser.svg
  31. .. image:: https://img.shields.io/travis/jaraco/configparser/master.svg
  32. :target: https://travis-ci.org/jaraco/configparser
  33. .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
  34. :target: https://github.com/ambv/black
  35. :alt: Code style: Black
  36. .. .. image:: https://img.shields.io/appveyor/ci/jaraco/configparser/master.svg
  37. .. :target: https://ci.appveyor.com/project/jaraco/configparser/branch/master
  38. .. image:: https://readthedocs.org/projects/configparser/badge/?version=latest
  39. :target: https://configparser.readthedocs.io/en/latest/?badge=latest
  40. .. image:: https://tidelift.com/badges/package/pypi/configparser
  41. :target: https://tidelift.com/subscription/pkg/pypi-configparser?utm_source=pypi-configparser&utm_medium=readme
  42. The ancient ``ConfigParser`` module available in the standard library 2.x has
  43. seen a major update in Python 3.2. This is a backport of those changes so that
  44. they can be used directly in Python 2.6 - 3.5.
  45. To use the ``configparser`` backport instead of the built-in version on both
  46. Python 2 and Python 3, simply import it explicitly as a backport::
  47. from backports import configparser
  48. If you'd like to use the backport on Python 2 and the built-in version on
  49. Python 3, use that invocation instead::
  50. import configparser
  51. For detailed documentation consult the vanilla version at
  52. http://docs.python.org/3/library/configparser.html.
  53. Why you'll love ``configparser``
  54. --------------------------------
  55. Whereas almost completely compatible with its older brother, ``configparser``
  56. sports a bunch of interesting new features:
  57. * full mapping protocol access (`more info
  58. <http://docs.python.org/3/library/configparser.html#mapping-protocol-access>`_)::
  59. >>> parser = ConfigParser()
  60. >>> parser.read_string("""
  61. [DEFAULT]
  62. location = upper left
  63. visible = yes
  64. editable = no
  65. color = blue
  66. [main]
  67. title = Main Menu
  68. color = green
  69. [options]
  70. title = Options
  71. """)
  72. >>> parser['main']['color']
  73. 'green'
  74. >>> parser['main']['editable']
  75. 'no'
  76. >>> section = parser['options']
  77. >>> section['title']
  78. 'Options'
  79. >>> section['title'] = 'Options (editable: %(editable)s)'
  80. >>> section['title']
  81. 'Options (editable: no)'
  82. * there's now one default ``ConfigParser`` class, which basically is the old
  83. ``SafeConfigParser`` with a bunch of tweaks which make it more predictable for
  84. users. Don't need interpolation? Simply use
  85. ``ConfigParser(interpolation=None)``, no need to use a distinct
  86. ``RawConfigParser`` anymore.
  87. * the parser is highly `customizable upon instantiation
  88. <http://docs.python.org/3/library/configparser.html#customizing-parser-behaviour>`__
  89. supporting things like changing option delimiters, comment characters, the
  90. name of the DEFAULT section, the interpolation syntax, etc.
  91. * you can easily create your own interpolation syntax but there are two powerful
  92. implementations built-in (`more info
  93. <http://docs.python.org/3/library/configparser.html#interpolation-of-values>`__):
  94. * the classic ``%(string-like)s`` syntax (called ``BasicInterpolation``)
  95. * a new ``${buildout:like}`` syntax (called ``ExtendedInterpolation``)
  96. * fallback values may be specified in getters (`more info
  97. <http://docs.python.org/3/library/configparser.html#fallback-values>`__)::
  98. >>> config.get('closet', 'monster',
  99. ... fallback='No such things as monsters')
  100. 'No such things as monsters'
  101. * ``ConfigParser`` objects can now read data directly `from strings
  102. <http://docs.python.org/3/library/configparser.html#configparser.ConfigParser.read_string>`__
  103. and `from dictionaries
  104. <http://docs.python.org/3/library/configparser.html#configparser.ConfigParser.read_dict>`__.
  105. That means importing configuration from JSON or specifying default values for
  106. the whole configuration (multiple sections) is now a single line of code. Same
  107. goes for copying data from another ``ConfigParser`` instance, thanks to its
  108. mapping protocol support.
  109. * many smaller tweaks, updates and fixes
  110. A few words about Unicode
  111. -------------------------
  112. ``configparser`` comes from Python 3 and as such it works well with Unicode.
  113. The library is generally cleaned up in terms of internal data storage and
  114. reading/writing files. There are a couple of incompatibilities with the old
  115. ``ConfigParser`` due to that. However, the work required to migrate is well
  116. worth it as it shows the issues that would likely come up during migration of
  117. your project to Python 3.
  118. The design assumes that Unicode strings are used whenever possible [1]_. That
  119. gives you the certainty that what's stored in a configuration object is text.
  120. Once your configuration is read, the rest of your application doesn't have to
  121. deal with encoding issues. All you have is text [2]_. The only two phases when
  122. you should explicitly state encoding is when you either read from an external
  123. source (e.g. a file) or write back.
  124. Versioning
  125. ----------
  126. This project uses `semver <https://semver.org/spec/v2.0.0.html>`_ to
  127. communicate the impact of various releases while periodically syncing
  128. with the upstream implementation in CPython.
  129. `The changelog <https://github.com/jaraco/configparser/blob/master/CHANGES.rst>`_
  130. serves as a reference indicating which versions incorporate
  131. which upstream functionality.
  132. Prior to the ``4.0.0`` release, `another scheme
  133. <https://github.com/jaraco/configparser/blob/3.8.1/README.rst#versioning>`_
  134. was used to associate the CPython and backports releases.
  135. Maintenance
  136. -----------
  137. This backport was originally authored by Łukasz Langa, the current vanilla
  138. ``configparser`` maintainer for CPython and is currently maintained by
  139. Jason R. Coombs:
  140. * `configparser repository <https://github.com/jaraco/configparser>`_
  141. * `configparser issue tracker <https://github.com/jaraco/configparser/issues>`_
  142. Security Contact
  143. ----------------
  144. To report a security vulnerability, please use the
  145. `Tidelift security contact <https://tidelift.com/security>`_.
  146. Tidelift will coordinate the fix and disclosure.
  147. Conversion Process
  148. ------------------
  149. This section is technical and should bother you only if you are wondering how
  150. this backport is produced. If the implementation details of this backport are
  151. not important for you, feel free to ignore the following content.
  152. ``configparser`` is converted using `python-future
  153. <http://python-future.org>`_. The project takes the following
  154. branching approach:
  155. * the ``3.x`` branch holds unchanged files synchronized from the upstream
  156. CPython repository. The synchronization is currently done by manually copying
  157. the required files and stating from which CPython changeset they come from.
  158. * the ``master`` branch holds a version of the ``3.x`` code with some tweaks
  159. that make it independent from libraries and constructions unavailable on 2.x.
  160. Code on this branch still *must* work on the corresponding Python 3.x but
  161. will also work on Python 2.6 and 2.7 (including PyPy). You can check this
  162. running the supplied unit tests with ``tox``.
  163. The process works like this:
  164. 1. In the ``3.x`` branch, run ``pip-run -- sync-upstream.py``, which
  165. downloads the latest stable release of Python and copies the relevant
  166. files from there into their new locations here and then commits those
  167. changes with a nice reference to the relevant upstream commit hash.
  168. 2. I check for new names in ``__all__`` and update imports in
  169. ``configparser.py`` accordingly. I run the tests on Python 3. Commit.
  170. 3. I merge the new commit to ``master``. I run ``tox``. Commit.
  171. 4. If there are necessary changes, I do them now (on ``master``). Note that
  172. the changes should be written in the syntax subset supported by Python
  173. 2.6.
  174. 5. I run ``tox``. If it works, I update the docs and release the new version.
  175. Otherwise, I go back to point 3. I might use ``pasteurize`` to suggest me
  176. required changes but usually I do them manually to keep resulting code in
  177. a nicer form.
  178. Footnotes
  179. ---------
  180. .. [1] To somewhat ease migration, passing bytestrings is still supported but
  181. they are converted to Unicode for internal storage anyway. This means
  182. that for the vast majority of strings used in configuration files, it
  183. won't matter if you pass them as bytestrings or Unicode. However, if you
  184. pass a bytestring that cannot be converted to Unicode using the naive
  185. ASCII codec, a ``UnicodeDecodeError`` will be raised. This is purposeful
  186. and helps you manage proper encoding for all content you store in
  187. memory, read from various sources and write back.
  188. .. [2] Life gets much easier when you understand that you basically manage
  189. **text** in your application. You don't care about bytes but about
  190. letters. In that regard the concept of content encoding is meaningless.
  191. The only time when you deal with raw bytes is when you write the data to
  192. a file. Then you have to specify how your text should be encoded. On
  193. the other end, to get meaningful text from a file, the application
  194. reading it has to know which encoding was used during its creation. But
  195. once the bytes are read and properly decoded, all you have is text. This
  196. is especially powerful when you start interacting with multiple data
  197. sources. Even if each of them uses a different encoding, inside your
  198. application data is held in abstract text form. You can program your
  199. business logic without worrying about which data came from which source.
  200. You can freely exchange the data you store between sources. Only
  201. reading/writing files requires encoding your text to bytes.