mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
simplification
This commit is contained in:
+12
-2
@@ -16,13 +16,24 @@ It automatically creates and manages a virtualenv for your projects, as well as
|
||||
- Automatically removes packages from a Pipfile when they are un-installed.
|
||||
- Also automatically updates pip.
|
||||
|
||||
The main commands are ``init``, which initializes the environment, ``install`` and ``uninstall``, and ``lock``, which generates a ``Pipfile.lock``. These are intended to replace ``$ pip install`` usage, as well as manual virtualenv management.
|
||||
The main commands are ```install``, ``uninstall``, and ``lock``, which generates a ``Pipfile.lock``. These are intended to replace ``$ pip install`` usage, as well as manual virtualenv management.
|
||||
|
||||
Basic Concepts
|
||||
//////////////
|
||||
|
||||
- When no parameters are passed to ``install``, a virtualenv will be created if it doesn't exist, and all packages specified will be installed.
|
||||
- When no parameters are passed to ``uninstall``, all packages will be uninstalled.
|
||||
|
||||
Other Commands
|
||||
//////////////
|
||||
|
||||
- ``shell`` will spawn a shell with the virtualenv activated.
|
||||
- ``python`` will run the Python interpreter from the virtualenv, with any arguments forwarded.
|
||||
- ``where`` will give location information about the current project.
|
||||
- ``check`` asserts that PEP 508 requirements are being met by the current environment.
|
||||
|
||||
|
||||
|
||||
☤ Usage
|
||||
-------
|
||||
|
||||
@@ -37,7 +48,6 @@ The main commands are ``init``, which initializes the environment, ``install`` a
|
||||
|
||||
Commands:
|
||||
check
|
||||
init
|
||||
install
|
||||
lock
|
||||
python
|
||||
|
||||
+3
-9
@@ -179,7 +179,8 @@ def do_init(dev=False, skip_virtualenv=False):
|
||||
|
||||
# Display where the Project is established.
|
||||
do_where(bare=False)
|
||||
if not skip_virtualenv:
|
||||
|
||||
if not project.virtualenv_exists:
|
||||
click.echo(crayons.yellow('Creating a virtualenv for this project...'))
|
||||
|
||||
# Actually create the virtualenv.
|
||||
@@ -243,12 +244,6 @@ def cli(*args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option('--dev', '-d', is_flag=True, default=False)
|
||||
def init(dev=False):
|
||||
do_init(dev=dev)
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option('--virtualenv', '--venv', '-v', is_flag=True, default=False)
|
||||
@click.option('--bare', '-b', is_flag=True, default=False)
|
||||
@@ -264,7 +259,7 @@ def install(package_name=False, dev=False):
|
||||
# Install all dependencies, if none was provided.
|
||||
if package_name is False:
|
||||
click.echo(crayons.yellow('No package provided, installing all dependencies.'))
|
||||
do_init(dev=dev, skip_virtualenv=True)
|
||||
do_init(dev=dev)
|
||||
sys.exit(1)
|
||||
|
||||
click.echo('Installing {}...'.format(crayons.green(package_name)))
|
||||
@@ -358,7 +353,6 @@ def update(dev=False):
|
||||
|
||||
|
||||
# Install click commands.
|
||||
cli.add_command(init)
|
||||
cli.add_command(where)
|
||||
cli.add_command(install)
|
||||
cli.add_command(uninstall)
|
||||
|
||||
@@ -20,6 +20,10 @@ class Project(object):
|
||||
def pipfile_exists(self):
|
||||
return bool(self.pipfile_location)
|
||||
|
||||
@property
|
||||
def virtualenv_exists(self):
|
||||
return os.path.isdir(self.virtualenv_location)
|
||||
|
||||
@property
|
||||
def virtualenv_location(self):
|
||||
return os.sep.join(self.pipfile_location.split(os.sep)[:-1] + ['.venv'])
|
||||
|
||||
Reference in New Issue
Block a user