Skip to main content

ModX — The Python Module Universe at Your Fingertips

Project description

🌟 ModXPy — The Python Module Universe at Your Fingertips

Welcome to ModXPy, the ultimate playground for Python’s modules.
With ModXPy you can instantly import, explore, and experiment with the entire Python standard library — plus any installed third-party modules — all from one simple interface.

UPDATE 2.5.0

NEW FUNCTION!

timesince(module, as_data = False)

Shows WHEN a module was loaded in relative to when ModX loaded.

Examples: import modx

  import colorsys

  modx.timesince('colorsys')

  Module: colorsys

  Imported at 2026-02-13 11:06:59.199

  32.533 seconds after ModX started.

  modx.timesince('sys')

  Module: sys

  (ModX dependency - loaded at startup)

  Imported at 2026-02-13 11:06:26.666

  0.0 seconds after ModX started.

  modx.timesince('tkinter')

  Module: tkinter

  (Preloaded module)

  Imported at 2026-02-13 11:06:26.666

  0.0 seconds after ModX started.

  modx.timesince('nonexistent')

  Module 'nonexistent' not loaded.

  With as_data = True:

  modx.timesince('colorsys', as_data=True)

  {'module': 'colorsys',

  'loaded': True,

  'preloaded': False,

  'timestamp': '2026-02-13 11:06:59.199',

  'seconds_after_modx': 32.533}

  modx.timesince('sys', as_data=True)

  {'module': 'sys',

  'loaded': True,

  'preloaded': True,

  'modx_start_time': '2026-02-13 11:06:26.666',

  'modx_dependency': True}

Other changes: Added datetime to ModX dependencies (tracked properly now)

  New global _modx_start_time tracks when ModX initializes

  New _import_timestamps dict records every module's import time

  Updated _tracking_import to capture timestamps on first import

  Updated _modx_dependencies and modx_imports_list to include datetime

  Full test suite integration (6 new tests, all passing)

🚀 Installation and Importing

IMPORTANT: Before you install ModX, you MUST first (if not already) run "pip install packaging" inside of powershell/terminal. ModX will NOT work without the packaging module.

Install directly from terminal.

Type: "pip install modxpy"

In Python, import as import modx (not modxpy)

Functions:

🔹 dependencies(module, as_data=False)

Shows what other modules a specific module depends on without importing it.

🔹 importall(show_imported=False, as_data=False)

Imports about every standard library module at once.

🔹 importexternal(show_imported=False, as_data=False)

Attempts to import every third-party module you currently have installed.

🔹 importletter(letter, show_imported=False, as_data=False)

Imports all standard library modules whose names start with the given letter (case-insensitive).

🔹 importlog(include_deps=False, as_data=False)

Shows every module imported since ModX loaded in CHRONOLOGICAL order.

include_deps=True: Includes ModX's dependencies in the list.

🔹 importrandom(n, strict_mode=False, show_imported=False, as_data=False)

Imports n random stdlib modules.

strict_mode=False: May import less than n due to dependencies.

strict_mode=True: Forces import until EXACTLY n NEW modules.

🔹 importscreen(show_imported=False, as_data=False)

Imports every module that uses a screen/GUI (like pygame or turtle).

🔹 info(module_name, as_data=False)

Shows basic info about a module: file path, built-in status, full docstring.

🔹 isimported(module)

Checks if a module is currently imported into the Python shell (not just sys.modules).

🔹 listimportall(as_data=False)

Returns a list of modules that import_all() would import.

🔹 modbench(module, as_data=False)

Shows how much time and memory a module takes to import.

Note: The module IS imported, and cache is cleared before each benchmark.

🔹 modclasses(module, as_data=False)

Shows how many and what classes a module has WITHOUT importing it.

🔹 modfunctions(module, as_data=False)

Shows how many and what functions a module has WITHOUT importing it.

🔹 modglobals(module, show_private=False, export=None, as_data=False)

Shows a module's global names (not functions/classes/modules).

show_private=True: Includes names starting with '_'.

export=filename.md: Exports results as Markdown.

🔹 modorigin(module, as_data=False)

Shows where a module came from (e.g., built-in, standard library, or pip-installed).

🔹 modsloaded()

Shows how many modules are currently loaded in your Python session.

🔹 modxhelp(export=None, compact=False, banner=True)

Shows ModX's built-in help dialogue.

export=filename.md: Exports help as Markdown.

compact=True: Shows single-line summaries only.

banner=False: Hides the ASCII banner.

🔹 modximported(as_data=False)

Lists modules that were ONLY imported by ModX — NOT including user imports or dependencies.

🔹 nonimported(as_data=False)

Returns a list of STANDARD LIBRARY modules that have NOT been imported yet.

🔹 preloaded(show_builtins=True, show_internal=False, show_submodules=False, as_data=False)

Shows modules pre-loaded by Python before ModX started.

show_builtins=False: Hides built-in modules.

show_internal=True: Shows modules starting with '_'.

show_submodules=True: Includes submodules (names with '.').

🔹 revdeps(module, as_data=False)

Shows what modules import the given module WITHOUT importing it.

🔹 searchmodules(keyword, as_data=False)

Searches for modules whose names contain the keyword.

🔹 timesince(module, as_data = False)

Shows WHEN a module was loaded in relative to when ModX loaded.

🔹 vcompat(module_name, python_version=None, as_data=False)

Checks if a module is compatible with a given Python version.

If no version is given, sweeps ALL Python versions 2.0–3.14.

🔹 whyloaded(module, as_data=False)

Returns a comma-separated string explaining why a module is in memory.

Tags: not_loaded, preloaded, user, referenced, modx, modx_dep, dependency or unknown

Rule: user swallows referenced.

💡 Why Use ModX?

1.) Understand your imports

  Know why a module was loaded (whyloaded()), when it appeared (timesince()), and where it came from (modorigin()).

2.) Get real data, not just printed tables

  Every function has as_data mode — return clean Python lists/dicts for your own code.

3.) Stress-test your environment

  Bulk-import hundreds of modules at once with importall() and see what breaks.

4.) Discover hidden dependencies

  See what your imports actually depend on with dependencies() and revdeps().

5.) Experiment and learn

  Random imports, compatibility checking, performance benchmarking — turn Python into a playground.

6.) Track everything

  Chronological import logs, preloaded module lists, timestamp tracking — nothing stays hidden.

ModXPy turns Python’s module system into a playground — perfect for learning, testing, or just satisfying your curiosity. Install it today with pip install modxpy, import it with import modx, and start discovering how many modules Python already has waiting for you!

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

modxpy-2.5.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

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

modxpy-2.5.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file modxpy-2.5.0.tar.gz.

File metadata

  • Download URL: modxpy-2.5.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for modxpy-2.5.0.tar.gz
Algorithm Hash digest
SHA256 6d6af344f248653683a0d64cc717d308429458b7decab67a87f173694017adb3
MD5 2b9a2d2119f8f4bd2161795c236741da
BLAKE2b-256 17033f365dbb9896c48f78c85f408185670c4a5fd63539c4ae5a5d1f6a93fcfc

See more details on using hashes here.

File details

Details for the file modxpy-2.5.0-py3-none-any.whl.

File metadata

  • Download URL: modxpy-2.5.0-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for modxpy-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6dd2771d6e901f3559eac6fd17e3fa223c37773416ca40365d1e5fa3fe9ec2d6
MD5 5bfc8a1fa7b67c7f832c65ba0ba358e4
BLAKE2b-256 4279bbdc2a03f025b89942245583644abeab9c8fa35a7acaafbad58cbddaf1df

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