diff --git a/Pipfile b/Pipfile index ba202a11..6c8c8916 100644 --- a/Pipfile +++ b/Pipfile @@ -3,7 +3,6 @@ url = "https://pypi.org/" verify_ssl = true [packages] -toml = "*" crayons = "*" -"delegator.py" = "*" +toml = "*" click = "*" diff --git a/Pipfile.freeze b/Pipfile.freeze index 4e8f32b2..7bb69f76 100644 --- a/Pipfile.freeze +++ b/Pipfile.freeze @@ -1 +1 @@ -{"default": {"crayons": "==0.1.1", "colorama": "==0.3.7", "daemon": "==1.1", "delegator.py": "==0.0.1", "pexpect": "==4.2.1", "toml": "==0.9.2", "click": "==6.7", "ptyprocess": "==0.5.1"}, "develop": {}, "_meta": {"sources": [{"url": "https://pypi.org/", "verify_ssl": true}], "requires": {}, "Pipfile-sha256": "5eb186a8c4b74d956d45fb4c7135a49bed60a8b884bbdcc5f5233562e88caef7"}} \ No newline at end of file +{"default": {"colorama": "==0.3.7", "crayons": "==0.1.1", "toml": "==0.9.2", "click": "==6.7"}, "develop": {}, "_meta": {"sources": [{"url": "https://pypi.org/", "verify_ssl": true}], "requires": {}, "Pipfile-sha256": "8cfe2a7c071e7058f9a2cd8a8e6f02b6f3384eb2f8c107565e9ad8f98a0b10ed"}} \ No newline at end of file diff --git a/pipenv/_pipfile/api.py b/pipenv/_pipfile/api.py index 68fae9b5..10e1307b 100644 --- a/pipenv/_pipfile/api.py +++ b/pipenv/_pipfile/api.py @@ -116,7 +116,10 @@ class Pipfile(object): if i < max_depth: if 'Pipfile': - return '{}/Pipfile'.format(c) + p = '{}/Pipfile'.format(c) + if os.path.isfile(p): + return p + raise RuntimeError('No Pipfile found!') @classmethod def load(klass, filename): diff --git a/pipenv/core.py b/pipenv/core.py index e50c1195..a28b81d7 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -23,7 +23,7 @@ class Project(object): @property def pipfile_exists(self): - return self.pipfile_location + return bool(self.pipfile_location()) @staticmethod def virtualenv_location(): @@ -31,7 +31,11 @@ class Project(object): @staticmethod def pipfile_location(): - return pipfile.Pipfile.find() + try: + return pipfile.Pipfile.find() + except RuntimeError: + return None + def lockfile_location(self): return '{}.freeze'.format(self.pipfile_location()) @@ -138,6 +142,7 @@ def convert_deps_from_pip(dep): dependency[r[0]] = {'extras': r[1].split(',')} # TODO: Editable installs. + # if dep.startswith('-e'): # Bare dependencies: e.g. requests else: @@ -274,6 +279,9 @@ def do_freeze(): with open(project.lockfile_location(), 'w') as f: f.write(json.dumps(lockfile)) + click.echo(crayons.yellow('Note: ') + 'your project now has only default packages installed.') + click.echo('To install dev-packages, run: $ {}'.format(crayons.red('pipenv init --dev'))) + def activate_virtualenv(): """Returns the string to activate a virtualenv.""" return 'source {}/bin/activate'.format(project.virtualenv_location()) @@ -320,8 +328,10 @@ def cli(*args, **kwargs): @click.option('--dev', '-d', is_flag=True, default=False) def init(dev=False): + print project.pipfile_location # Assert Pipfile exists. if not project.pipfile_exists: + click.echo(crayons.yellow('Creating a Pipfile for this project...')) # Create the pipfile if it doesn't exist.