-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
wip: Refactor as an extension #41
Conversation
Just a few things to fix:
Then clean up the code and we'll be good to go 🙂 |
f84a37e
to
2a97df4
Compare
A few things first. Since we run tools that collect documentation in subprocesses, I was previously doing this in two phases: first, in the on_nav event, parse all pages to get the autodoc instructions and group them by handler type, and then collect all data at once by spawning the subprocess just once. I was then injecting this data into the mkdocstrings extension, so that it could use it when rendering the markdown contents. This was problematic because we needed to compute hashes of the autodoc identifiers and selection options, to make sure we were rendering the right ones at the right time. Making sure everything was computed and rendered correctly seemed quite complex. But the main reason I did this in two phases, collecting instructions then running subprocesses, was a performance reason. Indeed, spawning a new subprocess (esp. Python)for each autodoc instruction could make mkdocstrings very slow. So I wondered: are there other ways to keep good performance and proceed in a more linear manner, collecting data and rendering it directly from within the markdown extension? Well, the answer is yes! Just have a process that accepts input on stdin, line by line, outputing the result on a single line as well, and keep that process open until site generation is done :) (then close it). So that's what I'm doing now: when the markdown extension hits an autodoc instruction, it gets the associated handler (which is cached), collects the data using the handler's collector, and renders the data using the handler's renderer. This is so much cleaner <3 Anyway, I just like writing a detailed commit message sometimes.
Sorry if this isn't the right place, was the most sensible place I could find to ask. I really really like what you have here, I think there's a potential for this to really take off. What do you need from contributions/community going forwards? I'd be interested in helping out. |
Hey @dtomlinson91, totally the right place. I like it as well 😄 I'll open a new issue for people who'd like to contribute! |
089f82b
to
8bd5866
Compare
🤤 We're almost there 🤤 🤤 🤤
|
We're done 🤤 |
#28