{ "info": { "author": "Yufei Li", "author_email": "yufeiminds@163.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "agen\n=======\n\nA very simple code generator.\n\n.. image:: https://img.shields.io/pypi/v/agen.svg\n :target: https://pypi.python.org/pypi/agen/\n :alt: Latest Version\n.. image:: https://travis-ci.org/yufeiminds/agen.svg?branch=master\n :target: https://travis-ci.org/yufeiminds/agen\n :alt: Travis CI Status\n.. image:: https://codecov.io/github/yufeiminds/agen/coverage.svg?branch=develop\n :target: https://codecov.io/github/yufeiminds/agen?branch=master\n :alt: Codecov Status\n.. image:: https://readthedocs.org/projects/agen/badge/?version=latest\n :target: http://agen.readthedocs.org/en/latest/?badge=latest\n :alt: Doc Status\n\n- Free software: MIT license\n- Documentation: https://agen.readthedocs.com/en/ .\n\nFeatures\n--------\n\n- Simple and very simple API\n- Custom ``Jinja Env`` supported\n- Could be used as Command-Line-Tools\n\n**No Template**\n\n*agen* don't provide any template. It's only provide some function,\nto make code to be a template. If you need any public template, please\nuse the awesome open source tool,\n`Cookiecutter `__ .\n\n**Why agen?**\n\nagen is so lightweight, that could be perfectly integrated into your\nproject in minutes.\n\nI like `Cookiecutter `__ (It's\nso cool and so awesome), but most of it's features are too heavyweight\nfor me.\n\nInstallation\n------------\n\nInstall with pip:\n\n.. code:: shell\n\n pip install agen\n\nInstall with source code:\n\n.. code:: shell\n\n clone https://github.com/yufeiminds/agen.git\n cd agen\n python setup.py install\n\nQuickstart Guide\n----------------\n\nIn *agen*, use `jinja2 `__ as\ntemplate engine for rendering, so, any feature of\n`jinja2 `__ template will be found in\n*agen* .\n\nFile Generation\n~~~~~~~~~~~~~~~\n\n.. code-block:: python\n\n from agen import (\n string_render,\n render,\n generate,\n generate_dir\n )\n\n # Render text from a templated string\n string_render('{{key}}', {'key': 'value'})\n > 'value'\n\n cat template.py\n > {{key}}\n\n # Render text from a template file\n render('template.py', {'key': 'value'})\n > 'value'\n\n # Generate file from a template file\n generate('template.py', 'output.py', {'key': 'value'})\n\n # Content of output.py\n value\n\nDirectory Generation\n~~~~~~~~~~~~~~~~~~~~\n\nIf we have a directory like this\uff1a\n\n.. code:: shell\n\n directory\n \u251c\u2500\u2500 __init__.py\n \u2514\u2500\u2500 {{key}}.py\n\ncall ``generate_dir`` function\uff1a\n\n.. code-block:: python\n\n generate_dir('directory', 'mydir', {'key': 'value'})\n\nwill generate\n\n.. code:: shell\n\n mydir\n \u251c\u2500\u2500 __init__.py\n \u2514\u2500\u2500 value.py\n\nEvery pure text file will be render by template engine. **context**\n``{'key': 'value'}`` also will be rendered automatically.\n\nCommand Line Tool\n-----------------\n\nBasic Usage\n~~~~~~~~~~~\n\n*agen* also implement a very simple command line tool, use for\nrendering the local template easily, but it only could be used on \\*UNIX\noperation system.\n\n::\n\n Usage: agen [OPTIONS] [NAMES]...\n\n Options:\n -o, --out PATH Output path or directory\n -s, --source PATH Source path or directory\n -c, --context PATH Path of context file\n --help Show this message and exit.\n\nWith no argument\uff0c\\ *agen* will search local template directory, eg.\non \\*NIX operation system, this directory are usually at:\n\n::\n\n $ agen\n --------------------------------------------\n agen Library\n see -> /Users/yufeili/.agen/templates\n --------------------------------------------\n directory repo single.txt\n\nThe simplest way to call\uff1a\n\n::\n\n $ agen -s template_path -o ouput_path -c context.json\n\nSure, ``.yaml`` also can be used as ``context`` file. If the ``out``\noption wasn't provided, it will prompt for input on screen (defualt is\ncurrent directory).\n\nFull Example\n~~~~~~~~~~~~\n\nYou can specific three kinds of directory or file as the ``source`` .\n\nSingle File\n^^^^^^^^^^^\n\n::\n\n $ agen -s single.txt -o output.txt -c context.json\n\nDirectory\n^^^^^^^^^\n\nAny directory, such as\n\n::\n\n directory\n \u251c\u2500\u2500 __init__.py\n \u2514\u2500\u2500 {{key}}.py\n\nboth could be ``source``, it also support to use template variable to\nrender the output file name.\n\n::\n\n $ agen -s directory -o myapp -c context.json\n\nThis command will create a directory named ``myapp``, and processing\nrecursively all files under the ``directory`` , output to ``myapp`` base\non origin structure.\n\nRepository\n^^^^^^^^^^\n\n.. Note:: agen is not designed as a command line tool, so for generating repository, recommend to use the awesome `Cookiecutter `__ .\n\nIf there is an inner folder in a directory, and the directory has a\n``agen.json`` or ``agen.yaml`` , it will be judged as a\n``Repo``\\ \uff0c\n\n::\n\n repo\n \u251c\u2500\u2500 README.md\n \u251c\u2500\u2500 agen.json\n \u2514\u2500\u2500 {{name}}\n \u251c\u2500\u2500 __init__.py\n \u2514\u2500\u2500 {{name}}.py\n\nThe default behavior of this tool will be changed, assuming this\n**Repo**\n\n::\n\n $ agen -s repo -o output -c context.json\n\n- This command will create a folder has the same name with inner\n directory to ``output`` directory, if the name of folder is a\n template string, it will be compiled as standard string then create a\n folder, the other behavior same as ``directory`` .\n- The ``context`` is not required. If it wasn't provided, it will load\n the ``agen.[json|yaml]`` file, and prompt user for input.\n\nExample\n^^^^^^^\n\nFor **context** ``{'key': 'value'}``\uff0c**output** is current\ndirectory, current value:\n\n::\n\n .\n \u2514\u2500\u2500 value\n \u251c\u2500\u2500 __init__.py\n \u2514\u2500\u2500 value.py\n\nLocal Template Directory\n''''''''''''''''''''''''\n\nUse option argument ``NAMES``, could get files path from local templates\ndirectory as ``source`` . The following two calls are equivalent in\n\\*NIX systems:\n\n::\n\n $ agen -s ~/.agen/templates/single.txt\n $ agen single.txt\n\nCredits\n-------\n\n- Author : Yufei Li yufeiminds@gmail.com\n- Contact me: @yufeiminds (Facebook)\u3001@YufeiMinds (Sina Weibo)\n\nContribution\n------------\n\nWelcome to develop with me!\n\nFork this repo & develop it.\n\n", "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/yufeiminds/agen", "keywords": "agen", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "agen", "package_url": "https://pypi.org/project/agen/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/agen/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/yufeiminds/agen" }, "release_url": "https://pypi.org/project/agen/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "A very simple code generator.", "version": "0.1.1" }, "last_serial": 2015645, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "35855eaccc3ecd0dd037faa758bb83ad", "sha256": "13e6580d179ff9a3b25606633fd1f81f3ce1a21fe9865d3759b45e1d48435d23" }, "downloads": -1, "filename": "agen-0.1.1.tar.gz", "has_sig": false, "md5_digest": "35855eaccc3ecd0dd037faa758bb83ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9389, "upload_time": "2016-03-19T10:32:48", "url": "https://files.pythonhosted.org/packages/46/f9/fe1780c264bd158a9f79db7f6d89cd95c5a883dcdc9aab742c1163360db0/agen-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "35855eaccc3ecd0dd037faa758bb83ad", "sha256": "13e6580d179ff9a3b25606633fd1f81f3ce1a21fe9865d3759b45e1d48435d23" }, "downloads": -1, "filename": "agen-0.1.1.tar.gz", "has_sig": false, "md5_digest": "35855eaccc3ecd0dd037faa758bb83ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9389, "upload_time": "2016-03-19T10:32:48", "url": "https://files.pythonhosted.org/packages/46/f9/fe1780c264bd158a9f79db7f6d89cd95c5a883dcdc9aab742c1163360db0/agen-0.1.1.tar.gz" } ] }