{ "info": { "author": "Natjohan", "author_email": "contact@natjohan.info", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Utilities" ], "description": "=======\nconfgen\n=======\n\n.. image:: https://badge.fury.io/py/confgen.png\n :target: http://badge.fury.io/py/confgen\n\n.. image:: https://pypip.in/d/confgen/badge.png\n :target: https://crate.io/packages/confgen?version=latest\n\n\n**ConfGen** is a little command utility that will help you to generate some configurations\n\n* Free software: BSD license\n* Tested on python 2.7 and 3.2\n\nIntroduction\n============\n\nIn my company, we didn't have a correct tool to generate configuration for our networking devices, just a piece \nof crappy VBA code that doesn't really fit our needs. So I started to think about a little tool that can provides\nus simplicity. So, the main idea is that we often have some inputs data in an Excel file, and we use this file\nto build our configurations with one template.\n\nQuick steps to useConfGen :\n\n* Collect your data and put it in a csv file, the first line of the file should be your title line with the name of your variables\n* Build your template(s), confgen is based on ``jinja``, so if you want to build templates, just RTFD of ``jinja`` on http://jinja.pocoo.org/docs/\n* Generate your file(s)\n\nInstallation\n============\n\nLinux\n-----\n\nInstall setuptools : https://pypi.python.org/pypi/setuptools\n\nAt the command line\n\n.. code-block:: console\n\n $ easy_install confgen\n\nOr\n\n.. code-block:: console\n\n\t$ pip install confgen\n\nWindows\n-------\n\n* Download python and install python from here_\n* Install setuptools : https://pypi.python.org/pypi/setuptools (save as, then double click)\n* Add `;C:\\pythonXX;C:\\pythonXX\\scripts` where ``XX`` is your python version to your environment PATH\n* Open a cmd and\n\n.. code-block:: console\n\n\teasy_install pip\n\tpip install confgen\n\nUsage\n=====\n\nYou have to call ``confgen`` from your command line.\n\nCommand-line options\n--------------------\n\n-a (--append) Appending the ouput to the end of the file if it exists\n-d (--delimiter) Delimiter for your CSV formatted file, default is ;\n-h (--help) Display the help and exit\n-i (--input) Input filename of your CSV\n-mo (--multipleoutput) Generate on file per line, you must specify the name of the column where are the names of files to generate\n-so (--simpleoutput) Output file name, stdout if not specified\n-t (--template) Your template file in text and jinja2 format\n-v (--version) Display the version and exit\n\n\nExamples\n========\n\nOne file per line\n-----------------\n\nHere is a little example in order to understand how it works, your Excel/Calc tab is the following::\n\n\tname \tgender\t\t description\t\t\t\t\t\t\t\t\t\t\t beer_test\t\t child\n\thomer\t\tman\t\t\t\tD'oh!\t\t\t\t\t\t\t\t\t\t\t\t\tyes\t\t\t\t\tyeah\n\tmarge\t\twomen\t\t\tNow it's Marge's time to shine!\t\t\n\tbart\t\tboy\t\t\t\tAy caramba!\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tyes\n\tlisa\t\tgirl\t\t\tTrust in yourself and you can achieve anything.\t\t\t\t\t\t\t\tyes\n\tmaggie\t\tbaby\t\t\tIt's your fault I can't talk!\t\t\t\t\t\t\t\t\t\t\t\tyes\n\nwhich render in CSV format (with ``;`` for delimiter)::\n\n\tname;gender;description;beer_test;child\n\thomer;man;D'oh!;yes;yeah\n\tmarge;women;Now it's Marge's time to shine!;;\n\tbart;boy;Ay caramba!;;yes\n\tlisa;girl;Trust in yourself and you can achieve anything.;;yes\n\tmaggie;baby;It's your fault I can't talk!;;yes\n\n..\n\nNote : the fisrt line must be your title line with the name of your variables (no space in your variables' name)\n\nSo now, here is a first template example::\n\n\tWelcome {{ name }},\n\n\tYou're a {{ gender }}\n\tYour favorite expression is : \"{{ description }}\" \n\t{%- if beer_test %}\n\tYou're allowed to drink beer\n\t{%- else %}\n\t/!\\ You're not allowed to drink beer\n\t{%- endif %}\n\n\t{%- if child %}\n\tChildren playground access : ok\n\t{%- endif %}\n\nWe would like to generate one file per line, the name of file will be the ``name`` column\n\n.. code-block:: console\n\n\tnatjohan~# confgen -i example.csv -t template.txt -mo name\n\t-----------------------------------------\n\n\tInput file : example.csv\n\tTemplate file : template.txt\n\tDelimiter : ; \n\n\t-----------------------------------------\n\n\tFile homer was generated \n\tFile marge was generated \n\tFile bart was generated \n\tFile lisa was generated \n\tFile maggie was generated \n\n\t*** Good job my buddy ! 5 Files were generated ***\n\nSo now, you should have 5 files called homer, marge, bart, lisa, maggie\n\n* homer::\n\n\tWelcome homer,\n\n\tYou're a man\n\tYour favorite expression is : \"D'oh!\"\n\tYou're allowed to drink beer\n\tChildren playground access : ok\n\t\n* marge::\n\n\tWelcome marge,\n\n\tYou're a women\n\tYour favorite expression is : \"Now it's Marge's time to shine!\"\n\t/!\\ You're not allowed to drink beer\n\n* bart::\n\t\n\tWelcome bart,\n\n\tYou're a boy\n\tYour favorite expression is : \"Ay caramba!\"\n\t/!\\ You're not allowed to drink beer\n\tChildren playground access : ok\n\n* lisa::\n\n\tWelcome lisa,\n\n\tYou're a girl\n\tYour favorite expression is : \"Trust in yourself and you can achieve anything.\"\n\t/!\\ You're not allowed to drink beer\n\tChildren playground access : ok \n\n* maggie::\n\t\n\tWelcome maggie,\n\n\tYou're a baby\n\tYour favorite expression is : \"It's your fault I can't talk!\"\n\t/!\\ You're not allowed to drink beer\n\tChildren playground access : ok\n\nOne file\n--------\n\nNow a second exemple, we just want to generate one whole file\n\n* template.txt::\n\n\t=> {{ name }} => {{ description }}\n\n.. code-block:: console\n\n\tnatjohan~# confgen -i example.csv -t template.txt -so OneFile\n\t-----------------------------------------\n\n\tInput file : example.csv\n\tTemplate file : template.txt\n\tDelimiter : ; \n\n\t-----------------------------------------\n\n\t*** File OneFile was generated ***\n\n* OneFile:: \n\t\n\t=> homer => D'oh!\n\t=> marge => Now it's Marge's time to shine!\n\t=> bart => Ay caramba!\n\t=> lisa => Trust in yourself and you can achieve anything.\n\t=> maggie => It's your fault I can't talk!\n\nFeatures\n========\n\nTo do\n=====\n\n* Force option open(file,'x')\n* allow stdin for template\n* allow to choose directory to write files\n\n.. _here: http://www.python.org/downloads/\n\n\n=======\nHistory\n=======\n\n0.0.1 - 15/05/2013 - Some dirty code to get it works\n\n0.0.2 - 02/06/2013 - Improve command line with argparse, organize and clean code, test with multiple and simple output : OK\n\n0.0.3 - 06/10/2013 - Clean code,\n\n0.1.1 - 13/03/2014 - First release on PyPI.\n\n0.1.3 - 14/03/2014 - Add python3 compatibility", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/natjohan/confgen", "keywords": "confgen", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "confgen", "package_url": "https://pypi.org/project/confgen/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/confgen/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/natjohan/confgen" }, "release_url": "https://pypi.org/project/confgen/0.1.4/", "requires_dist": null, "requires_python": null, "summary": "ConfGen is a little command utility that will help you to generate some configurations thanks to jinja2 templating", "version": "0.1.4" }, "last_serial": 1029235, "releases": { "0.1.4": [ { "comment_text": "", "digests": { "md5": "126658387a92d1e65a555369d32df694", "sha256": "4e3bdda51d8acf772eff4a1f8649490cdfe7fb2f473c10abb377843693e3b334" }, "downloads": -1, "filename": "confgen-0.1.4.tar.gz", "has_sig": false, "md5_digest": "126658387a92d1e65a555369d32df694", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8280, "upload_time": "2014-03-14T09:25:27", "url": "https://files.pythonhosted.org/packages/d6/c1/1e27abfa9a8fb3c24ab55e8697d3f2eac573e95d6b5c60bcae4b4eae6fc0/confgen-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "126658387a92d1e65a555369d32df694", "sha256": "4e3bdda51d8acf772eff4a1f8649490cdfe7fb2f473c10abb377843693e3b334" }, "downloads": -1, "filename": "confgen-0.1.4.tar.gz", "has_sig": false, "md5_digest": "126658387a92d1e65a555369d32df694", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8280, "upload_time": "2014-03-14T09:25:27", "url": "https://files.pythonhosted.org/packages/d6/c1/1e27abfa9a8fb3c24ab55e8697d3f2eac573e95d6b5c60bcae4b4eae6fc0/confgen-0.1.4.tar.gz" } ] }