While exploring CircuitPython apps and libraries, I did a side project. I created PyAPIDiffTool (https://github.com/mMerlin/PyAPIDiffTool), a tool to compare the API of different module implementations. This could be useful to developers working on CircuitPython packages. It has extensive configuration file and command line support to adjust what it reports. It can be used to show differences, not implemented, extensions between the base implementation and the port. It can report or ignore differences in docstrings, typehint annotations that exist in the port but not in the base, When doing differences, it can be told to report exact matches or not.
I wrote it for my own curiosity, so reporting is very rough. Developers working on library code should be able to understand it. That said, I could use some feedback on things I may have forgotten to implement, or better ways to do the reporting. It is now stable enough to write good unittests, but that would be a whole other project. The repo github issues is open for bugs and feedback. Contributions welcome.
As an example, here is the output comparing logging and adafruit_logging. Configured to show minimal information about public matched attributes with differences. It can be a lot more verbose.
14 base attributes skipped, 12 port attributes skipped.
13 Matched, 42 Not Implemented, and 15 Extension attributes found.
Matched in "logging" base and "adafruit_logging" port implementations.
"LogRecord" Differences: ('logging',)¦('adafruit_logging',)
Base detail key class not equal port key namedtuple: cannot compare further
('class', Sentinel Tag: 'Other:Expand')
('namedtuple', "('name', 'levelno', 'levelname', 'msg', 'created', 'args')")
"getLogger" Differences: ('logging',)¦('adafruit_logging',)
Method Parameters:
positional parameter 0 name: base "name"; port "logger_name"
positional parameter 0 default: base "None"; port :str ""