python-editor


Namepython-editor JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://github.com/fmoo/python-editor
SummaryProgrammatically open an editor, capture the result.
upload_time2019-02-01 07:33:13
maintainer
docs_urlNone
authorPeter Ruibal
requires_python
licenseApache
keywords editor library vim emacs
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            `python-editor` is a library that provides the `editor` module for programmatically
interfacing with your system's $EDITOR.

Examples
--------

```python
import editor
commit_msg = editor.edit(contents=b"# Enter commit message here")
```

Opens an editor, prefilled with the contents, `# Enter commit message here`.
When the editor is closed, returns the contents (bytes) in variable `commit_msg`.
Note that the argument to `contents` needs to be a bytes object on Python 3.


```python
editor.edit(file="README.txt")
```

Opens README.txt in an editor.  Changes are saved in place.  If there is
a `contents` argument then the file contents will be overwritten.

```python
editor.edit(..., use_tty=True)
```

Opens the editor in a TTY.  This is usually done in programs which output is
piped to other programs.  In this case the TTY is used as the editor's stdout,
allowing interactive usage.


How it Works
------------

`editor` first looks for the ${EDITOR} environment variable.  If set, it uses
the value as-is, without fallbacks.

If no $EDITOR is set, editor will search through a list of known editors, and
use the first one that exists on the system.

For example, on Linux, `editor` will look for the following editors in order:

* vim
* emacs
* nano

When calling `editor.edit`, an editor will be opened in a subprocess, inheriting
the parent process's stdin, stdout.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fmoo/python-editor",
    "name": "python-editor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "editor library vim emacs",
    "author": "Peter Ruibal",
    "author_email": "ruibalp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0a/85/78f4a216d28343a67b7397c99825cff336330893f00601443f7c7b2f2234/python-editor-1.0.4.tar.gz",
    "platform": "",
    "description": "`python-editor` is a library that provides the `editor` module for programmatically\ninterfacing with your system's $EDITOR.\n\nExamples\n--------\n\n```python\nimport editor\ncommit_msg = editor.edit(contents=b\"# Enter commit message here\")\n```\n\nOpens an editor, prefilled with the contents, `# Enter commit message here`.\nWhen the editor is closed, returns the contents (bytes) in variable `commit_msg`.\nNote that the argument to `contents` needs to be a bytes object on Python 3.\n\n\n```python\neditor.edit(file=\"README.txt\")\n```\n\nOpens README.txt in an editor.  Changes are saved in place.  If there is\na `contents` argument then the file contents will be overwritten.\n\n```python\neditor.edit(..., use_tty=True)\n```\n\nOpens the editor in a TTY.  This is usually done in programs which output is\npiped to other programs.  In this case the TTY is used as the editor's stdout,\nallowing interactive usage.\n\n\nHow it Works\n------------\n\n`editor` first looks for the ${EDITOR} environment variable.  If set, it uses\nthe value as-is, without fallbacks.\n\nIf no $EDITOR is set, editor will search through a list of known editors, and\nuse the first one that exists on the system.\n\nFor example, on Linux, `editor` will look for the following editors in order:\n\n* vim\n* emacs\n* nano\n\nWhen calling `editor.edit`, an editor will be opened in a subprocess, inheriting\nthe parent process's stdin, stdout.\n\n\n",
    "bugtrack_url": null,
    "license": "Apache",
    "summary": "Programmatically open an editor, capture the result.",
    "version": "1.0.4",
    "split_keywords": [
        "editor",
        "library",
        "vim",
        "emacs"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "95ddcf2f37857bb4d06b3bcce537fd6a",
                "sha256": "ea87e17f6ec459e780e4221f295411462e0d0810858e055fc514684350a2f522"
            },
            "downloads": -1,
            "filename": "python_editor-1.0.4-py2.7.egg",
            "has_sig": false,
            "md5_digest": "95ddcf2f37857bb4d06b3bcce537fd6a",
            "packagetype": "bdist_egg",
            "python_version": "2.7",
            "requires_python": null,
            "size": 5028,
            "upload_time": "2019-02-01T07:33:14",
            "upload_time_iso_8601": "2019-02-01T07:33:14.836112Z",
            "url": "https://files.pythonhosted.org/packages/bc/e3/019ed6d1a5a5e837739de55cda27b2f03045c9f9d84054b97e79a86fe2fc/python_editor-1.0.4-py2.7.egg",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "fc42eeb8edc379020c4a5983daef4941",
                "sha256": "5f98b069316ea1c2ed3f67e7f5df6c0d8f10b689964a4a811ff64f0106819ec8"
            },
            "downloads": -1,
            "filename": "python_editor-1.0.4-py2-none-any.whl",
            "has_sig": false,
            "md5_digest": "fc42eeb8edc379020c4a5983daef4941",
            "packagetype": "bdist_wheel",
            "python_version": "py2",
            "requires_python": null,
            "size": 4877,
            "upload_time": "2019-02-01T07:33:11",
            "upload_time_iso_8601": "2019-02-01T07:33:11.198775Z",
            "url": "https://files.pythonhosted.org/packages/55/a0/3c0ba1c10f2ca381645dd46cb7afbb73fddc8de9f957e1f9e726a846eabc/python_editor-1.0.4-py2-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "4bacb5fdc2027939c6c60228544fb551",
                "sha256": "c3da2053dbab6b29c94e43c486ff67206eafbe7eb52dbec7390b5e2fb05aac77"
            },
            "downloads": -1,
            "filename": "python_editor-1.0.4-py3.5.egg",
            "has_sig": false,
            "md5_digest": "4bacb5fdc2027939c6c60228544fb551",
            "packagetype": "bdist_egg",
            "python_version": "3.5",
            "requires_python": null,
            "size": 3072,
            "upload_time": "2019-02-01T07:33:16",
            "upload_time_iso_8601": "2019-02-01T07:33:16.069231Z",
            "url": "https://files.pythonhosted.org/packages/52/34/477695c3a37d921dba1bd0856c756525276bd42adc7ccfc6bf82f3778a26/python_editor-1.0.4-py3.5.egg",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "620d31cf0d2f25a2da21852f5a1a6090",
                "sha256": "1bf6e860a8ad52a14c3ee1252d5dc25b2030618ed80c022598f00176adc8367d"
            },
            "downloads": -1,
            "filename": "python_editor-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "620d31cf0d2f25a2da21852f5a1a6090",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4877,
            "upload_time": "2019-02-01T07:33:12",
            "upload_time_iso_8601": "2019-02-01T07:33:12.470845Z",
            "url": "https://files.pythonhosted.org/packages/c6/d3/201fc3abe391bbae6606e6f1d598c15d367033332bd54352b12f35513717/python_editor-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "0e52648a4a6e7c89e3be44e9456530b4",
                "sha256": "51fda6bcc5ddbbb7063b2af7509e43bd84bfc32a4ff71349ec7847713882327b"
            },
            "downloads": -1,
            "filename": "python-editor-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "0e52648a4a6e7c89e3be44e9456530b4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7132,
            "upload_time": "2019-02-01T07:33:13",
            "upload_time_iso_8601": "2019-02-01T07:33:13.653942Z",
            "url": "https://files.pythonhosted.org/packages/0a/85/78f4a216d28343a67b7397c99825cff336330893f00601443f7c7b2f2234/python-editor-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2019-02-01 07:33:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "fmoo",
    "github_project": "python-editor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "python-editor"
}
        
Elapsed time: 2.75264s