Skip to content

Utility library to collect valid Python files recursively

License

Notifications You must be signed in to change notification settings

roo-oliv/pycollect

Repository files navigation

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.