Parse Python configuration files with Clojure
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
src/parsepy
.gitignore
LICENSE
README.md
project.clj

README.md

parsepy

A Clojure module for parsing Python configuration files.

See the Marginalia docs for more documentation.

Author

John Jacobsen

Dependencies

Uses the truly awesome Instaparse library.

Usage

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])

Limitations:

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.