Skip to main content

lazy-inspect-offline

lazy-inspect-offline searches functions and classes in Python modules installed in the current environment. It does not make network requests or require third-party runtime dependencies.

The distribution name uses hyphens; its Python import name is lazy_inspect_offline.

Python compatibility

Version 0.1.2 supports Python 3.8 and newer. Unit tests, docstring examples, and CLI execution were checked on Python 3.8.20, 3.9.20, 3.10.15, 3.11.5, 3.12.3, and 3.13.15. Python 3.7 was not runtime-tested and is not declared supported; Python 3.6 cannot import the future annotations used by this package. Python 3.8 and 3.9 are upstream end-of-life versions; compatibility is provided for existing internal environments.

There are no third-party runtime dependencies. setuptools>=68 is a build-time requirement only, supporting the current pyproject.toml configuration and editable installs. Pip selects a setuptools release compatible with the build interpreter. Installing the prebuilt wheel offline does not require setuptools. Search results depend on the version of the library being inspected.

Install

Install from PyPI:

pip install lazy-inspect-offline

For offline installation, copy the wheel to the target machine and run:

python -m pip install --no-index lazy_inspect_offline-0.1.2-py3-none-any.whl

From this directory (the one containing pyproject.toml), build a wheel and source archive on a connected build machine:

python -m pip install --upgrade build
python -m build

Copy the wheel to the offline machine and install it there. The modules being searched must also be installed locally.

Python API

from lazy_inspect_offline import find_location, search_class, search_function

search_function(module_name, keywords, ...)

search_function("os", "join")
# ['os.path.join']

search_function('pandas', ['dataframe', 'fill'], exclude_keywords='na')
# ['pandas.DataFrame.bfill',
#  'pandas.DataFrame.ffill',
#  'pandas.api.typing.DataFrameGroupBy.bfill',
#  'pandas.api.typing.DataFrameGroupBy.ffill']
  • Purpose: Find public functions and methods in a locally installed module.

  • Result: A sorted list of unique dotted names; [] if nothing matches.

  • Search scope: Skip names starting with _; inspect exposed submodules and classes in the module tree. Unexposed submodules are not automatically imported. Each module/class is traversed once, so some descendant aliases may be omitted.

  • Options:

    • keywords: A string or sequence of strings. Every keyword must occur in the full dotted name.
    • exclude_keywords=(): A string or sequence of strings. Exclude names containing any of these keywords.
    • lower=True: Match without case sensitivity. Use lower=False for case-sensitive matching.
    • suppress_warnings=True: Hide Python warnings during the call and restore warning settings afterward, even on exceptions. Use False to retain the caller's warning policy during the search.
  • Imports: Use trusted modules; importing and inspecting them may execute code. No persistent index is created.

  • [TIP] Read documentation with pydoc. Pass a returned name to pydoc.help() to view its description and usage offline. This also works for class names returned by search_class().

    import pydoc
    
    pydoc.help("os.path.join")
    pydoc.help("datetime.timezone")  # Class documentation works the same way.
    

search_class(module_name, keywords, ...)

search_class("datetime", "timezone")
# ['datetime.timezone']
  • Purpose: Find public classes, including nested classes encountered during traversal.
  • Result: A sorted list of unique dotted names; [] if nothing matches. Instances are not included.
  • Options: Uses the same keywords, exclude_keywords, lower, and suppress_warnings options as search_function().
  • Behavior: Shares the search scope, import and warning behavior, as described for search_function().

find_location(qualified_name)

find_location("datetime.timezone")
# e.g. /home/user/anaconda3/lib/python3.11/datetime.py
  • Purpose: Find the file location of the module defining the specified object in current environment.
  • Result: The absolute path of the file backing the object's defining module.
  • Behavior:
    • Input: A dotted object name, usually returned by either search function.
    • File type: May be Python source, an extension binary, or bytecode. It does not identify an implementation or source line.
    • Errors: Raises LookupError for an unresolved name and OSError if no local module file exists, as with builtins.str. Import failures may also propagate.
    • Warnings: Has no suppress_warnings option; uses the caller's warning settings.

Command line

lazy-inspect-offline functions os join
lazy-inspect-offline classes datetime timezone
lazy-inspect-offline functions pandas dataframe fill --exclude na
lazy-inspect-offline location pandas.DataFrame.bfill

Repeated --exclude options are supported. Searches are case-insensitive by default; for case-sensitive matching, use lazy-inspect-offline functions pandas DataFrame fill --exclude na --case-sensitive.

location prints the absolute path of the defining module file, using the same behavior as find_location(). It exits with status 1 if the name cannot be resolved or its module file is unavailable. Pandas must be installed to run the pandas examples.

Package layout

This directory is the standalone packaging project, following the PyPA packaging tutorial. Notebooks and comparison materials in the parent directory are not part of it.

lazy-inspect-offline/
├── pyproject.toml
├── README.md
├── src/
│   └── lazy_inspect_offline/
│       ├── __init__.py
│       ├── __main__.py
│       ├── cli.py
│       └── search.py
└── tests/
    ├── test_cli.py
    ├── test_search.py
    └── test_warnings.py

Metadata

Release files for lazy-inspect-offline 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lazy-inspect-offline 0.1.2
File Size Uploaded
lazy_inspect_offline-0.1.2.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lazy-inspect-offline 0.1.2
File Interpreter ABI Platform
lazy_inspect_offline-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / lazy_inspect_offline-0.1.2.tar.gz

Download URL lazy_inspect_offline-0.1.2.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
88aa02b8cd51c87bd17e5015468b7176504c1e076381295ebf9d1c6194b52df4
BLAKE2b-256 checksum
How to use checksums
5066557099a79e9051ec975396313023754c40caee68dc9af8da5dd7b31c6dcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / lazy_inspect_offline-0.1.2-py3-none-any.whl

Download URL lazy_inspect_offline-0.1.2-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f050144a779525c6a78389d0a63617c54e7455373e4aeb003f595829a97a4cb
BLAKE2b-256 checksum
How to use checksums
1d1a9a78efea501a12c909e4c57625f896f9517c5a4c2cc08610e5eb3eb3371b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page