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
Update all hierarchy charts in the docs (re #451) #469
Update all hierarchy charts in the docs (re #451) #469
Conversation
Related to #451 |
LOL, I started working on exactly that myself yesterday! ;-) I was wondering if addon-boards / HATS that connect to fixed physical pins on the Pi (i.e. that don't take a Having got used to the charts being vertical, it seems strange now seeing them horizontal ;) |
Codecov Report
@@ Coverage Diff @@
## master #469 +/- ##
=======================================
Coverage 85.79% 85.79%
=======================================
Files 36 36
Lines 6541 6541
=======================================
Hits 5612 5612
Misses 929 929 Continue to review full report at Codecov.
|
Ah, sorry about that - we've probably got some conflicting changes then. I'm happy to close, merge-then-fix, or wait-and-rebase, whatever's easiest.
Hmm, that's a nice idea. Or just a different border style (I tend to be relatively conservative with colours in charts just in case I wander into colour-blind territory accidentally but we've only got two colours at the moment) |
I was just thinking "it really is a pain maintaining these charts ... I ought to write a script to generate them". Bung in some filtering facilities so we can chop out horrid bits like GPIOBase, and grab segments of the hierarchy like "everything below OutputDevice, and the direct ancestors" so we can generate the smaller charts and that's exactly what I was looking for. Any chance you want to PR it? Could just be a little python script under docs/ to run when we need to re-generate the charts. I wouldn't add it into the Makefile just yet (we'd just wind up with chart regeneration in every bloody PR as each Python source change would cause the .dot files to regen which would rebuild the SVGs and so on). If I can figure out some way of telling it to regen the charts only if the hierarchy has actually changed, I'd do it but that can wait - it'd be great to just have the charts' source capable of being auto-generated. |
Well ... blue, purple ... and a lighter shade of the blue. It's a shade alright, not a colour. That's my excuse, and I'm sticking to it. Ahem ;) |
Yeah, that's pretty much what I was thinking, but hadn't got around to yet. I'll see if I can find some time to do some more work on it... (current version is attached, if you're curious) |
Oh, that's good stuff. I was actually thinking of importing it and working from the class meta-data but frankly regexes are easily "good enough" here and work nice and quickly. I'll see if I can refine this into something complete enough to generate the charts - thanks! |
I've already started doing that myself, so I'd appreciate it if you didn't duplicate the effort... ;-) |
No worries! Look forward to seeing the result :) |
Right, got my auto-charts-generation working, but still need to tidy up the code (it's a bit of a kludgy mess ATM). But it has led me to ponder some questions....
I'm now thinking that perhaps Yes, I realise there are no hard'n'fast rules about which classes are 'concrete' and which are 'abstract'; but it might be nice to get a bit of consistency. I also had some thoughts about the SPI classes, which I'll shortly be opening a separate PR for... Obviously there's not really any way to auto-generate the composed_devices chart ( https://gpiozero.readthedocs.io/en/v1.3.1/api_boards.html#base-classes ), but I did have some thoughts there too... And we could add labels to the edges, to show the number of sub-devices, but I dunno if that makes the chart too complicated : I also found that the full-hierarchy-of-everything diagram I attached in an earlier comment, is much more readable with the mixin classes not shown :-) |
Yup, sounds good to me.
Sounds reasonable - I think the only reason SmoothedInputDevice was marked abstract was because you "usually" wanted to override _read for it to make sense, but it's not mandatory (as demonstrated by MotionSensor). So, yeah, that could certainly be concrete.
Ooooh ... that's nice! Yes, definitely.
I could go for that - doesn't look overly crowded to me?
Yup, definitely better. Try rankdir=RL as well - tends to fit better on the relatively thin page-widths used by the RTD style. |
Looking at the composition chart as well ... with the edge labels it might be clearer if the edges weren't dashed? |
Glad to see we're in agreement :-)
Yeah, I was going to switch to rankdir=RL as part of my code-tidyup :)
I didn't know if the lines were dashed because some kind of "class hierarchy conventions" said dashed lines implied composition? (which is why I left them as they were) shrug What about my Energenie and RGBLED question? Does it make sense to keep them in different diagrams? |
No, no particular convention - just some vague attempt to make them obviously distinct from the rest of the charts, but the colour's probably enough for that (I don't go a bundle on the major diagrammatic systems - most are too complex for their own good).
Good question. Why is Energenie in boards ... but RGBLED in outputs? I know I stuck RGBLED in outputs because, despite being a composite device under the covers, the user doesn't really see it as such - it's just a multi-coloured LED. Now ... why didn't I stick Energenie in there too? Erm ... Yeah, I got nothing. |
@lurch was there any progress on the auto-chart generator? Was just about to merge this and then re-read my way through all the comments :). Doesn't matter if it's still a kludgy mess - just the output would be fine for this PR and one of us can have a look at tidying the code up later. Don't worry if not - this can be merged as is anyway, and we can clean the rest up later. |
@waveform80 good question. It's so long ago that I can't remember how far I got with it, but I'll see if I can dig it out over the weekend. |
Added notes on how the abstracts are represented, ensured all the class hierarchies were up to date, and changed the orientation so the classes are actually readable in the big chart.
6e3d851
to
576fced
Compare
Heavily based on @lurch's efforts in gpiozero#469 but with some additional filtering capabilities.
Added notes on how the abstracts are represented, ensured all the class
hierarchies were up to date, and changed the orientation so the classes
are actually readable in the big chart.