modutil
modutil copied to clipboard
A library for working with Python modules
Since using `__all__` for `dir()` is just `__dir__ = lambda: __all__`, there's no need for code to handle that case. But it should at least be documented so people know...
I.e. remove `__file__`, `__cached__`, `__package__`, and `__loader__` from a module and proxy their accesses through to the underlying `__spec__` object. Provides another way to minimize the attributes exposed on a...
Not sure if this would violate your principles or not, but [this hack](https://github.com/njsmith/metamodule/) would let you make this work on all versions of Python, I think :-)