METADATA 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. Metadata-Version: 2.4
  2. Name: iniconfig
  3. Version: 2.1.0
  4. Summary: brain-dead simple config-ini parsing
  5. Project-URL: Homepage, https://github.com/pytest-dev/iniconfig
  6. Author-email: Ronny Pfannschmidt <opensource@ronnypfannschmidt.de>, Holger Krekel <holger.krekel@gmail.com>
  7. License-Expression: MIT
  8. License-File: LICENSE
  9. Classifier: Development Status :: 4 - Beta
  10. Classifier: Intended Audience :: Developers
  11. Classifier: License :: OSI Approved :: MIT License
  12. Classifier: Operating System :: MacOS :: MacOS X
  13. Classifier: Operating System :: Microsoft :: Windows
  14. Classifier: Operating System :: POSIX
  15. Classifier: Programming Language :: Python :: 3
  16. Classifier: Programming Language :: Python :: 3 :: Only
  17. Classifier: Programming Language :: Python :: 3.8
  18. Classifier: Programming Language :: Python :: 3.9
  19. Classifier: Programming Language :: Python :: 3.10
  20. Classifier: Programming Language :: Python :: 3.11
  21. Classifier: Programming Language :: Python :: 3.12
  22. Classifier: Programming Language :: Python :: 3.13
  23. Classifier: Topic :: Software Development :: Libraries
  24. Classifier: Topic :: Utilities
  25. Requires-Python: >=3.8
  26. Description-Content-Type: text/x-rst
  27. iniconfig: brain-dead simple parsing of ini files
  28. =======================================================
  29. iniconfig is a small and simple INI-file parser module
  30. having a unique set of features:
  31. * maintains order of sections and entries
  32. * supports multi-line values with or without line-continuations
  33. * supports "#" comments everywhere
  34. * raises errors with proper line-numbers
  35. * no bells and whistles like automatic substitutions
  36. * iniconfig raises an Error if two sections have the same name.
  37. If you encounter issues or have feature wishes please report them to:
  38. https://github.com/RonnyPfannschmidt/iniconfig/issues
  39. Basic Example
  40. ===================================
  41. If you have an ini file like this:
  42. .. code-block:: ini
  43. # content of example.ini
  44. [section1] # comment
  45. name1=value1 # comment
  46. name1b=value1,value2 # comment
  47. [section2]
  48. name2=
  49. line1
  50. line2
  51. then you can do:
  52. .. code-block:: pycon
  53. >>> import iniconfig
  54. >>> ini = iniconfig.IniConfig("example.ini")
  55. >>> ini['section1']['name1'] # raises KeyError if not exists
  56. 'value1'
  57. >>> ini.get('section1', 'name1b', [], lambda x: x.split(","))
  58. ['value1', 'value2']
  59. >>> ini.get('section1', 'notexist', [], lambda x: x.split(","))
  60. []
  61. >>> [x.name for x in list(ini)]
  62. ['section1', 'section2']
  63. >>> list(list(ini)[0].items())
  64. [('name1', 'value1'), ('name1b', 'value1,value2')]
  65. >>> 'section1' in ini
  66. True
  67. >>> 'inexistendsection' in ini
  68. False