How to use the virtualenvwrapper.configvars.Loader function in virtualenvwrapper

To help you get started, we’ve selected a few virtualenvwrapper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github seanbrant / virtualenvwrapper.configvar / virtualenvwrapper / configvars.py View on Github external
for key, value in pairs:
            if key in os.environ:
                self._export('%s%s' % (self._old_prefix, key), os.environ[key])

            self._export(key, value)

    def _export(self, key, value):
        self._exported.append(key)
        self._source_lines.append('export %s=%s' % (key, value))

    def _unset(self, key):
        self._source_lines.append('unset %s' % key)


loader = Loader()


def pre_activate(args):
    project = args[0]
    base = os.environ.get('PROJECT_HOME', os.environ.get('WORKON_HOME'))
    loader.load(os.path.join(base, project, '.env'))


def pre_activate_source(args):
    return loader.source()


def post_deactivate(args):
    loader.clear()

virtualenvwrapper

MIT
Latest version published 26 days ago

Package Health Score

79 / 100
Full package analysis

Popular virtualenvwrapper functions