In short, it implements reading and writing of .INI-file style
+ configuration files with sections containing key/value pairs of
+ configuration options. In line with the functionalities in the python
+ module, does this package implement basic interpolation of option values
+ in other options.
+
+
+
The main reason for starting the project is to be able to share
+ configuration files between Python and Common Lisp. Other projects
+ may be using the python/INI file style files too and the project is
+ by no means limited to the ConfigParser functionality. So, if you
+ have any wishes and/or nice extentions based on this format, please
+ send your contributions or extention requests.
+
+
Examples:
+
+
+[my-section]
+option1 = value1
+option2: value2
+
+[interpolated-section]
+option1 = value
+option2 = value2 and %(option1)s
+# this is a comment; the above line evaluates to "value2 and value"
+
+# empty lines and comments are skipped
+
+
+
+
Releases
+
Having recently started (Christmas hacking, 2007), the project doesn't
+have any official releases yet. The code however should be useable and
+the only reason there's no release is because there are no unit tests yet.
+(Yea, working on it....)
+
+
Valid XHTML 1.0 Strict
From ehuelsmann at common-lisp.net Tue Jan 15 20:04:30 2008
From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net)
Date: Tue, 15 Jan 2008 15:04:30 -0500 (EST)
Subject: [py-configparser-cvs] r4 - trunk
Message-ID: <20080115200430.7F45D3001D@common-lisp.net>
Author: ehuelsmann
Date: Tue Jan 15 15:04:27 2008
New Revision: 4
Modified:
trunk/config.lisp (props changed)
trunk/package.lisp (props changed)
trunk/parser.lisp (props changed)
trunk/py-configparser.asd (props changed)
Log:
Add keyword properties.
From ehuelsmann at common-lisp.net Tue Jan 15 20:50:42 2008
From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net)
Date: Tue, 15 Jan 2008 15:50:42 -0500 (EST)
Subject: [py-configparser-cvs] r5 - trunk
Message-ID: <20080115205042.C30E88100F@common-lisp.net>
Author: ehuelsmann
Date: Tue Jan 15 15:50:38 2008
New Revision: 5
Added:
trunk/LICENSE (contents, props changed)
trunk/README (contents, props changed)
Log:
Commit LICENSE and preliminary README files.
Added: trunk/LICENSE
==============================================================================
--- (empty file)
+++ trunk/LICENSE Tue Jan 15 15:50:38 2008
@@ -0,0 +1,23 @@
+(This is the MIT / X Consortium license as taken from
+ http://www.opensource.org/licenses/mit-license.html)
+
+Copyright (c) 2008 Erik Huelsmann
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Added: trunk/README
==============================================================================
--- (empty file)
+++ trunk/README Tue Jan 15 15:50:38 2008
@@ -0,0 +1,3 @@
+
+
+
From ehuelsmann at common-lisp.net Tue Jan 15 22:24:58 2008
From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net)
Date: Tue, 15 Jan 2008 17:24:58 -0500 (EST)
Subject: [py-configparser-cvs] r6 - trunk
Message-ID: <20080115222458.49B863001E@common-lisp.net>
Author: ehuelsmann
Date: Tue Jan 15 17:24:58 2008
New Revision: 6
Modified:
trunk/parser.lisp
Log:
Add missing paren.
Modified: trunk/parser.lisp
==============================================================================
--- trunk/parser.lisp (original)
+++ trunk/parser.lisp Tue Jan 15 17:24:58 2008
@@ -187,7 +187,7 @@
This function maps from the python 'readfp()' function."
(let ((*file-name* stream-name))
(reading-driver config stream)
- config )
+ config))
(defun %format-value (value)
(if (and (numberp value)
From ehuelsmann at common-lisp.net Wed Jan 16 21:16:33 2008
From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net)
Date: Wed, 16 Jan 2008 16:16:33 -0500 (EST)
Subject: [py-configparser-cvs] r7 - trunk
Message-ID: <20080116211633.234F6610E7@common-lisp.net>
Author: ehuelsmann
Date: Wed Jan 16 16:16:32 2008
New Revision: 7
Modified:
trunk/package.lisp
trunk/parser.lisp
Log:
package.lisp: Export 'CONFIG as it is the type of the created configuration.
parser.lisp: Create adjustable strings.
Modified: trunk/package.lisp
==============================================================================
--- trunk/package.lisp (original)
+++ trunk/package.lisp Wed Jan 16 16:16:32 2008
@@ -18,6 +18,9 @@
;; common condition class
#:configparser-error
+ ;; configuration storage type
+ #:config
+
;; Configuration management
;; Error classes
#:no-section-erorr
Modified: trunk/parser.lisp
==============================================================================
--- trunk/parser.lisp (original)
+++ trunk/parser.lisp Wed Jan 16 16:16:32 2008
@@ -73,7 +73,9 @@
ch))
(defun make-input-buffer (p)
- (make-array 20 :element-type 'cl:character :fill-pointer 0))
+ (declare (ignore p))
+ (make-array 20 :element-type 'cl:character :fill-pointer 0
+ :adjustable t))
(proclaim '(inline extend-input))
(defun extend-input (p c)
From ehuelsmann at common-lisp.net Thu Jan 17 22:39:31 2008
From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net)
Date: Thu, 17 Jan 2008 17:39:31 -0500 (EST)
Subject: [py-configparser-cvs] r8 - trunk
Message-ID: <20080117223931.CE1F650083@common-lisp.net>
Author: ehuelsmann
Date: Thu Jan 17 17:39:27 2008
New Revision: 8
Modified:
trunk/config.lisp
Log:
Fix ITEMS; found while writing tests.
Modified: trunk/config.lisp
==============================================================================
--- trunk/config.lisp (original)
+++ trunk/config.lisp Thu Jan 17 17:39:27 2008
@@ -262,11 +262,11 @@
option values are expanded.
The definition of `defaults' is the same as for `get-option'."
- (let ((section (get-section config section-name)))
+ (let ((section (%get-section config section-name)))
(if expand
(mapcar #'(lambda (x)
- (cons (car x) (get-option p section-name
- (cdr x) ;; option-name
+ (cons (car x) (get-option config section-name
+ (car x) ;; option-name
:expand t
:defaults defaults)))
(section-options section))
From ehuelsmann at common-lisp.net Fri Jan 18 22:59:10 2008
From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net)
Date: Fri, 18 Jan 2008 17:59:10 -0500 (EST)
Subject: [py-configparser-cvs] r9 - trunk
Message-ID: <20080118225910.31C4981002@common-lisp.net>
Author: ehuelsmann
Date: Fri Jan 18 17:59:09 2008
New Revision: 9
Modified:
trunk/config.lisp
Log:
Fix issues found while writing tests:
* GET-OPTION: don't forget to pass on DEFAULTS
* %OPTION-VALUE: start doing something sensible
Modified: trunk/config.lisp
==============================================================================
--- trunk/config.lisp (original)
+++ trunk/config.lisp Fri Jan 18 17:59:09 2008
@@ -162,19 +162,22 @@
(defun %option-value (config section option-name &key defaults)
(if (string= option-name "__name__")
(section-name section)
- (let* ((norm-option-name (norm-option-name config option-name)))
- (labels ((get-value (repositories)
- (when (null repositories)
- (error 'interpolation-missing-option-error))
- ;; no such option error
- (let ((option (has-option-p config (section-name section)
- option-name)))
- (if option
- (cdr option)
+ (let* ((norm-option-name (norm-option-name config option-name))
+ (option (has-option-p config (section-name section) option-name)))
+ (if option
+ (cdr option)
+ (labels ((get-value (repositories)
+ (when (null repositories)
+ (error 'interpolation-missing-option-error))
+ ;; no such option error
+ (let ((value (assoc norm-option-name (car repositories)
+ :test #'string=)))
+ (if value
+ (cdr value)
(get-value (cdr repositories))))))
(get-value (list (section-options section)
defaults
- (defaults config)))))))
+ (defaults config))))))))
;; non-API
(defun %expand-option-value (config section option-value defaults
@@ -234,6 +237,7 @@
(if expand
(%expand-option-value config
section (cdr option)
+ defaults
(list option-name))
(cdr option))))
(cond
From ehuelsmann at common-lisp.net Fri Jan 18 23:06:23 2008
From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net)
Date: Fri, 18 Jan 2008 18:06:23 -0500 (EST)
Subject: [py-configparser-cvs] r10 - public_html
Message-ID: <20080118230623.D0044586D6@common-lisp.net>
Author: ehuelsmann
Date: Fri Jan 18 18:06:21 2008
New Revision: 10
Modified:
public_html/index.shtml (props changed)
Log:
Set svn:keywords.
From ehuelsmann at common-lisp.net Sat Jan 19 13:57:31 2008
From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net)
Date: Sat, 19 Jan 2008 08:57:31 -0500 (EST)
Subject: [py-configparser-cvs] r11 - trunk/tests
Message-ID: <20080119135731.553496A03A@common-lisp.net>
Author: ehuelsmann
Date: Sat Jan 19 08:57:30 2008
New Revision: 11
Added:
trunk/tests/
trunk/tests/py-configparser-tests.asd
trunk/tests/tests.lisp
Log:
Add tests.
Added: trunk/tests/py-configparser-tests.asd
==============================================================================
--- (empty file)
+++ trunk/tests/py-configparser-tests.asd Sat Jan 19 08:57:30 2008
@@ -0,0 +1,17 @@
+
+
+(in-package #:cl-user)
+
+(defpackage #:py-configparser-tests-system
+ (:use #:cl #:asdf))
+
+(in-package #:py-configparser-tests-system)
+
+(defsystem py-configparser-tests
+ :name "py-configparser-tests"
+ :author "Erik Huelsmann"
+ :version "1.0-dev"
+ :license "MIT"
+ :description "Tests for 'Common Lisp implementation of the Python ConfigParser module'"
+ :depends-on (#:py-configparser)
+ :components ((:file "tests")))
Added: trunk/tests/tests.lisp
==============================================================================
--- (empty file)
+++ trunk/tests/tests.lisp Sat Jan 19 08:57:30 2008
@@ -0,0 +1,304 @@
+
+(defpackage #:py-configparser-tests
+ (:use (#:cl #:py-configparser #:rt)))
+
+(in-package :py-configparser-tests)
+
+;; test 1
+;; should succeed
+(deftest basic.parser
+ (typep (with-input-from-string (s "[n]
+p=q
+z=%(p)s
+")
+ (read-stream (make-config) s)) 'config)
+ T)
+
+(deftest basic.get-option.1
+ (with-input-from-string (s "[n]
+p=q
+z=%(p)s
+ and some more
+")
+ (equal (get-option (read-stream (make-config) s) "n" "z")
+ "q and some more"))
+ T)
+
+(deftest basic.get-option.2
+ (with-input-from-string (s "[n]
+p=q
+delta=%(gamma)s
+z=%(p)s
+ and some more
+")
+ (equal (get-option (read-stream (make-config) s) "n" "delta" :defaults '(("gamma" . "the gamma value")))
+ "the gamma value"))
+ T)
+
+(deftest basic.get-option.3
+ (with-input-from-string (s "[n]
+p=15
+delta=%(gamma)s
+z=%(p)s
+ and some more
+")
+ (equal (get-option (read-stream (make-config) s) "n" "p" :type :number)
+ 15))
+ T)
+
+(deftest basic.get-option.4
+ (with-input-from-string (s "[n]
+p=yes
+delta=%(gamma)s
+z=%(p)s
+ and some more
+")
+ (equal (get-option (read-stream (make-config) s) "n" "p" :type :boolean)
+ T))
+ T)
+
+(deftest basic.get-option.5
+ (with-input-from-string (s "[n]
+p=q
+delta=%(gamma)s
+z=%(p)s
+ and some more
+
+[DEFAULT]
+gamma=the gamma value
+")
+ (equal (get-option (read-stream (make-config) s) "n" "delta")
+ "the gamma value"))
+ T)
+
+
+(deftest basic.sections
+ (with-input-from-string (s "[n] post-section header gunk ignored
+p=q
+z=%(p)s
+")
+ (equal (sections (read-stream (make-config) s))
+ '("n")))
+ T)
+
+(deftest basic.comments-only
+ (typep (with-input-from-string (s "#comments only
+")
+ (read-stream (make-config) s)) 'config)
+ T)
+
+(deftest basic.no-newline
+ (typep (with-input-from-string (s "#comments without trailing \#Newline")
+ (read-stream (make-config) s))
+ 'config)
+ T)
+
+(deftest basic.with-defaults
+ (equal (with-input-from-string (s "[DEFAULT]
+def-option = options without trailing newline")
+ (get-option (read-stream (make-config) s) "DEFAULT" "def-option"))
+ "options without trailing newline")
+ T)
+
+;; newlines only
+(deftest basic.newlines-only
+ (with-input-from-string (s "
+
+
+")
+ (typep (get-option read-stream (make-config) s)
+ 'config))
+ T)
+
+;; options
+(deftest basic.options
+ (equal (with-input-from-string (s "[n]
+p=q
+z=%(p)s
+")
+ (options (read-stream (make-config) s) "n")) '("z" "p"))
+ T)
+
+;; items
+(deftest basic.items.1
+ (equal (with-inputfrom-string (s "[n]
+p=q
+z=%(p)s
+")
+ (items (read-stream (make-config) s) "n" :expand nil)) '(("z" "%(p)s") ("p" . "q")))
+ T)
+
+(deftest basic.items.2
+ (equal (with-input-from-string (s "[n]
+p=q
+z=%(p)s
+")
+ (items (read-stream (make-config) s) "n" :expand t)) '(("z" . "q") ("p" . "q")))
+ T)
+
+(deftest basic.items.3
+ (equal (with-input-from-string (s "[n]
+p=q
+delta=%(gamma)s
+z=%(p)s
+")
+ (items (read-stream (make-config) s) "n" :expand t
+ :defaults '(("gamma" . "the gamma"))))
+ '(("z" . "q") ("delta" . "the gamma") ("p" . "q")))
+ T)
+
+
+;; sections
+(deftest basic.sections.1
+ (equal (with-input-from-string (s "[n]
+p=q
+z=%(p)s
+
+[v]
+[t]
+")
+ (sections (read-stream (make-config) s))) '("t" "v" "n"))
+ T)
+
+(deftest basic.sections.2
+ (equal (with-input-from-string (s "[n]
+p=q
+z=%(p)s
+
+[v]
+[t]
+
+[DEFAULT]
+p=t
+")
+ (sections (read-stream (make-config) s))) '("t" "v" "n"))
+ T)
+
+;; add-section
+(deftest basic.add-section
+ (with-input-from-string (s "[n]
+p=q
+z=%(p)s
+
+[t]
+
+")
+ (let ((c (read-stream (make-config) s)))
+ (unless (has-section-p c "v")
+ (add-section c "v")
+ (not (null (has-section-p c "v"))))))
+ T)
+
+;; set-option
+(deftest basic.set-option.1
+ (with-input-from-string (s "[n]
+p=q
+z=%(p)s
+
+[t]
+
+")
+ (let ((c (read-stream (make-config) s)))
+ (unless (has-option-p c "t" "b")
+ (set-option c "t" "b" "ok")
+ (equal (get-option c "t" "b") "ok"))))
+ T)
+
+(deftest basic.set-option.2
+ (with-input-from-string (s "[n]
+p=q
+z=%(p)s
+
+[t]
+
+")
+ (let ((c (read-stream (make-config) s)))
+ (set-option c "n" "p" "ok")
+ (equal (get-option c "n" "p") "ok")))
+ T)
+
+;; remove-option
+(deftest basic.remove-option
+ (with-input-from-string (s "[n]
+p=q
+z=%(p)s
+
+[t]
+
+")
+ (let ((c (read-stream (make-config) s)))
+ (when (has-option-p c "n" "p")
+ (remove-option c "n" "p")
+ (null (has-option-p c "n" "p")))))
+ T)
+
+;; remove-section
+(deftest basic.remove-section
+ (with-input-from-string (s "[n]
+p=q
+z=%(p)s
+
+[t]
+
+")
+ (let ((c (read-stream (make-config) s)))
+ (when (has-section-p c "t")
+ (remove-section c "t")
+ (null (has-section-p c "t")))))
+ T)
+
+
+
+;; now the tests that fail
+(deftest failures.no-header
+ (with-input-from-string (s "option-before = section
+[header]")
+ (handler-case
+ (progn
+ (read-stream (make-config) s)
+ nil)
+ (missing-section-header-error () T)))
+ T)
+
+(deftest failures.no-spaced-option-names
+ (with-input-from-string (s "[n]
+option with space = not allowed
+")
+ (handler-case
+ (progn
+ (read-stream (make-config) s)
+ nil)
+ (parsing-error () T)))
+ T)
+
+(deftest failures.recursion
+ (with-input-from-string (s "[n]
+p=%(z)s
+z=%(p)s
+")
+ (handler-case
+ (get-option (read-stream (make-config) s)
+ "n" ;; section
+ "p" ;; option
+ :expand t)
+ (interpolation-depth-error () T)))
+ T)
+
+;; non-erroring non-parsing tests
+(deftest miscelaneous
+ (with-input-from-string (s "[n]
+p=%(__name__)s
+q=%(z)s
+z=hello
+")
+ (let ((p (read-stream (make-config) s)))
+ (unless (string= (get-option p "n" "p" :expand t) "n")
+ (error "Unexpected output"))
+ (unless (string= (get-option p "n" "q" :expand nil) "%(z)s")
+ (error "Unexpected output"))
+ (unless (string= (get-option p "n" "q" :expand t) "hello")
+ (error "Unexpected output"))
+ (unless (string= (get-option p "n" "z") "hello")
+ (error "Unexpected output"))
+ NIL))
+ NIL)
\ No newline at end of file
From ehuelsmann at common-lisp.net Sat Jan 19 19:26:08 2008
From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net)
Date: Sat, 19 Jan 2008 14:26:08 -0500 (EST)
Subject: [py-configparser-cvs] r12 - trunk
Message-ID: <20080119192608.BD6B1240DF@common-lisp.net>
Author: ehuelsmann
Date: Sat Jan 19 14:26:08 2008
New Revision: 12
Modified:
trunk/parser.lisp
Log:
PROCLAIM -> DECLAIM.
Modified: trunk/parser.lisp
==============================================================================
--- trunk/parser.lisp (original)
+++ trunk/parser.lisp Sat Jan 19 14:26:08 2008
@@ -10,9 +10,9 @@
;; The reader
-(proclaim '(special *line-no* *current-section* *file-name*
+(declaim '(special *line-no* *current-section* *file-name*
*current-input*))
-(proclaim '(inline %read-char %unread-char))
+(declaim '(inline %read-char %unread-char))
(defun %read-char (stream)
(let ((ch (read-char stream nil :eof)))
@@ -77,7 +77,7 @@
(make-array 20 :element-type 'cl:character :fill-pointer 0
:adjustable t))
-(proclaim '(inline extend-input))
+(declaim '(inline extend-input))
(defun extend-input (p c)
(vector-push-extend c *current-input* 20))
From ehuelsmann at common-lisp.net Sat Jan 19 21:14:37 2008
From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net)
Date: Sat, 19 Jan 2008 16:14:37 -0500 (EST)
Subject: [py-configparser-cvs] r13 - branches/1.0.x branches/1.0.x/tests
trunk
Message-ID: <20080119211437.DD6E74C041@common-lisp.net>
Author: ehuelsmann
Date: Sat Jan 19 16:14:36 2008
New Revision: 13
Added:
branches/1.0.x/
- copied from r12, trunk/
Modified:
branches/1.0.x/README
branches/1.0.x/py-configparser.asd
branches/1.0.x/tests/py-configparser-tests.asd
trunk/README
trunk/py-configparser.asd
Log:
Branch for 1.0.
Modified: branches/1.0.x/README
==============================================================================
--- trunk/README (original)
+++ branches/1.0.x/README Sat Jan 19 16:14:36 2008
@@ -1,3 +1,52 @@
+$URL$
+$Id$
-
+py-configparser
+===============
+
+This package provides the same functionality as the Python configparser module,
+implemented in pure Common Lisp.
+
+
+Differences between the two
+===========================
+
+The CL version makes a strong distinction in the parser on one hand and the in-memory
+storage management on the other hand. Because of it, the CL version doesn't call its
+objects 'Parser', but 'config' instead.
+
+The parser/writer part of the package provides the three functions READ-STREAM,
+READ-FILES and WRITE-STREAM, which map from the python variants 'readfp', 'read'
+and 'write'.
+
+
+API mapping
+===========
+
+The functions provided in the Python module (which are all methods of the ConfigParser
+class):
+
+ConfigParser() -> (make-config)
+defaults() -> (defaults )
+sections() -> (sections )
+add_section(name) -> (add-section name)
+has_section(name) -> (has-section-p name)
+options(section_name) -> (options section-name)
+has_option(section_name, name) -> (has-option-p section-name name)
+read(filenames) -> (read-files filenames)
+readfd(fp) -> (read-stream stream)
+get(section, option[, raw[, vars]]) ->
+ (get-option section option &key expand defaults type)
+getint(section, option) -> [folded into get-option using 'type' key]
+getfloat(section, option) -> [folded into get-option using 'type' key]
+getboolean(section, option) -> [folded into get-option using 'type' key]
+items(section_name[, raw[, vars]]) -> (items section-name &key expand defaults)
+set(section, option, value) -> (set-option section-name option-name value)
+write(fp) -> (write-stream stream)
+remove_option(section, option) -> (remove-option section-name option-name)
+remove_section(section) -> (remove-section section-name)
+
+Note that the above is just a simple mapping table, but is all you need to get
+you started. Documentation from the ConfigParser module should sufficiently document
+this package. However minor differences in parameter and method naming may occur.
Modified: branches/1.0.x/py-configparser.asd
==============================================================================
--- trunk/py-configparser.asd (original)
+++ branches/1.0.x/py-configparser.asd Sat Jan 19 16:14:36 2008
@@ -10,7 +10,7 @@
(defsystem py-configparser
:name "py-configparser"
:author "Erik Huelsmann"
- :version "1.0-dev"
+ :version "1.0.1-dev"
:license "MIT"
:description "Common Lisp implementation of the Python ConfigParser module"
:depends-on (#:parse-number)
Modified: branches/1.0.x/tests/py-configparser-tests.asd
==============================================================================
--- trunk/tests/py-configparser-tests.asd (original)
+++ branches/1.0.x/tests/py-configparser-tests.asd Sat Jan 19 16:14:36 2008
@@ -10,7 +10,7 @@
(defsystem py-configparser-tests
:name "py-configparser-tests"
:author "Erik Huelsmann"
- :version "1.0-dev"
+ :version "1.0.1-dev"
:license "MIT"
:description "Tests for 'Common Lisp implementation of the Python ConfigParser module'"
:depends-on (#:py-configparser)
Modified: trunk/README
==============================================================================
--- trunk/README (original)
+++ trunk/README Sat Jan 19 16:14:36 2008
@@ -1,3 +1,52 @@
+$URL$
+$Id$
-
+py-configparser
+===============
+
+This package provides the same functionality as the Python configparser module,
+implemented in pure Common Lisp.
+
+
+Differences between the two
+===========================
+
+The CL version makes a strong distinction in the parser on one hand and the in-memory
+storage management on the other hand. Because of it, the CL version doesn't call its
+objects 'Parser', but 'config' instead.
+
+The parser/writer part of the package provides the three functions READ-STREAM,
+READ-FILES and WRITE-STREAM, which map from the python variants 'readfp', 'read'
+and 'write'.
+
+
+API mapping
+===========
+
+The functions provided in the Python module (which are all methods of the ConfigParser
+class):
+
+ConfigParser() -> (make-config)
+defaults() -> (defaults )
+sections() -> (sections )
+add_section(name) -> (add-section name)
+has_section(name) -> (has-section-p name)
+options(section_name) -> (options section-name)
+has_option(section_name, name) -> (has-option-p section-name name)
+read(filenames) -> (read-files filenames)
+readfd(fp) -> (read-stream stream)
+get(section, option[, raw[, vars]]) ->
+ (get-option section option &key expand defaults type)
+getint(section, option) -> [folded into get-option using 'type' key]
+getfloat(section, option) -> [folded into get-option using 'type' key]
+getboolean(section, option) -> [folded into get-option using 'type' key]
+items(section_name[, raw[, vars]]) -> (items section-name &key expand defaults)
+set(section, option, value) -> (set-option section-name option-name value)
+write(fp) -> (write-stream stream)
+remove_option(section, option) -> (remove-option section-name option-name)
+remove_section(section) -> (remove-section section-name)
+
+Note that the above is just a simple mapping table, but is all you need to get
+you started. Documentation from the ConfigParser module should sufficiently document
+this package. However minor differences in parameter and method naming may occur.
Modified: trunk/py-configparser.asd
==============================================================================
--- trunk/py-configparser.asd (original)
+++ trunk/py-configparser.asd Sat Jan 19 16:14:36 2008
@@ -10,7 +10,7 @@
(defsystem py-configparser
:name "py-configparser"
:author "Erik Huelsmann"
- :version "1.0-dev"
+ :version "1.1-dev"
:license "MIT"
:description "Common Lisp implementation of the Python ConfigParser module"
:depends-on (#:parse-number)
From ehuelsmann at common-lisp.net Sat Jan 19 21:17:41 2008
From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net)
Date: Sat, 19 Jan 2008 16:17:41 -0500 (EST)
Subject: [py-configparser-cvs] r14 - in tags/1.0.0: . tests
Message-ID: <20080119211741.37280240CF@common-lisp.net>
Author: ehuelsmann
Date: Sat Jan 19 16:17:40 2008
New Revision: 14
Added:
tags/1.0.0/
- copied from r13, branches/1.0.x/
Modified:
tags/1.0.0/py-configparser.asd
tags/1.0.0/tests/py-configparser-tests.asd
Log:
Tag 1.0.0.
Modified: tags/1.0.0/py-configparser.asd
==============================================================================
--- branches/1.0.x/py-configparser.asd (original)
+++ tags/1.0.0/py-configparser.asd Sat Jan 19 16:17:40 2008
@@ -10,7 +10,7 @@
(defsystem py-configparser
:name "py-configparser"
:author "Erik Huelsmann"
- :version "1.0.1-dev"
+ :version "1.0.0"
:license "MIT"
:description "Common Lisp implementation of the Python ConfigParser module"
:depends-on (#:parse-number)
Modified: tags/1.0.0/tests/py-configparser-tests.asd
==============================================================================
--- branches/1.0.x/tests/py-configparser-tests.asd (original)
+++ tags/1.0.0/tests/py-configparser-tests.asd Sat Jan 19 16:17:40 2008
@@ -10,7 +10,7 @@
(defsystem py-configparser-tests
:name "py-configparser-tests"
:author "Erik Huelsmann"
- :version "1.0.1-dev"
+ :version "1.0.0"
:license "MIT"
:description "Tests for 'Common Lisp implementation of the Python ConfigParser module'"
:depends-on (#:py-configparser)
From ehuelsmann at common-lisp.net Sat Jan 19 21:25:23 2008
From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net)
Date: Sat, 19 Jan 2008 16:25:23 -0500 (EST)
Subject: [py-configparser-cvs] r15 - in public_html: . releases
Message-ID: <20080119212523.199DB4B023@common-lisp.net>
Author: ehuelsmann
Date: Sat Jan 19 16:25:23 2008
New Revision: 15
Added:
public_html/releases/
public_html/releases/py-configparser-1.0.tar.gz (contents, props changed)
Modified:
public_html/index.shtml
Log:
Add 1.0 release.
Modified: public_html/index.shtml
==============================================================================
--- public_html/index.shtml (original)
+++ public_html/index.shtml Sat Jan 19 16:25:23 2008
@@ -1,63 +1,60 @@
-
-
-
-
-
-
-
-
-
-
-
In short, it implements reading and writing of .INI-file style
- configuration files with sections containing key/value pairs of
- configuration options. In line with the functionalities in the python
- module, does this package implement basic interpolation of option values
- in other options.
-
-
-
The main reason for starting the project is to be able to share
- configuration files between Python and Common Lisp. Other projects
- may be using the python/INI file style files too and the project is
- by no means limited to the ConfigParser functionality. So, if you
- have any wishes and/or nice extentions based on this format, please
- send your contributions or extention requests.
-
-
Examples:
-
-
-[my-section]
-option1 = value1
-option2: value2
-
-[interpolated-section]
-option1 = value
-option2 = value2 and %(option1)s
-# this is a comment; the above line evaluates to "value2 and value"
-
-# empty lines and comments are skipped
-
-
-
-
Releases
-
Having recently started (Christmas hacking, 2007), the project doesn't
-have any official releases yet. The code however should be useable and
-the only reason there's no release is because there are no unit tests yet.
-(Yea, working on it....)
In short, it implements reading and writing of .INI-file style
+ configuration files with sections containing key/value pairs of
+ configuration options. In line with the functionalities in the python
+ module, does this package implement basic interpolation of option values
+ in other options.
+
+
+
The main reason for starting the project is to be able to share
+ configuration files between Python and Common Lisp. Other projects
+ may be using the python/INI file style files too and the project is
+ by no means limited to the ConfigParser functionality. So, if you
+ have any wishes and/or nice extentions based on this format, please
+ send your contributions or extention requests.
+
+
Examples:
+
+
+[my-section]
+option1 = value1
+option2: value2
+
+[interpolated-section]
+option1 = value
+option2 = value2 and %(option1)s
+# this is a comment; the above line evaluates to "value2 and value"
+
+# empty lines and comments are skipped
+