classy-python / ccbv

A documentation tool for getting your head around Django's class based views.
https://ccbv.co.uk/
BSD 2-Clause "Simplified" License
516 stars 68 forks source link

Replace `inspect` module for parsing #182

Open meshy opened 1 year ago

meshy commented 1 year ago

We currently use the inspect module to extract Django code and structure.

This has several drawbacks:

We recently refactored the populate_cbv script to abstract the importer into a protocol that will (hopefully) make it easier for new importers to be written. LibCSV may be an appropriate alternative to inspect.

https://github.com/classy-python/ccbv/blob/a89118bc975bd91bb73135edb9f5d8b172f9c596/cbv/importer/importers.py#L29-L31

meshy commented 1 year ago

Python's ast module has potential, if we can be sure it preserves formatting.

meshy commented 1 year ago

https://github.com/PyCQA/astroid is interesting.

ghickman commented 3 months ago

There's an interesting proposal to the Twisted project currently about a tool called passmanager, which could be useful to us.

It drives the pydoctor tool. I've pointed this at a local Django clone, and it pulled out many things we would want:

I'm not suggesting we use pydoctor, but it shows it's pulling out similar things we want.