File: python.py

package info (click to toggle)
python-pynvim 0.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 424 kB
  • sloc: python: 3,067; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 901 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Wrapper to expose the Python interpreter as `pynvim-python`.

`setup.py` declares an entry point for the `main()` function below. When
`pynvim` is installed, an executable named `pynvim-python` will be generated
that will invoke `main()` below; that function then simply chains to the
underlying Python interpreter, passing along all command-line arguments.

The intent is to have `pynvim-python` be on the `PATH` such that an invocation
such as:

    pynvim-python -c 'import pynvim'

is equivalent to explicitly running the correct Python interpreter where
`pynvim` is installed:

    /path/to/python -c 'import pynvim'

This allows Neovim to automatically detect the correct Python interpreter for
use with `pynvim`.
"""

import subprocess
import sys


def main() -> None:
    """Chain to Python interpreter, passing all command-line args."""
    subprocess.run([sys.executable] + sys.argv[1:])