From 27230d2569e102671c4f78b062020ceafe668139 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 10 Jan 2018 09:38:51 -0500 Subject: [PATCH] create a project too Signed-off-by: Kenneth Reitz --- pipenvlib.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pipenvlib.py b/pipenvlib.py index cd1b36f..4ebe9e0 100644 --- a/pipenvlib.py +++ b/pipenvlib.py @@ -47,12 +47,18 @@ class Requirement(object): class PipenvProject(object): """A Pipenv project.""" - def __init__(self, home, pipfile='Pipfile'): + def __init__(self, home, pipfile='Pipfile', create=False): self.home = home self.pipfile = pipfile - # Assert that the Pipfile exists. - self.assert_has_pipfile() + if not create: + # Assert that the Pipfile exists. + self.assert_has_pipfile() + else: + # Cheat a project-creation by installing, then uninstalling + # the Requests library. :) + self.install('requests') + self.uninstlal('requests') @property def _pipfile_path(self):