Skip to main content

A project for installing packages across the virtualenv boundary.

Project description

https://img.shields.io/pypi/v/mork.svg https://img.shields.io/pypi/l/mork.svg https://api.travis-ci.com/sarugaku/mork.svg?branch=master https://ci.appveyor.com/api/projects/status/5mo40rneihk6y8po/branch/master?svg=true https://img.shields.io/pypi/pyversions/mork.svg https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg Documentation Status

Summary

Mork is a library designed for installing and querying python packages inside virtual environments.

πŸ‰ See What’s Installed

>>> import mork
>>> venv = mork.VirtualEnv.from_project_path('/home/user/git/pipenv')
>>> dists = venv.get_distributions()
>>> [dist for dist in dists][:3]
[wheel 0.31.1 (/home/user/.virtualenvs/pipenv-MfOPs1lW/lib/python3.7/site-packages), Werkzeug 0.14.1 (/home/user/.virtualenvs/pipenv-MfOPs1lW/lib/python3.7/site-packages), vistir 0.1.4 (/home/user/.virtualenvs/pipenv-MfOPs1lW/lib/python3.7/site-packages)]

πŸ‰ Install A Package

>>> from requirementslib.models.requirements import Requirement
>>> r = Requirement.from_line("requests")
>>> venv.install(r, editable=False)

πŸ‰ Uninstall a Package

>>> pkg = "pytz"
>>> with venv.uninstall(pkg, auto_confirm=True) as uninstall:
        if uninstall.paths:
            cleaned = pkg
>>> print("Removed package: %s" % cleaned)

πŸ‰ Display Information about Python

>>> venv.python
'/home/user/.virtualenvs/pipenv-MfOPs1lW/bin/python'
>>> venv.python_version
'3.7'

πŸ‰ Run Commands Inside the Virtualenv

>>> cmd = venv.run("env")
>>> [line for line in cmd.out.splitlines() if line.startswith("VIRTUAL_ENV")]
['VIRTUAL_ENV=/user/hawk/.virtualenvs/pipenv-MfOPs1lW']
>>> cmd = venv.run_py(["import os; print(os.environ.get('VIRTUAL_ENV'))"])
Deactivating virtualenv...
>>> cmd.out
'/home/user/.virtualenvs/pipenv-MfOPs1lW\n'
>>> with venv.activated():
        print(os.environ["VIRTUAL_ENV"])
/home/hawk/.virtualenvs/pipenv-MfOPs1lW

Read the documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
mork-0.1.4-py2.py3-none-any.whl (8.4 kB) Copy SHA256 hash SHA256 Wheel py2.py3
mork-0.1.4.tar.gz (14.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page