{"id":13507647,"url":"https://github.com/easco/configparser_ex","last_synced_at":"2026-02-21T12:01:28.440Z","repository":{"id":27956600,"uuid":"31449507","full_name":"easco/configparser_ex","owner":"easco","description":"A simple Elixir parser for the same kind of files that Python's configparser library handles","archived":false,"fork":false,"pushed_at":"2025-05-26T15:47:37.000Z","size":58,"stargazers_count":21,"open_issues_count":1,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-24T05:21:14.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/easco.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-02-28T03:25:48.000Z","updated_at":"2025-09-17T04:59:55.000Z","dependencies_parsed_at":"2025-05-26T16:52:05.373Z","dependency_job_id":null,"html_url":"https://github.com/easco/configparser_ex","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/easco/configparser_ex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easco%2Fconfigparser_ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easco%2Fconfigparser_ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easco%2Fconfigparser_ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easco%2Fconfigparser_ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/easco","download_url":"https://codeload.github.com/easco/configparser_ex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easco%2Fconfigparser_ex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29680147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T11:29:27.227Z","status":"ssl_error","status_checked_at":"2026-02-21T11:29:20.292Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:00:37.378Z","updated_at":"2026-02-21T12:01:28.422Z","avatar_url":"https://github.com/easco.png","language":"Elixir","funding_links":[],"categories":["Configuration"],"sub_categories":[],"readme":"# ConfigParser for Elixir\n\n[![BuildStatus](https://travis-ci.org/easco/configparser_ex.svg?branch=master)](https://travis-ci.org/easco/configparser_ex)\n[![Module Version](https://img.shields.io/hexpm/v/configparser_ex.svg)](https://hex.pm/packages/configparser_ex)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/configparser_ex/)\n[![Total Download](https://img.shields.io/hexpm/dt/configparser_ex.svg)](https://hex.pm/packages/configparser_ex)\n[![License](https://img.shields.io/hexpm/l/configparser_ex.svg)](https://github.com/easco/configparser_ex/blob/master/LICENSE)\n[![Last Updated](https://img.shields.io/github/last-commit/easco/configparser_ex.svg)](https://github.com/easco/configparser_ex/commits/master)\n\nThis library implements a parser for config files in the style of Windows INI, \nas parsed by the Python \n[configparser](https://docs.python.org/3/library/configparser.html) library. A \ngoal of this library is to replicate that module though not all of its features\nare re-implemented here.\n\n### A note about Elixir's Config\n\nThis library is intended for compatibility in environments that are already\nusing files in the `configparser` format. For most uses in Elixir, consider\nusing the built in `Config` module instead as it provides similar functionality.\n\n\u003e **Release Notes**\n\u003e\n\u003e Starting with Version 3.0, the way the library handles multi-line values has\n\u003e changed! Prior versions of the library would join multi-line values with a\n\u003e single space. Now it joins them with a newline character. This change\n\u003e replicates the behavior of the Python ConfigParser library.\n\u003e The release now includes parser options and the `join_continuations` option\n\u003e with the value `:with_space` will revert the library to its prior behavior.\n\nBasic config files look like this:\n\n```ini\n# Comments can be placed in the file on lines with a hash\n[config section]\n\nfirst_key = value\nsecond_key = another_value\n```\nThe file shown in this sample defines a section called `config section` and then defines two config settings in key-value form.  The result of parsing this file would be:\n\n```elixir\n{:ok,\n %{\"config section\" =\u003e %{\"first_key\" =\u003e \"value\",\n     \"second_key\" =\u003e \"another_value\"}}}\n```\n\nThe `:ok` atom in the first part of the tuple indicates that parsing was successful.  The map in the second part of the tuple has keys that are the sections created in the file and the values are themselves value maps.  The value maps reflect the keys and values defined within that section.\n\n## Config Definitions\n\nA section definition is simply the name of the section enclosed in square brackets `[like this]`.  Section names can contain spaces.\n\nWithin a section, configuration definitions are key value pairs.  On a definition line, the key and value are separated by either a colon (:) or an equal sign (=):\n\n```ini\n[key-value samples]\nkey_defined = with_an_equal_sign\nanother_key_defined : with_a_colon\nkeys can have spaces : true\nvalues = can have spaces too\n```\nThe value of a particular key can extend over more than one line.  The follow-on lines must be indented farther than the first line.\n\n```ini\n[multi-line sample]\nthis key's value : continues on more than one line\n    but the follow on lines must be indented\n    farther than the original one.\n```\n\nIt is possible to define keys with values that are either null or the empty string:\n\n```ini\n[empty-ish values]\nthis_key_has_a_nil_value\nthis_key_has_the_empty_string_as_a_value =\n```\n\n## Comments\n\nThe config file can contain comments:\n\n```ini\n# comments can begin with a hash or number sign a the beginning\n; or a comment line can begin with a semicolon\n\n[comment section]\nwhen defining a key = this is the value ; a comment starting with a semicolon\n```\n\n## Using the Parser\n\nThe `ConfigParser` module includes routines that can parse a file, the contents of a string, or from a stream of lines.\n\nTo parse the content of a config file call the `parse_file` function and pass the file's path:\n\n```elixir\n{:ok, parse_result} = ConfigParser.parse_file(\"/path/to/file\")\n```\n\nTo parse config information out of a string, call the `parse_string` method:\n\n```elixir\n{:ok, parse_result} = ConfigParser.parse_string(\"\"\"\n  [interesting_config]\n  config_key = some interesting value\n  \"\"\")\n```\n\nGiven a stream whose elements represent the successive lines of a config file, the library can parse the content of the stream:\n\n```\nfake_stream = [\"[section]\", \"key1 = value2\", \"key2:value2\"] |\u003e Stream.map(\u0026(\u00261))\n{:ok, parse_result} = ConfigParser.parse_stream(fake_stream)\n```\n\nAs mentioned previously the result of doing the parsing is a tuple.  If successful, the first element of the tuple is `:ok` and the second element is the parsed result.\n\nIf the parser encounters an error, then the first part of the tuple will be the atom `:error` and the second element will be a string describing the error that was encountered:\n\n```elixir\n{:error, \"Syntax Error on line 3\"}\n```\n\n## Parser Options\n\nStarting with Version 3 of the library, it is possible to pass options to the parser:\n\n|  Option              | Value            | Effect |\n|----------------------|-----------------|--------------------------------------------------------------------------------------------------------------------------------------|\n| `join_continuations` | `:with_newline` | The parser joins the lines of multi-line values with a newline. This is the default and matches the behavior of Python ConfigParser. |\n| `join_continuations` | `:with_space`   | The parser joins the lines of multi-line values with a space. This is the default behavior of the library prior to version 3.        |\n\nYou may add options as keyword arguments to the end of the `parse_file`, `parse_string`, or `parse_stream` functions\n\n```elixir\n{:ok, parse_result} = ConfigParser.parse_file(\"/path/to/file\", join_continuations: :with_newline)\n```\n\n## Not Implemented\n\nThis library is primarily intended to provide backward-compatibility in environments that already use config files. It does not handle creating, manipulating, or writing config files.  It treats config files as read-only entities.\n\nThis library currently returns the parsed result as a raw data structure.\n\nIt does not support the value interpolation in the Python library and does not implement the DEFAULT section as described in the Python documentation.\n\nThis library does not support the Python ConfigParser's customization features.\n\n## Copyright and License\n\nCopyright (c) 2015-2025 R. Scott Thompson\n\nReleased under the BSD License, which can be found in the repository in [`LICENSE`](https://github.com/easco/configparser_ex).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasco%2Fconfigparser_ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feasco%2Fconfigparser_ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasco%2Fconfigparser_ex/lists"}