Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace inspect module for parsing #182

Open
meshy opened this issue Oct 16, 2022 · 3 comments
Open

Replace inspect module for parsing #182

meshy opened this issue Oct 16, 2022 · 3 comments

Comments

@meshy
Copy link
Contributor

meshy commented Oct 16, 2022

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.

class CodeImporter(Protocol):
def generate_code_data(self) -> Iterator[CodeElement]:
...

@meshy
Copy link
Contributor Author

meshy commented Nov 18, 2022

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

@meshy
Copy link
Contributor Author

meshy commented Nov 22, 2022

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

@ghickman
Copy link
Contributor

ghickman commented May 20, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants