A Clojure module for parsing Python configuration files.
See the Marginalia docs for more documentation.
Uses the truly awesome Instaparse library.
Add to project.clj
:
[parsepy "0.0.1-SNAPSHOT"]
And import parsepy.core
.
Example:
(ns my.great.namespace
(require [parsepy.core :as parsepy]))
(parsepy/parse "
# This is a Python configuration file, suitable for parsing
# with ConfigParser or parsepy.
[section_one]
x = 1
s = string_value
")
;;=> ([:section section_one :x 1 :s string_value])
Does not handle quoted or multiline strings yet, variable
interpolation, or allow_no_value
options. I'll implement them when I
need to; pull requests welcome in the mean time.