Skip to content
Adalfarus edited this page Jun 20, 2024 · 13 revisions

Welcome to the aplustools wiki!

Please note that the information here corresponds to the latest commit of the repository, not necessarily the latest release. For the most recent patches, follow the cloning and manual installation instructions in the README.md. This documentation is current as of version 1.5.0.

Module Imports and Lazy Loading

Since aplustools version 0.1.4.2, several key modules are imported in __init__.py using a lazy loading approach. This section outlines the structure and usage.

Core Modules

These modules are directly accessible through the aplustools namespace after importing aplustools:

  • IO Module (io): Utilities related to input/output operations.
  • Data Module (data): Tools for data manipulation and processing.
  • Utils Module (utils): General utilities and helper functions.
  • Web Module (web): Tools for web interactions and HTTP operations.
  • Package Module (package): Utilities related to package management and dependencies.
  • Security Module (security): Utilities related to cyber security.

Usage Example

Here's how you can access these modules:

import aplustools

# Access lazy-loaded modules
system = aplustools.io.environment.get_system()
unien = aplustools.data.unien.Unien()
dummy = aplustools.utils.dummy.Dummy3()
webpage = aplustools.web.utils.WebPage("google.com")
attr_obj = aplustools.package.AttributeObject()
rng = aplustools.security.rand.WeightedRandom("secrets")

Note: Each module includes a local_test function, which provides module-specific test cases, often illustrated in the wiki.

Dynamically Added Functions

The package dynamically adds exports from _direct_functions, which includes functions and utilities that can be used directly:

from aplustools import set_dir_to_ex

# Use direct functions
set_dir_to_ex()

The __all__ attribute is defined to limit what gets imported with from aplustools import *. It's dynamically extended with attributes from _direct_functions.

Clone this wiki locally