xinspect 0.4.0


pip install xinspect

  Latest version

Released: Mar 09, 2025

Project Links

Meta
Author: Jon Crall
Requires Python: >=3.8

Classifiers

Development Status
  • 4 - Beta

Intended Audience
  • Developers

Topic
  • Software Development :: Libraries :: Python Modules
  • Utilities

License
  • OSI Approved :: Apache Software License

Programming Language
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13

Codecov Pypi Downloads ReadTheDocs

Tools for static and dynamic code introspection. This library has not been well maintained, and there are likely other libraries that are better.

Helps with writing doctests

def func(a=1, b=2, c=3):
    """
    Example:
        >>> from this.module import *  # import contextual namespace
        >>> import xinspect
        >>> globals().update(xinspect.get_func_kwargs(func))  # populates globals with default kwarg value
        >>> print(a + b + c)
        6
    """

Helps with code that generates code

>>> import ubelt as ub
>>> source = ub.codeblock(
>>>     '''
>>>     p = os.path.dirname(join('a', 'b'))
>>>     glob.glob(p)
>>>     ''')
>>> # Generate a list of lines to fix the name errors
>>> lines = autogen_imports(source=source)
>>> print(lines)
['import glob', 'from os.path import join', 'import os']

See Also: https://github.com/Erotemic/xdev

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
xdoctest (>=1.1.5)
redbaron (>=0.8)
ubelt (>=1.3.3)
pyflakes (>=2.5.0)