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

Find project modules and data files (packages and package_data for setup.py).

License

Notifications You must be signed in to change notification settings

dephell/dephell_discover

Repository files navigation

THE PROJECT IS ARCHIVED

Forks: https://github.com/orsinium/forks


Dephell Discover

travis appveyor MIT License

Find project modules and data files (packages and package_data for setup.py).

Installation

install from PyPI:

python3 -m pip install --user dephell_discover

Usage

Get root, packages, package_data, package dir:

from pathlib import Path
from dephell_discover import Root

root = Root(path=Path('../dephell'))

root.packages
# [Package(path=Path('../dephell/dephell'), root=Path('../dephell')), ...]

root.data
# {Data(path=Path('../dephell/dephell/templates'), ext='.j2', package=Package(...)), ...}

root.package_dir
# {'': '.'}

Package properties:

p = root.packages[-1]
p.path    # Path('../dephell/dephell/commands')
p.root    # Path('../dephell')
p.module  # 'dephell.commands'
str(p)    # 'dephell.commands'
list(p)   # [Path('../dephell/dephell/commands/base.py'), ...]

Data properties:

d = next(iter(root.data))
d.path      # Path('../dephell/dephell/templates')
d.ext       # .j2
d.package   # Package(path=Path('../dephell/dephell'), root=...)
d.module    # 'dephell'
# relative path from package root:
d.relative  # 'templates/*.j2'
str(d)      # 'templates/*.j2'
list(d)     # [Path('../dephell/dephell/templates/python.html.j2'), ...]

Meta information:

root.metainfo.summary
# 'Python project management.'

root.metainfo.authors
# ['Gram (@orsinium)']

root.metainfo.license
# 'MIT'

root.metainfo.version
# '0.7.0'