{"id":13415341,"url":"https://github.com/sjkingo/virtualenv-api","last_synced_at":"2025-04-06T07:15:54.550Z","repository":{"id":7639796,"uuid":"9000019","full_name":"sjkingo/virtualenv-api","owner":"sjkingo","description":"An API for virtualenv/pip","archived":false,"fork":false,"pushed_at":"2023-01-02T15:41:18.000Z","size":139,"stargazers_count":129,"open_issues_count":13,"forks_count":21,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T06:08:20.419Z","etag":null,"topics":["python","python-2","python-3","virtualenv"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sjkingo.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-25T06:14:57.000Z","updated_at":"2024-11-28T16:31:29.000Z","dependencies_parsed_at":"2023-01-13T14:27:09.899Z","dependency_job_id":null,"html_url":"https://github.com/sjkingo/virtualenv-api","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjkingo%2Fvirtualenv-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjkingo%2Fvirtualenv-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjkingo%2Fvirtualenv-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjkingo%2Fvirtualenv-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sjkingo","download_url":"https://codeload.github.com/sjkingo/virtualenv-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445682,"owners_count":20939961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","python-2","python-3","virtualenv"],"created_at":"2024-07-30T21:00:47.363Z","updated_at":"2025-04-06T07:15:54.523Z","avatar_url":"https://github.com/sjkingo.png","language":"Python","funding_links":[],"categories":["Environment Management","Python"],"sub_categories":[],"readme":"virtualenv-api - an API for virtualenv\n======================================\n\n|Build Status|\n|Latest version|\n|BSD License|\n\n`virtualenv`_ is a tool to create isolated Python environments. Unfortunately,\nit does not expose a native Python API.  This package aims to provide an API in\nthe form of a wrapper around virtualenv.\n\nIt can be used to create and delete environments and perform package management\ninside the environment.\n\nFull support is provided for all supported versions of Python.\n\n.. _virtualenv: http://www.virtualenv.org/\n.. |Build Status| image:: https://travis-ci.org/sjkingo/virtualenv-api.svg\n   :target: https://travis-ci.org/sjkingo/virtualenv-api\n.. |Latest version| image:: https://img.shields.io/pypi/v/virtualenv-api.svg\n   :target: https://pypi.python.org/pypi/virtualenv-api\n.. |BSD License| image:: https://img.shields.io/pypi/l/virtualenv-api.svg\n   :target: https://github.com/sjkingo/virtualenv-api/blob/master/LICENSE\n\n\nInstallation\n------------\n\nThe latest stable release is available on `PyPi`_:\n\n::\n\n    $ pip install virtualenv-api\n\nPlease note that the distribution is named ``virtualenv-api``, yet the Python\npackage is named ``virtualenvapi``.\n\nAlternatively, you may fetch the latest version from git:\n\n::\n\n    $ pip install git+https://github.com/sjkingo/virtualenv-api.git\n\n.. _PyPi: https://pypi.python.org/pypi/virtualenv-api\n\nUsage\n-----\n\nTo begin managing an environment (it will be created if it does not exist):\n\n.. code:: python\n\n    from virtualenvapi.manage import VirtualEnvironment\n    env = VirtualEnvironment('/path/to/environment/name')\n\nIf you have already activated a virtualenv and wish to operate on it, simply\ncall ``VirtualEnvironment`` without the path argument:\n\n.. code:: python\n\n    env = VirtualEnvironment()\n\nThe `VirtualEnvironment` constructor takes some optional arguments (their defaults are shown below):\n\n* ``python=None`` - specify the Python interpreter to use. Defaults to the default system interpreter *(new in 2.1.3)*\n* ``cache=None`` - existing directory to override the default pip download cache\n* ``readonly=False`` - prevent all operations that could potentially modify the environment *(new in 2.1.7)*\n* ``system_site_packages=False`` - include system site packages in operations on the environment *(new in 2.1.14)*\n\nOperations\n----------\n\nOnce you have a `VirtualEnvironment` object, you can perform operations on it.\n\n-  Check if the ``mezzanine`` package is installed:\n\n.. code:: python\n\n    \u003e\u003e\u003e env.is_installed('mezzanine')\n    False\n\n-  Install the latest version of the ``mezzanine`` package:\n\n.. code:: python\n\n    \u003e\u003e\u003e env.install('mezzanine')\n\n-  A wheel of the latest version of the ``mezzanine`` package (new in\n   2.1.4):\n\n.. code:: python\n\n    \u003e\u003e\u003e env.wheel('mezzanine')\n\n-  Install version 1.4 of the ``django`` package (this is pip’s syntax):\n\n.. code:: python\n\n    \u003e\u003e\u003e env.install('django==1.4')\n\n-  Upgrade the ``django`` package to the latest version:\n\n.. code:: python\n\n    \u003e\u003e\u003e env.upgrade('django')\n\n-  Upgrade all packages to their latest versions (new in 2.1.7):\n\n.. code:: python\n\n    \u003e\u003e\u003e env.upgrade_all()\n\n-  Uninstall the ``mezzanine`` package:\n\n.. code:: python\n\n    \u003e\u003e\u003e env.uninstall('mezzanine')\n\nPackages may be specified as name only (to work on the latest version), using\npip’s package syntax (e.g. ``django==1.4``) or as a tuple of ``('name',\n'ver')`` (e.g. ``('django', '1.4')``).\n\n-  A package may be installed directly from a git repository (must end\n   with ``.git``):\n\n.. code:: python\n\n    \u003e\u003e\u003e env.install('git+git://github.com/sjkingo/cartridge-payments.git')\n\n*New in 2.1.10:*\n\n-  A package can be installed in pip's *editable* mode by prefixing the package\n   name with `-e` (this is pip's syntax):\n\n.. code:: python\n\n    \u003e\u003e\u003e env.install('-e git+https://github.com/stephenmcd/cartridge.git')\n\n*New in 2.1.15:*\n\n-  Packages in a pip requirements file can be installed by prefixing the\n   requirements file path with `-r`:\n\n.. code:: python\n\n    \u003e\u003e\u003e env.install('-r requirements.txt')\n\n-  Instances of the environment provide an ``installed_packages``\n   property:\n\n.. code:: python\n\n    \u003e\u003e\u003e env.installed_packages\n    [('django', '1.5'), ('wsgiref', '0.1.2')]\n\n-  A list of package names is also available in the same manner:\n\n.. code:: python\n\n    \u003e\u003e\u003e env.installed_package_names\n    ['django', 'wsgiref']\n\n-  Search for a package on PyPI (changed in 2.1.5: this now returns a\n   dictionary instead of list):\n\n.. code:: python\n\n    \u003e\u003e\u003e env.search('virtualenv-api')\n    {'virtualenv-api': 'An API for virtualenv/pip'}\n    \u003e\u003e\u003e len(env.search('requests'))\n    231\n\n-  The old functionality (pre 2.1.5) of ``env.search`` may be used:\n\n.. code:: python\n\n    \u003e\u003e\u003e list(env.search('requests').items())\n    [('virtualenv-api', 'An API for virtualenv/pip')]\n\nVerbose output from each command is available in the environment's\n``build.log`` file, which is appended to with each operation. Any errors are\nlogged to ``build.err``.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjkingo%2Fvirtualenv-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsjkingo%2Fvirtualenv-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjkingo%2Fvirtualenv-api/lists"}