Skip to content

Commit

Permalink
Merge branch 'master' into feature/requirements-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethreitz authored May 20, 2018
2 parents cb156b9 + 9d45786 commit 95e850e
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 9 deletions.
4 changes: 1 addition & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ Pipenv: Python Development Workflow for Humans

---------------

**Pipenv** — the tool for managing application dependencies from `PyPA <https://www.pypa.io/en/latest/>`__, free (as in freedom).

Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. *Windows is a first–class citizen, in our world.*
**Pipenv** is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. *Windows is a first–class citizen, in our world.*

It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your ``Pipfile`` as you install/uninstall packages. It also generates the ever–important ``Pipfile.lock``, which is used to produce deterministic builds.

Expand Down
4 changes: 4 additions & 0 deletions docs/_templates/sidebarintro.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ <h3>Stay Informed</h3>

<h3>Other Projects</h3>

<ul>
<li><a href="https://pipenv-pipes.readthedocs.io/en/latest/">Pipenv-Pipes</a></li>
</ul>

<p>More <a href="http://kennethreitz.org/">Kenneth Reitz</a> projects:</p>
<ul>
<li><a href="http://pep8.org/">pep8.org</a></li>
Expand Down
4 changes: 4 additions & 0 deletions docs/_templates/sidebarlogo.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ <h3>Stay Informed</h3>

<h3>Other Projects</h3>

<ul>
<li><a href="https://pipenv-pipes.readthedocs.io/en/latest/">Pipenv-Pipes</a></li>
</ul>

<p>More <a href="http://kennethreitz.org/">Kenneth Reitz</a> projects:</p>
<ul>
<li><a href="http://pep8.org/">pep8.org</a></li>
Expand Down
11 changes: 11 additions & 0 deletions docs/diagnose.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,14 @@ instead (not available on Windows).
No, it does not, intentionally. Pipfile and setup.py serve different purposes,
and should not consider each other by default. See :ref:`pipfile-vs-setuppy`
for more information.

☤ Using ``pipenv run`` in Supervisor program
---------------------------------------------

When you configure a supervisor program's ``command`` with ``pipenv run ...``, you
need to set locale enviroment variables properly to make it work.

Add this line under ``[supervisord]`` section in ``/etc/supervisor/supervisord.conf``::
[supervisord]
environment=LC_ALL='en_US.UTF-8',LANG='en_US.UTF-8'
4 changes: 1 addition & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ Pipenv: Python Dev Workflow for Humans

---------------

**Pipenv** — the tool for managing application dependencies from `PyPA <https://www.pypa.io/en/latest/>`__, free (as in freedom).

Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. *Windows is a first-class citizen, in our world.*
**Pipenv** is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. *Windows is a first-class citizen, in our world.*

It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your ``Pipfile`` as you install/uninstall packages. It also generates the ever-important ``Pipfile.lock``, which is used to produce deterministic builds.

Expand Down
5 changes: 3 additions & 2 deletions pipenv/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,13 +842,14 @@ def update(
)
@option('--bare', is_flag=True, default=False, help="Minimal output.")
@option('--json', is_flag=True, default=False, help="Output JSON.")
@option('--json-tree', is_flag=True, default=False, help="Output JSON in nested tree.")
@option(
'--reverse', is_flag=True, default=False, help="Reversed dependency graph."
)
def graph(bare=False, json=False, reverse=False):
def graph(bare=False, json=False, json_tree=False, reverse=False):
from .core import do_graph

do_graph(bare=bare, json=json, reverse=reverse)
do_graph(bare=bare, json=json, json_tree=json_tree, reverse=reverse)


@command(short_help="View a given module in your editor.", name="open")
Expand Down
36 changes: 35 additions & 1 deletion pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,8 @@ def do_create_virtualenv(python=None, site_packages=False):
'new',
project.virtualenv_name,
'-d',
'-a',
project.project_directory,
]
# Default to using sys.executable, if Python wasn't provided.
if not python:
Expand Down Expand Up @@ -2400,7 +2402,7 @@ def do_check(three=None, python=False, system=False, unused=False, args=None):
sys.exit(1)


def do_graph(bare=False, json=False, reverse=False):
def do_graph(bare=False, json=False, json_tree=False, reverse=False):
import pipdeptree
try:
python_path = which('python')
Expand All @@ -2424,9 +2426,31 @@ def do_graph(bare=False, json=False, reverse=False):
err=True,
)
sys.exit(1)
if reverse and json_tree:
click.echo(
u'{0}: {1}'.format(
crayons.red('Warning', bold=True),
u'Using both --reverse and --json-tree together is not supported. '
u'Please select one of the two options.',
),
err=True,
)
sys.exit(1)
if json and json_tree:
click.echo(
u'{0}: {1}'.format(
crayons.red('Warning', bold=True),
u'Using both --json and --json-tree together is not supported. '
u'Please select one of the two options.',
),
err=True,
)
sys.exit(1)
flag = ''
if json:
flag = '--json'
if json_tree:
flag = '--json-tree'
if reverse:
flag = '--reverse'
if not project.virtualenv_exists:
Expand Down Expand Up @@ -2456,6 +2480,16 @@ def do_graph(bare=False, json=False, reverse=False):
data.append(d)
click.echo(simplejson.dumps(data, indent=4))
sys.exit(0)
elif json_tree:
def traverse(obj):
if isinstance(obj, list):
return [traverse(package) for package in obj if package['key'] not in BAD_PACKAGES]
else:
obj['dependencies'] = traverse(obj['dependencies'])
return obj
data = traverse(simplejson.loads(c.out))
click.echo(simplejson.dumps(data, indent=4))
sys.exit(0)
else:
for line in c.out.split('\n'):
# Ignore bad packages as top level.
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def test_pipenv_graph(PipenvInstance, pypi):
p.pipenv('install requests')
assert 'requests' in p.pipenv('graph').out
assert 'requests' in p.pipenv('graph --json').out
assert 'requests' in p.pipenv('graph --json-tree').out


@pytest.mark.cli
Expand Down

0 comments on commit 95e850e

Please sign in to comment.