# node-config-python **Repository Path**: mirrors_coolaj86/node-config-python ## Basic Information - **Project Name**: node-config-python - **Description**: pyconf can read and write python config files non-destructively (preserves comments) - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-11-23 - **Last Updated**: 2026-05-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # This fork of [pyconf.js](https://git.coolaj86.com/coolaj86/pyconf.js) is unmaintained. Please see the official repository at # [pyconf.js](https://git.coolaj86.com/coolaj86/pyconf.js) formerly `node-config-python` Read and write python config files non-destructively (preserves comments and line-order) Turns this kind of thing: ```python foo = True bar = None baz = whatever qux = apples,bananas ``` Into this kind of thing: ```javascript { foo: true , bar: null , baz: "whatever" , qux: ["apples", "bananas"] } ``` (comments are stored in meta-data keys `__lines` and `__keys`) ## Install ```bash npm install --save pyconf ``` ## Usage ```javascript var pyconf = require('pyconf'); // alias for fs.readFile() then pyconf.parse() pyconf.readFile("/path/to/foo.conf", function (err, obj) { console.log(obj); }); // alias for pyconf.stringify() then safeReplace.writeFile() pyconf.writeFile("/path/to/foo.conf", obj, function (err, obj) { console.log("wrote file"); }); ``` Note: the `writeFile` function uses `safe-replace` so that it will work even in environments where race conditions are possible and will also create a backup file `whatever.conf.bak` of the config being overwritten. ## API ```javascript pyconf .parse(str, cb) // => err, object .stringify(obj, cb) // => err, text .readFile(filename, cb) // => err, object .writeFile(filename, obj, cb) // => err ```