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

Commit

Permalink
Merge branch 'move-venv'
Browse files Browse the repository at this point in the history
  • Loading branch information
orsinium committed Apr 7, 2019
2 parents 6e1d8b4 + a00af51 commit 185dc96
Show file tree
Hide file tree
Showing 23 changed files with 97 additions and 209 deletions.
Binary file added assets/graph_example.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dephell/actions/_entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from ..converters import EggInfoConverter
from ..models import EntryPoint
from ..venvs import VEnv
from dephell_venvs import VEnv


logger = getLogger('dephell.actions')
Expand Down
2 changes: 1 addition & 1 deletion dephell/actions/_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# app
from ..config import Config
from ..venvs import VEnvs, VEnv
from dephell_venvs import VEnvs, VEnv


def get_venv(config: Config) -> VEnv:
Expand Down
6 changes: 5 additions & 1 deletion dephell/commands/generate_authors.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ def get_parser(cls):
return parser

def __call__(self):
result = subprocess.run(['git', 'log', '--pretty="%ae|%an%n%ce|%cn"'], capture_output=True)
result = subprocess.run(
['git', 'log', '--pretty="%ae|%an%n%ce|%cn"'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
authors = dict()
for line in result.stdout.decode().strip().split('\n'):
mail, name = line.split('|')
Expand Down
2 changes: 1 addition & 1 deletion dephell/commands/jail_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ..models import Requirement
from ..package_manager import PackageManager
from ..utils import is_windows
from ..venvs import VEnvs
from dephell_venvs import VEnvs
from .base import BaseCommand
from ..actions import get_python

Expand Down
2 changes: 1 addition & 1 deletion dephell/commands/jail_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# app
from ..config import builders
from ..venvs import VEnvs
from dephell_venvs import VEnvs
from .base import BaseCommand


Expand Down
2 changes: 1 addition & 1 deletion dephell/commands/venv_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# app
from ..actions import get_python
from ..config import builders
from ..venvs import VEnvs
from dephell_venvs import VEnvs
from .base import BaseCommand


Expand Down
5 changes: 2 additions & 3 deletions dephell/commands/venv_destroy.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# built-in
from argparse import ArgumentParser
from pathlib import Path
from shutil import rmtree

# app
from ..config import builders
from ..venvs import VEnvs
from dephell_venvs import VEnvs
from .base import BaseCommand


Expand All @@ -31,6 +30,6 @@ def __call__(self) -> bool:
if not venv.exists():
self.logger.error('venv does not exist')
return False
rmtree(str(venv.path))
venv.destroy()
self.logger.info('venv removed')
return True
2 changes: 1 addition & 1 deletion dephell/commands/venv_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# app
from ..config import builders
from ..venvs import VEnvs
from dephell_venvs import VEnvs
from .base import BaseCommand
from ..controllers import analize_conflict
from ..converters import PIPConverter
Expand Down
2 changes: 1 addition & 1 deletion dephell/commands/venv_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# app
from ..config import builders
from ..venvs import VEnvs
from dephell_venvs import VEnvs
from .base import BaseCommand
from ..actions import get_python

Expand Down
7 changes: 6 additions & 1 deletion dephell/converters/sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ def load(self, path) -> RootDependency:
archive = ArchivePath(archive_path=path, cache_path=Path(cache))

# read *.egg-info
paths = list(archive.glob('*.egg-info')) + list(archive.glob('*/*.egg-info'))
paths = list(chain(
archive.glob('*.egg-info'),
archive.glob('*/*.egg-info'),
archive.glob('src/*.egg-info'),
archive.glob('src/*/*.egg-info'),
))
if paths:
root = converter.load_dir(*paths)
root.readme = Readme.discover(path=archive)
Expand Down
2 changes: 0 additions & 2 deletions dephell/converters/setuppy.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
from setuptools import setup
except ImportError:
from distutils.core import setup
except ModuleNotFoundError:
from distutils.core import setup
{readme}
Expand Down
14 changes: 13 additions & 1 deletion dephell/converters/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,22 @@ def dump(self, reqs, path: Path, project: RootDependency) -> None:
for full_path in package:
self._write_file(
zip=zip,
path='/'.join(full_path.relative_to(project.package.path).parts),
path=package.module.replace('.', '/') + '/' + full_path.name,
fpath=full_path,
)

# write license files
patterns = ('LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*')
for pattern in patterns:
for file_path in project.package.path.glob(pattern):
if not file_path.is_file():
continue
self._write_file(
zip=zip,
path=base_path + file_path.name,
fpath=file_path,
)

# write RECORD
self._write_content(
zip=zip,
Expand Down
187 changes: 0 additions & 187 deletions dephell/venvs.py

This file was deleted.

56 changes: 56 additions & 0 deletions docs/cmd-deps-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,64 @@ $ dephell deps tree aiohttp==3.5.4
...
```

## Graph output

You can specify `--type=graph` to build dependencies graph:

```bash
$ dephell deps tree --type=graph aiohttp==3.5.4
```

It will create next graph in `.dephell_report` directory:

![](../assets/graph_example.png)

## JSON output

You can specify `--type=json` to generate JSON with information for every node in graph:

```bash
$ dephell deps tree --type=json aiohttp==3.5.4
[
{
"best": "3.5.4",
"constraint": "==3.5.4",
"dependencies": [
"attrs",
"chardet",
"multidict",
"async-timeout",
"yarl",
"idna-ssl",
"typing-extensions"
],
"latest": "3.5.4",
"name": "aiohttp"
},
...
]
```

As for any other command, you can [filter](filters) JSON output:

```bash
dephell deps tree --type=json --filter="#.name+constraint.each()" aiohttp==3.5.4
[
{
"constraint": "==3.5.4",
"name": "aiohttp"
},
{
"constraint": "<4.0,>=3.0",
"name": "async-timeout"
},
...
]
```

## See also

1. [How to filter commands JSON output](filters).
1. [dephell package outdated](cmd-package-list) to show outdated packages in a lockfile or project virtual environment.
1. [dephell package list](cmd-package-list) to show information about installed packages.
1. [dephell package show](cmd-package-show) to get information about single package.

0 comments on commit 185dc96

Please sign in to comment.