MRO tools
Various cli tools related to MRO. Useful for debugging complex class strictures.
Free software: MIT license
Installing
You can install mro-tools using pip:
$ pip install mro-tools
Why?
Inheritance is wonderful. Except when its not. How many times did you have to debug a complex class with MRO of >30 classes? You will then know its not pleasant. Editors don’t help much since as soon you jump to a base class, all editor inheritance calculations are relative to the jumped class, not the original subclass. That makes it non-trivial to see what actually happens within code execution without dropping into pdb. This package aims to aid with such issues. It has a collection of cli tools which help troubleshooting complex classes with big MRO trees.
Using
MRO tools exposes all tools via a single group command. All available commands can be seen by executing mro-tools command:
❯❯❯ mro-tools Usage: mro-tools [OPTIONS] COMMAND [ARGS]... Options: --help Show this message and exit. Commands: method Get all method definitions within all classes... version Print version of mro-tools
Each sub-command has more documentation:
❯❯❯ mro-tools version --help Usage: mro-tools version [OPTIONS] Print version of mro-tools Options: --help Show this message and exit.
mro-tools can also be accessed as a Python module:
❯❯❯ python -m mro_tools
Examples
❯❯❯ python -m mro_tools method django.views.generic:FormView.get_context_data
========
Full MRO
========
django.views.generic.edit.FormView
django.views.generic.base.TemplateResponseMixin
django.views.generic.edit.BaseFormView
django.views.generic.edit.FormMixin
django.views.generic.base.ContextMixin
django.views.generic.edit.ProcessFormView
django.views.generic.base.View
builtins.object
----------------------------------------------------
django.views.generic.edit.FormMixin.get_context_data
----------------------------------------------------
def get_context_data(self, **kwargs):
"""Insert the form into the context dict."""
if 'form' not in kwargs:
kwargs['form'] = self.get_form()
return super().get_context_data(**kwargs)
-------------------------------------------------------
django.views.generic.base.ContextMixin.get_context_data
-------------------------------------------------------
def get_context_data(self, **kwargs):
if 'view' not in kwargs:
kwargs['view'] = self
if self.extra_context is not None:
kwargs.update(self.extra_context)
return kwargs
History
0.3.0 (2019-02-08)
Added --no-color option. This allows open in other editors for syntax highlight: mro-tools klass ... | vim -R - +'set syntax=python'
Added file to class header in klass command
0.2.0 (2018-09-22)
Added klass command
0.1.3 (2018-09-13)
Added pygments code highlight to method
0.1.2 (2018-02-13)
Added --django-configurations option
0.1.1 (2018-01-05)
Fixes RST markup in README
0.1.0 (2018-01-05)
First release on PyPI.
Credits
Development Lead
Miroslav Shubernetskiy - https://github.com/miki725
Contributors
None yet. Why not be the first?
License
The MIT License (MIT)
Copyright (c) 2018, Miroslav Shubernetskiy
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Metadata
Release files for mro-tools 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mro-tools-0.3.0.tar.gz | 6.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mro_tools-0.3.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 15.4 kB
Release files / mro-tools-0.3.0.tar.gz
| Download URL | mro-tools-0.3.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fbb57d9f5980f15f90e9c074c2822618bfe2b59037b522762bf23df2566f898
|
|
BLAKE2b-256 checksum How to use checksums |
1e0ba24ca69177f7ee5bde58d3e464cdd6e12ab13ad88c1fb339f47e8aa47cf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.7
|
Release files / mro_tools-0.3.0-py2.py3-none-any.whl
| Download URL | mro_tools-0.3.0-py2.py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
3ebaacc6fdc97ba0c8ee75f591c8e1932c4d97a63208a1ce1497577f863ace96
|
|
BLAKE2b-256 checksum How to use checksums |
76d156bc59ee2b982093bb58b0ebd52fa3c392aa989e8c79c770ac2278f9db46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.7
|
Security for mro-tools 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.