Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #396 from dephell/more-inspect-venv
Browse files Browse the repository at this point in the history
Show more info in `inspect venv`
  • Loading branch information
orsinium committed Mar 12, 2020
2 parents d33b3b5 + 5cdb906 commit f9ad640
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
22 changes: 18 additions & 4 deletions dephell/commands/inspect_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,32 @@ def __call__(self) -> bool:

data = dict(
exists=venv.exists(),
venv=str(venv.path),
project=self.config['project'],
paths=dict(
venv=str(venv.path),
project=self.config['project'],
),
)

if venv.exists():
data.update(dict(
data['paths'].update(dict(
activate=str(venv.bin_path / shells.current.activate),
bin=str(venv.bin_path),
lib=str(venv.lib_path),
lib_size=format_size(get_path_size(venv.lib_path)),
python=str(venv.python_path),
))
impl = venv.python.implementation
if impl == 'python':
impl = 'cpython'
data.update(dict(
sizes=dict(
lib=format_size(get_path_size(venv.lib_path)),
venv=format_size(get_path_size(venv.path)),
),
python=dict(
version=str(venv.python.version),
implementation=impl,
),
))
print(make_json(
data=data,
key=self.config.get('filter'),
Expand Down
3 changes: 2 additions & 1 deletion tests/test_commands/test_inspect_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def test_inspect_venv_command(temp_path: Path, capsys):
captured = capsys.readouterr()
output = json.loads(captured.out)
assert output['exists'] is True
assert output['bin'] == str(venv.bin_path)
assert output['paths']['bin'] == str(venv.bin_path)
assert output['paths']['venv'] == str(venv.path)

0 comments on commit f9ad640

Please sign in to comment.