pycollect

Utility library to collect files recursively


Keywords
file, py, traversal, directory, collect, directory-traversal, module, python-files, python-module, python3
License
MIT
Install
pip install pycollect==0.2.3

Documentation

pycollect

license GitHub license
docs Documentation Status
tests Build Status Requirements Status Coverage Status
package PyPI Package latest release PyPI Wheel Supported versions Supported implementations Supported Platforms

Utility library dealing with Python files.

Features
  • Collect Python files recursively from a given directory
  • Find the Python module name respective to a Python file

Installation

pip install pycollect

Basic Usage

Collect Python files

collector = PythonFileCollector()
python_files = collector.collect()

When no explicit directory is given the parent folder of caller's file will be used.

It is possible to define custom exclusion patterns. See the docs for more.

Get the module name of a Python file

module_name = find_module_name(filepath)

As there can be multiple valid module names for a given file, by default the outermost module name is returned. The inverse behaviour can be enabled with the innermost parameter. See the docs for more.

Documentation

See the complete docs at allrod5.github.io/pycollect.

Integration tests can be pretty helpful to understand pycollect usage more in-depth too.

See also

  • CONTRIBUTING: Bug reports, feature requests, documentation & pull requests.
  • CHANGELOG: See what's changed in each version.
  • AUTHORS: Know who's behind the project.