Skip to content

NSLS-II/depfinder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docs

github

http://mybinder.org/badge.svg:target:http://mybinder.org/repo/ericdill/depfinder

https://travis-ci.org/ericdill/depfinder.svg?branch=master http://codecov.io/github/ericdill/depfinder/coverage.svg?branch=master https://coveralls.io/repos/ericdill/depfinder/badge.svg?branch=master&service=github

depfinder

Find all the unique imports in your library, automatically, because who likes do it by hand? depfinder uses the ast (Abstract Syntax Tree) module (and more ast docs) to find all :py:class:`ast.Try` and :py:class:`ast.ImportFrom` nodes. These :py:class:`ast.Import` and :py:class:`ast.ImportFrom` nodes are then grouped according to the following categories, in order of decreasing precedence:

  • relative

    The import is a relative import from within the same library

  • builtin

    The import is built into the standard library, as determined by scraping the official python docs for the builtins with stdlib-list

  • questionable

    The import occurs inside any combination of

    The module may be importable without these imports, but the it will likely not have full functionality.

  • required

    The import occurs at the top level of the module and will get executed when the module is imported. These imports must be accounted for in an environment, or the module will not be importable.

Installation

depfinder is on pypi. It is tested against Python 2.7, 3.3, 3.4 and 3.5.

pip install depfinder

It is available via conda.

conda install -c ericdill depfinder

It is also via github.

git clone git@github.com:ericdill/depfinder
cd depfinder
python setup.py install

or

pip install https://github.com/ericdill/depfinder/zipball/master#egg=depfinder

It has one dependency, stdlib_list, which is where I get the list of libraries built in to the standard library. stdlib-list can be installed via pip

pip install stdlib-list

or conda

conda install -c ericdill stdlib-list

Using depfinder

See this notebook

API

.. currentmodule:: depfinder
.. autofunction:: get_imported_libs
.. autofunction:: iterate_over_library
.. autofunction:: simple_import_search

IPython/Jupyter Notebook support

depfinder has support for v4 Jupyter notebooks.

.. autofunction:: notebook_path_to_dependencies

Packages

No packages published

Languages

  • Python 82.3%
  • Jupyter Notebook 17.4%
  • Shell 0.3%