docpie


Namedocpie JSON
Version 0.4.4 PyPI version JSON
download
home_pagehttp://docpie.comes.today/
SummaryAn easy and Pythonic way to create your POSIX command line interface
upload_time2023-05-16 06:00:26
maintainer
docs_urlNone
authorTylerTemp
requires_python
licenseMIT
keywords option arguments parsing optparse argparse getopt docopt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            .. docpie
.. README.rst

docpie
======

`An easy and Pythonic way to create your POSIX command line`

View on: `GitHub <https://github.com/TylerTemp/docpie/>`__ /
`PyPi <https://pypi.org/project/docpie/>`__

.. image:: https://travis-ci.org/TylerTemp/docpie.svg?branch=master
    :target: https://travis-ci.org/TylerTemp/docpie

.. contents::

ChangeLog
---------

version 0.4.4:

change auto balance function, fix the issue that won't work for this case

.. code-block:: python

    """
    Usage:
        cp [options] <source>... <target>

    Options:
        -R
    """

Summary
-------

How do you define your command line interface?
Write a parse by yourself or spend hours learning ``optparse`` / ``argparse`` ,
and modify both code side and document every time you update the interface?


Life is short, man! You can simply do it this way:

.. code:: python

   """
   My copy script

   Usage:
     cp.py [options] <source_file> <target_file>
     cp.py [options] <source_file>... <target_directory>

   Options:
     -h -? --help    print this screen
     --version       print the version of this script
     -v --verbose    print more information while  running
   """

   from docpie import docpie
   args = docpie(__doc__)
   print(args)

Now run it

.. code:: bash

   $ python cp.py a.txt b.txt c.txt /tmp
   {'--': False,
    '--help': False,
    '--verbose': False,
    '--version': False,
    '-?': False,
    '-h': False,
    '-v': False,
    '<source_file>': ['a.txt', 'b.txt', 'c.txt'],
    '<target_directory>': '/tmp',
    '<target_file>': None}

Write a ``__doc__``, pass it to a function, DONE! Isn't it simple?

`try it \>\> <http://docpie.comes.today/try?argvnofilestr=a.txt%20b.txt%20c.txt%20%2Ftmp&attachopt=on&attachvalue=on&auto2dashes=on&doc=My%20copy%20script%5Cn%5CnUsage%3A%5Cn%20%20cp.py%20%5Boptions%5D%20%3Csource_file%3E%20%3Ctarget_file%3E%5Cn%20%20cp.py%20%5Boptions%5D%20%3Csource_file%3E...%20%3Ctarget_directory%3E%5Cn%5CnOptions%3A%5Cn%20%20-h%20-%3F%20--help%20%20%20%20print%20this%20screen%5Cn%20%20--version%20%20%20%20%20%20%20print%20the%20version%20of%20this%20script%5Cn%20%20-v%20--verbose%20%20%20%20print%20more%20information%20while%20%20running&help=on&replace=on&stdopt=on>`__

Installation
------------

Install release version:

.. code:: python

    pip install docpie

Install nightly/dev version:

.. code:: bash

    pip install git+https://github.com/TylerTemp/docpie.git@dev

``docpie`` has been tested with Python:

-   2.6, 2.7, pypy-2.0, pypy-2.6
-   3.2, 3.3, 3.4, 3.5, pypy3-2.4

You can run test suit by ``python setup.py test``

Get Start!
----------

Interested? Visit `Wiki <https://github.com/TylerTemp/docpie/wiki>`__
and get start!

Or you can `try it in your browser <http://docpie.comes.today/try/>`__

Why docpie?
-----------

``docpie`` can greatly reduce the work you need to be done for
command-line interface. What you see is what you get.
Every time you only need to update your document, and keep the
code unchanged.

See `here <https://github.com/TylerTemp/docpie/wiki/Why-docpie>`__ for more reasons.

Reference
---------

the code in ``bashlog.py`` is taken from
`tornado <https://github.com/tornadoweb/tornado>`__, and
``tracemore.py`` is from `python
Cookbook <http://www.amazon.com/Python-Cookbook-Third-David-Beazley/dp/1449340377/ref=sr_1_1?ie=UTF8&qid=1440593849&sr=8-1&keywords=python+cookbook>`__

Many examples & tests are from ``docopt``.

License
-------

``docpie`` is released under
`MIT-License <https://github.com/TylerTemp/docpie/blob/master/LICENSE>`__

Donate
------

If you like this project, you can buy me a beer so I can make it better!

.. image:: https://dn-tyler.qbox.me/alipay.ico
    :target: https://dn-tyler.qbox.me/myalipay.png

.. image:: https://button.flattr.com/flattr-badge-large.png
    :target: https://flattr.com/submit/auto?user_id=TylerTemp&url=http%3A%2F%2Fdocpie.comes.today

            

Raw data

            {
    "_id": null,
    "home_page": "http://docpie.comes.today/",
    "name": "docpie",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "option arguments parsing optparse argparse getopt docopt",
    "author": "TylerTemp",
    "author_email": "tylertempdev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/83/42/9b0b88affd76778b2dd88a15d930c8d84e45e20fe843c5305ec5b35bc443/docpie-0.4.4.tar.gz",
    "platform": "any",
    "description": ".. docpie\r\n.. README.rst\r\n\r\ndocpie\r\n======\r\n\r\n`An easy and Pythonic way to create your POSIX command line`\r\n\r\nView on: `GitHub <https://github.com/TylerTemp/docpie/>`__ /\r\n`PyPi <https://pypi.org/project/docpie/>`__\r\n\r\n.. image:: https://travis-ci.org/TylerTemp/docpie.svg?branch=master\r\n    :target: https://travis-ci.org/TylerTemp/docpie\r\n\r\n.. contents::\r\n\r\nChangeLog\r\n---------\r\n\r\nversion 0.4.4:\r\n\r\nchange auto balance function, fix the issue that won't work for this case\r\n\r\n.. code-block:: python\r\n\r\n    \"\"\"\r\n    Usage:\r\n        cp [options] <source>... <target>\r\n\r\n    Options:\r\n        -R\r\n    \"\"\"\r\n\r\nSummary\r\n-------\r\n\r\nHow do you define your command line interface?\r\nWrite a parse by yourself or spend hours learning ``optparse`` / ``argparse`` ,\r\nand modify both code side and document every time you update the interface?\r\n\r\n\r\nLife is short, man! You can simply do it this way:\r\n\r\n.. code:: python\r\n\r\n   \"\"\"\r\n   My copy script\r\n\r\n   Usage:\r\n     cp.py [options] <source_file> <target_file>\r\n     cp.py [options] <source_file>... <target_directory>\r\n\r\n   Options:\r\n     -h -? --help    print this screen\r\n     --version       print the version of this script\r\n     -v --verbose    print more information while  running\r\n   \"\"\"\r\n\r\n   from docpie import docpie\r\n   args = docpie(__doc__)\r\n   print(args)\r\n\r\nNow run it\r\n\r\n.. code:: bash\r\n\r\n   $ python cp.py a.txt b.txt c.txt /tmp\r\n   {'--': False,\r\n    '--help': False,\r\n    '--verbose': False,\r\n    '--version': False,\r\n    '-?': False,\r\n    '-h': False,\r\n    '-v': False,\r\n    '<source_file>': ['a.txt', 'b.txt', 'c.txt'],\r\n    '<target_directory>': '/tmp',\r\n    '<target_file>': None}\r\n\r\nWrite a ``__doc__``, pass it to a function, DONE! Isn't it simple?\r\n\r\n`try it \\>\\> <http://docpie.comes.today/try?argvnofilestr=a.txt%20b.txt%20c.txt%20%2Ftmp&attachopt=on&attachvalue=on&auto2dashes=on&doc=My%20copy%20script%5Cn%5CnUsage%3A%5Cn%20%20cp.py%20%5Boptions%5D%20%3Csource_file%3E%20%3Ctarget_file%3E%5Cn%20%20cp.py%20%5Boptions%5D%20%3Csource_file%3E...%20%3Ctarget_directory%3E%5Cn%5CnOptions%3A%5Cn%20%20-h%20-%3F%20--help%20%20%20%20print%20this%20screen%5Cn%20%20--version%20%20%20%20%20%20%20print%20the%20version%20of%20this%20script%5Cn%20%20-v%20--verbose%20%20%20%20print%20more%20information%20while%20%20running&help=on&replace=on&stdopt=on>`__\r\n\r\nInstallation\r\n------------\r\n\r\nInstall release version:\r\n\r\n.. code:: python\r\n\r\n    pip install docpie\r\n\r\nInstall nightly/dev version:\r\n\r\n.. code:: bash\r\n\r\n    pip install git+https://github.com/TylerTemp/docpie.git@dev\r\n\r\n``docpie`` has been tested with Python:\r\n\r\n-   2.6, 2.7, pypy-2.0, pypy-2.6\r\n-   3.2, 3.3, 3.4, 3.5, pypy3-2.4\r\n\r\nYou can run test suit by ``python setup.py test``\r\n\r\nGet Start!\r\n----------\r\n\r\nInterested? Visit `Wiki <https://github.com/TylerTemp/docpie/wiki>`__\r\nand get start!\r\n\r\nOr you can `try it in your browser <http://docpie.comes.today/try/>`__\r\n\r\nWhy docpie?\r\n-----------\r\n\r\n``docpie`` can greatly reduce the work you need to be done for\r\ncommand-line interface. What you see is what you get.\r\nEvery time you only need to update your document, and keep the\r\ncode unchanged.\r\n\r\nSee `here <https://github.com/TylerTemp/docpie/wiki/Why-docpie>`__ for more reasons.\r\n\r\nReference\r\n---------\r\n\r\nthe code in ``bashlog.py`` is taken from\r\n`tornado <https://github.com/tornadoweb/tornado>`__, and\r\n``tracemore.py`` is from `python\r\nCookbook <http://www.amazon.com/Python-Cookbook-Third-David-Beazley/dp/1449340377/ref=sr_1_1?ie=UTF8&qid=1440593849&sr=8-1&keywords=python+cookbook>`__\r\n\r\nMany examples & tests are from ``docopt``.\r\n\r\nLicense\r\n-------\r\n\r\n``docpie`` is released under\r\n`MIT-License <https://github.com/TylerTemp/docpie/blob/master/LICENSE>`__\r\n\r\nDonate\r\n------\r\n\r\nIf you like this project, you can buy me a beer so I can make it better!\r\n\r\n.. image:: https://dn-tyler.qbox.me/alipay.ico\r\n    :target: https://dn-tyler.qbox.me/myalipay.png\r\n\r\n.. image:: https://button.flattr.com/flattr-badge-large.png\r\n    :target: https://flattr.com/submit/auto?user_id=TylerTemp&url=http%3A%2F%2Fdocpie.comes.today\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An easy and Pythonic way to create your POSIX command line interface",
    "version": "0.4.4",
    "project_urls": {
        "Download": "https://github.com/TylerTemp/docpie/tarball/0.4.4/",
        "Homepage": "http://docpie.comes.today/"
    },
    "split_keywords": [
        "option",
        "arguments",
        "parsing",
        "optparse",
        "argparse",
        "getopt",
        "docopt"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "200787705358040cdedef5c79463f756798be498a88de43096b6e07362158e0b",
                "md5": "82721dae5635cc0a5349c32462cf45fd",
                "sha256": "c868a465dfc69b8b71a564761ff69d42652268672fafd58f0f596a47e481e809"
            },
            "downloads": -1,
            "filename": "docpie-0.4.4-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "82721dae5635cc0a5349c32462cf45fd",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 70128,
            "upload_time": "2023-05-16T06:00:23",
            "upload_time_iso_8601": "2023-05-16T06:00:23.837117Z",
            "url": "https://files.pythonhosted.org/packages/20/07/87705358040cdedef5c79463f756798be498a88de43096b6e07362158e0b/docpie-0.4.4-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83429b0b88affd76778b2dd88a15d930c8d84e45e20fe843c5305ec5b35bc443",
                "md5": "6972788270fd18bb37ffd38805e9f3f0",
                "sha256": "c17cad09698a03e00174df1cc21090af88668f07ba854954fe81065873258bb6"
            },
            "downloads": -1,
            "filename": "docpie-0.4.4.tar.gz",
            "has_sig": false,
            "md5_digest": "6972788270fd18bb37ffd38805e9f3f0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 66606,
            "upload_time": "2023-05-16T06:00:26",
            "upload_time_iso_8601": "2023-05-16T06:00:26.569735Z",
            "url": "https://files.pythonhosted.org/packages/83/42/9b0b88affd76778b2dd88a15d930c8d84e45e20fe843c5305ec5b35bc443/docpie-0.4.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-16 06:00:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TylerTemp",
    "github_project": "docpie",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "docpie"
}
        
Elapsed time: 0.06411s