Skip to content

Commit

Permalink
Add a dependencies command, which dumps the list of dependencies
Browse files Browse the repository at this point in the history
This is useful for automating things like installing only a project's
dependencies, in CI.
  • Loading branch information
nbraud committed Jan 6, 2021
1 parent 8a82d32 commit 4d4dd61
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bork/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ def clean():
try_delete(name)


def dependencies():
"""Get the list of dependencies."""
from pep517 import meta
return meta.load('.').metadata.get_all('Requires-Dist')


def download(package, release_tag, file_pattern, directory):
if file_pattern is None or len(file_pattern) == 0:
raise ValueError('file_pattern must be non-empty.')
Expand Down
8 changes: 8 additions & 0 deletions bork/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ def clean():
api.clean()


@cli.command()
@click.option('-o', '--output', type=click.File('w'), default='-',
help='File in which to save the list of dependencies.')
def dependencies(output):
for dep in api.dependencies():
print(dep, file=output)


@cli.command()
@click.option('--files', default='*.pyz',
help='Comma-separated list of filenames to download. Supports '
Expand Down

0 comments on commit 4d4dd61

Please sign in to comment.