pipfromrepl


Namepipfromrepl JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/asweigart/pipfromrepl
SummaryRun pip to install packages from the Python interactive shell aka REPL.
upload_time2023-03-16 20:41:43
maintainer
docs_urlNone
authorAl Sweigart
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Pip From REPL
======

Run pip to install packages from the Python interactive shell aka REPL.

If you are leading a programming workshop and want to avoid headaches of running pip from students' machines (with all their possible environment configurations), pipfromrepl provides a single set of instructions to quickly get packages correctly installed.

The benefit of pipfromrepl is that the user doesn't need to know how to navigate the command-line or have their PATH environment variables set up. If multiple versions of Python are installed, pipfromrepl uses the pip module associated with the currently running interactive shell. The goal of pipfromrepl is to reduce the number of steps that students and beginners need to take to get Python packages installed on their computer.

Pipfromrepl is meant to assist students and instructors. It's probably a good idea to not rely on it in production environments.

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

To install pipfromrepl from the REPL, copy and paste the following into the REPL:

    import subprocess, sys; subprocess.run([sys.executable, '-m', 'pip', 'install', 'pipfromrepl'])

Pipfromrepl works on Python 2.7 and Python 3.4+. Linux users may need to install pip separately by running `sudo apt-get install python3-pip` from a Terminal.


Quickstart Guide
----------------

After installing pipfromrepl, run `import pipfromrepl`:

    >>> import pipfromrepl

Call `pipfromrepl.install()` to install a package from PyPI:

    >>> pipfromrepl.install('pymsgbox')
    Collecting pymsgbox
      Using cached PyMsgBox-1.0.9-py3-none-any.whl
    Installing collected packages: pymsgbox
    Successfully installed pymsgbox-1.0.9

Call `pipfromrepl.list()` to list the installed packages:

    >>> pipfromrepl.list()
    Package     Version Editable project location
    ----------- ------- -------------------------
    pip         22.3.1
    pipfromrepl 0.1.0   C:\github\pipfromrepl
    PyMsgBox    1.0.9
    setuptools  65.5.1
    wheel       0.37.1

Call `pipfromrepl.uninstall()` to uninstall a package:

    >>> pipfromrepl.uninstall('pymsgbox')
    Found existing installation: PyMsgBox 1.0.9
    Uninstalling PyMsgBox-1.0.9:
      Would remove:
        c:\users\al\.virtualenvs\pipfromrepl-fxbqt5ki\lib\site-packages\pymsgbox-1.0.9.dist-info\*
        c:\users\al\.virtualenvs\pipfromrepl-fxbqt5ki\lib\site-packages\pymsgbox\*
    Proceed (Y/n)?   Successfully uninstalled PyMsgBox-1.0.9


Additional Details
----------------

The `uninstall()` function has a `confirm` keyword argument you can set to `True` to force the user to manually enter Y to proceed.

The `user_install()` function passes the `'--user'` argument to pip.

You can install a specific version just like pip: `pipfromrepl.install('pymsgbox==1.0.9')`

You can pass pip commands to pip directly with the `pip()` functions:

    >>> import pipfromrepl

    >>> pipfromrepl.pip('install pymsgbox')
    Collecting pymsgbox
      Using cached PyMsgBox-1.0.9-py3-none-any.whl
    Installing collected packages: pymsgbox
    Successfully installed pymsgbox-1.0.9

    >>> pipfromrepl.pip('list')
    Package          Version    Editable project location
    ---------------- ---------- -------------------------
    certifi          2022.9.24
    distlib          0.3.6
    filelock         3.8.0
    pip              22.3.1
    pipenv           2022.11.11
    pipfromrepl      0.1.0      C:\github\pipfromrepl
    platformdirs     2.5.4
    PyMsgBox         1.0.9
    setuptools       65.5.1
    virtualenv       20.16.7
    virtualenv-clone 0.5.7
    wheel            0.37.1

    >>> pipfromrepl.pip('uninstall pymsgbox')
    Found existing installation: PyMsgBox 1.0.9
    Uninstalling PyMsgBox-1.0.9:
      Would remove:
        c:\users\al\.virtualenvs\pipfromrepl-fxbqt5ki\lib\site-packages\pymsgbox-1.0.9.dist-info\*
        c:\users\al\.virtualenvs\pipfromrepl-fxbqt5ki\lib\site-packages\pymsgbox\*
    Proceed (Y/n)? y
      Successfully uninstalled PyMsgBox-1.0.9

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/asweigart/pipfromrepl",
    "name": "pipfromrepl",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Al Sweigart",
    "author_email": "al@inventwithpython.com",
    "download_url": "https://files.pythonhosted.org/packages/6d/7f/b760d1f84f5a83c49f6a7758dafce17b1a913033e908f9de1aba95fa611a/pipfromrepl-0.1.5.tar.gz",
    "platform": null,
    "description": "Pip From REPL\r\n======\r\n\r\nRun pip to install packages from the Python interactive shell aka REPL.\r\n\r\nIf you are leading a programming workshop and want to avoid headaches of running pip from students' machines (with all their possible environment configurations), pipfromrepl provides a single set of instructions to quickly get packages correctly installed.\r\n\r\nThe benefit of pipfromrepl is that the user doesn't need to know how to navigate the command-line or have their PATH environment variables set up. If multiple versions of Python are installed, pipfromrepl uses the pip module associated with the currently running interactive shell. The goal of pipfromrepl is to reduce the number of steps that students and beginners need to take to get Python packages installed on their computer.\r\n\r\nPipfromrepl is meant to assist students and instructors. It's probably a good idea to not rely on it in production environments.\r\n\r\nInstallation\r\n------------\r\n\r\nTo install pipfromrepl from the REPL, copy and paste the following into the REPL:\r\n\r\n    import subprocess, sys; subprocess.run([sys.executable, '-m', 'pip', 'install', 'pipfromrepl'])\r\n\r\nPipfromrepl works on Python 2.7 and Python 3.4+. Linux users may need to install pip separately by running `sudo apt-get install python3-pip` from a Terminal.\r\n\r\n\r\nQuickstart Guide\r\n----------------\r\n\r\nAfter installing pipfromrepl, run `import pipfromrepl`:\r\n\r\n    >>> import pipfromrepl\r\n\r\nCall `pipfromrepl.install()` to install a package from PyPI:\r\n\r\n    >>> pipfromrepl.install('pymsgbox')\r\n    Collecting pymsgbox\r\n      Using cached PyMsgBox-1.0.9-py3-none-any.whl\r\n    Installing collected packages: pymsgbox\r\n    Successfully installed pymsgbox-1.0.9\r\n\r\nCall `pipfromrepl.list()` to list the installed packages:\r\n\r\n    >>> pipfromrepl.list()\r\n    Package     Version Editable project location\r\n    ----------- ------- -------------------------\r\n    pip         22.3.1\r\n    pipfromrepl 0.1.0   C:\\github\\pipfromrepl\r\n    PyMsgBox    1.0.9\r\n    setuptools  65.5.1\r\n    wheel       0.37.1\r\n\r\nCall `pipfromrepl.uninstall()` to uninstall a package:\r\n\r\n    >>> pipfromrepl.uninstall('pymsgbox')\r\n    Found existing installation: PyMsgBox 1.0.9\r\n    Uninstalling PyMsgBox-1.0.9:\r\n      Would remove:\r\n        c:\\users\\al\\.virtualenvs\\pipfromrepl-fxbqt5ki\\lib\\site-packages\\pymsgbox-1.0.9.dist-info\\*\r\n        c:\\users\\al\\.virtualenvs\\pipfromrepl-fxbqt5ki\\lib\\site-packages\\pymsgbox\\*\r\n    Proceed (Y/n)?   Successfully uninstalled PyMsgBox-1.0.9\r\n\r\n\r\nAdditional Details\r\n----------------\r\n\r\nThe `uninstall()` function has a `confirm` keyword argument you can set to `True` to force the user to manually enter Y to proceed.\r\n\r\nThe `user_install()` function passes the `'--user'` argument to pip.\r\n\r\nYou can install a specific version just like pip: `pipfromrepl.install('pymsgbox==1.0.9')`\r\n\r\nYou can pass pip commands to pip directly with the `pip()` functions:\r\n\r\n    >>> import pipfromrepl\r\n\r\n    >>> pipfromrepl.pip('install pymsgbox')\r\n    Collecting pymsgbox\r\n      Using cached PyMsgBox-1.0.9-py3-none-any.whl\r\n    Installing collected packages: pymsgbox\r\n    Successfully installed pymsgbox-1.0.9\r\n\r\n    >>> pipfromrepl.pip('list')\r\n    Package          Version    Editable project location\r\n    ---------------- ---------- -------------------------\r\n    certifi          2022.9.24\r\n    distlib          0.3.6\r\n    filelock         3.8.0\r\n    pip              22.3.1\r\n    pipenv           2022.11.11\r\n    pipfromrepl      0.1.0      C:\\github\\pipfromrepl\r\n    platformdirs     2.5.4\r\n    PyMsgBox         1.0.9\r\n    setuptools       65.5.1\r\n    virtualenv       20.16.7\r\n    virtualenv-clone 0.5.7\r\n    wheel            0.37.1\r\n\r\n    >>> pipfromrepl.pip('uninstall pymsgbox')\r\n    Found existing installation: PyMsgBox 1.0.9\r\n    Uninstalling PyMsgBox-1.0.9:\r\n      Would remove:\r\n        c:\\users\\al\\.virtualenvs\\pipfromrepl-fxbqt5ki\\lib\\site-packages\\pymsgbox-1.0.9.dist-info\\*\r\n        c:\\users\\al\\.virtualenvs\\pipfromrepl-fxbqt5ki\\lib\\site-packages\\pymsgbox\\*\r\n    Proceed (Y/n)? y\r\n      Successfully uninstalled PyMsgBox-1.0.9\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Run pip to install packages from the Python interactive shell aka REPL.",
    "version": "0.1.5",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6d7fb760d1f84f5a83c49f6a7758dafce17b1a913033e908f9de1aba95fa611a",
                "md5": "5d85553fd75bdb88fc2d14ece622c5b7",
                "sha256": "fb1e5edd592a96ff6b108908692d3361c5676dcc2e424a566d97377518f5a274"
            },
            "downloads": -1,
            "filename": "pipfromrepl-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "5d85553fd75bdb88fc2d14ece622c5b7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4104,
            "upload_time": "2023-03-16T20:41:43",
            "upload_time_iso_8601": "2023-03-16T20:41:43.006684Z",
            "url": "https://files.pythonhosted.org/packages/6d/7f/b760d1f84f5a83c49f6a7758dafce17b1a913033e908f9de1aba95fa611a/pipfromrepl-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-16 20:41:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "asweigart",
    "github_project": "pipfromrepl",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pipfromrepl"
}
        
Elapsed time: 0.06054s