ctl.plugins.venv

Plugin that allows you to manage a python virtual env

Requirements

  • pipenv
  • pipenv-setup if you want to run the sync_setup operation

Classes


VenvPlugin

VenvPlugin(ctl.plugins.command.CommandPlugin)

manage a virtual python envinronment

Class Attributes

  • ConfigSchema (ConfigSchema Class): Base plugin config schema

Instanced Attributes

These attributes / properties will be available on instances of the class

  • binpath (str): path to venv bin/ directory

Methods

build

def build(self, **kwargs)

build a fresh virtualenv

Exposed to CLI

namespace: ctl.{plugin_name}.build


copy

def copy(self, source, **kwargs)

copy virtualenv to new location

Exposed to CLI

namespace: ctl.{plugin_name}.copy


execute

def execute(self, **kwargs)

execute the command(s) specified in the plugin config command list

overrides and calls ExecutablePlugin.execute

Exposed to CLI

namespace: ctl.{plugin_name}


sync

def sync(self, **kwargs)

sync a virtualenv using pipenv

will build a fresh virtualenv if it doesnt exist yet

Exposed to CLI

namespace: ctl.{plugin_name}.sync


sync_setup

def sync_setup(self, setup_file=., dry=False, freeze=False, dev=True, **kwargs)

Syncs setup.py requirements from Pipfile

Keyword Arguments

  • setup_file (str): path to setup.py file. If not specified will check in . instead
  • dry (bool=False): if True do a dry run and report what updates would be done to setup.py
  • freeze (bool=False): if True do frozen pinned versions from Pipfile.lock
  • dev (bool=True): Also fill extras_require with Pipfile dev entries

Exposed to CLI

namespace: ctl.{plugin_name}.sync_setup


venv_exists

def venv_exists(self, path=None)

Does a valid virtual environment exist at location?

If no location is supplied the path in self.output is checked

Keyword Arguments

  • path (str): path to check (should be virtuelenv root directory)

Returns

True if venv exists, False if not


venv_validate

def venv_validate(self, path=None)

Validate virtualenv at location

If no location is supplied the path in self.output is checked

Will raise a UsageError on validation failure

Keyword Arguments

  • path (str): path to check (should be virtuelenv root directory)

VenvPluginConfig

VenvPluginConfig(confu.schema.core.Schema)

Configuration schema for VenvPlugin

Class Attributes

  • pipfile (Str): path to Pipfile
  • python_version (Str):