Skip to main content

Utility library to collect files recursively

Project description

pycollect

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.

Changelog

0.2.3 (2020-04-14)

  • Adds support for Windows case insensitivity

  • Adds official support for Python 3.8

  • States official support for PathLike objects in the find_module_name function

  • Fixes and updates the release workflow in GitHub Actions

  • Bumps pycollect from 0.2.2 to 0.2.3

0.2.2 (2020-02-29)

  • Lift __init__.py requirement for considering a path as importable

0.2.1 (2020-02-29)

  • Fix module finder for Windows

0.2.0 (2020-02-28)

  • Added utility function to find a file’s module name

0.1.1 (2020-02-24)

  • Update docs

0.1.0 (2019-12-22)

  • First beta release

0.0.1 (2019-09-01)

  • Fix GitHub release workflow.

0.0.0 (2019-08-31)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycollect-0.2.3.tar.gz (209.6 kB view hashes)

Uploaded Source

Built Distribution

pycollect-0.2.3-py2.py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page