Skip to main content

A utility for discovering and importing Python modules in a package or directory.

Project description

Usage

Importing all modules

You can import all modules under a given root directory, package, or module:

import mypackage  # your package or module
from pywalker import import_modules
import_modules(mypackage)

Filtering with patterns

You can filter which modules are imported using an fnmatch pattern (or list of patterns):

import mypackage
import_modules(mypackage, patterns='utils*')
import_modules(mypackage, patterns=['core*', 'utils*'])

Walking modules without importing

To just get the module names (without importing them):

import mypackage
from pywalker import walk_modules
for name in walk_modules(mypackage, patterns='*test*'):
    print(name)

Pattern argument

The patterns argument uses Unix shell-style wildcards (see Python's fnmatch):

  • * matches everything
  • ? matches any single character
  • [seq] matches any character in seq
  • [!seq] matches any character not in seq

Examples:

  • 'core*' matches modules starting with core
  • '*test*' matches modules containing test

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

unboil_pywalker-0.1.4.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unboil_pywalker-0.1.4-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file unboil_pywalker-0.1.4.tar.gz.

File metadata

  • Download URL: unboil_pywalker-0.1.4.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for unboil_pywalker-0.1.4.tar.gz
Algorithm Hash digest
SHA256 c3a074fd7db0d3d53341832b8296541a4cce774770aad0421ee44fef8d55c1d6
MD5 2aa060ddc6b1a519009c537e1755c4d8
BLAKE2b-256 0325dccade956a443947c78e81d432e3d29371c1f6da5790e527ef303495185a

See more details on using hashes here.

File details

Details for the file unboil_pywalker-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for unboil_pywalker-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cd6dcf0b0d962838353405cb86c0699c505a55014f6c9fb3920a3e5773cd8cd6
MD5 ccb841a32b35b6b7a28c42f9be3a8652
BLAKE2b-256 32b87bbdd396949d95cbbe9964331797ade51db4f0e268c9424b3e0a52d7ccae

See more details on using hashes here.

Supported by

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