pinout-xyz / Pinout.xyz

Source files for the Raspberry Pi Pinout documentation website.
http://pinout.xyz/
Creative Commons Attribution Share Alike 4.0 International
680 stars 197 forks source link

Moving to Github Pages, Python 3, general code and dataset review #448

Open ali1234 opened 1 year ago

ali1234 commented 1 year ago

Abstract:

On moving to Pages:

Code review and Python 3 changes:

On the dataset itself:

['buy'] str
['class'] str
['collected'] str
['description'] str
['docs'] str
['eeprom'] str, bool
['flash'][string_int]['active'] str
['flash'][string_int]['mode'] str
['formfactor'] str
['github'] NoneType, str
['ground'][string_int] NoneType
['i2c']['0x60-0x6F']['device'] str
['i2c']['dynamic']['device'] str
['i2c']['dynamic']['name'] str
['i2c'][int]['device'] str
['i2c'][string_int]['alternate'][<list>] str
['i2c'][string_int]['device'] str
['i2c'][string_int]['name'] str
['image'] str
['install']['apt'][<list>] str
['install']['devices'][<list>] str
['install']['python'][<list>] str
['install']['python3'][<list>] str
['manufacturer'] str
['name'] str
['page_url'] str
['pin']['mode'] str
['pin'][bcm_pin]['direction'] str
['pin'][bcm_pin]['mode'] str
['pin'][bcm_pin]['name'] str
['pin'][int]['active'] str
['pin'][int]['mode'] str
['pin'][int]['name'] str
['pin'][string_int] NoneType
['pin'][string_int]['active'] str
['pin'][string_int]['description'] str
['pin'][string_int]['direction'] str
['pin'][string_int]['external_pull'] str
['pin'][string_int]['mode'] str
['pin'][string_int]['name'] NoneType, str
['pin'][string_int]['pull'] str
['pincount'] int
['power'] NoneType
['power'][string_int] str, NoneType
['schematic'] NoneType, str
['title'] NoneType, str
['type'] str
['url'] str

Some errors can be seen in the above. For example, somewhere there is a pin which has a mode without a number. Note that not every path appears in every file, which makes parsing a bit harder. The list of paths that are always present is surprisingly short:

['type']
['name']
['title']
['class']

So that's the state of things now. Fixing all these problems is a design challenge. Normalizing the data for a new design should be very easy to automate. Another consideration is the microbit and pico sites. If we are going to completely redesign one of them we should probably make it general enough to drive all of them, and anything new that comes out in the future.

ali1234 commented 1 year ago

Python 3 fixes and a Pages workflow are on the default branch here: https://github.com/ali1234/Pinout.xyz

That repository is auto syncing to https://pinout.zerostem.io on every push (currently English HTML only.)

Gadgetoid commented 1 year ago

I need to get around to looking at this. I'm really keen to move over to GitHub pages to make keeping the site up-to-date easier, and potentially helping me delegate more responsibility to community members who've helped over the years. Should they want it!

An org actually sounds like a great idea. I had forgotten this issue exists (it landed just about the time we we're at critical with baby preparations) and was just wondering how to handle multiple subdomains for languages. It seems an org, and just repos that do nothing but contain the generated HTML files would be a reasonable approach.

Gadgetoid commented 1 year ago

Oh and pico.pinout.xyz at least is just a hand-crafted static HTML site. I have just moved that over to GitHub pages this morning. I don't currently have any plans to make it into a board database, though I wont rule out the idea altogether.

I think a lot of the friction with the Pi database is - reading between the lines here - just how awful this code and dataset is. It grew very organically and I tend to get caught up trying to optimise the actual end result rather than the process to produce it. Maybe a better system will make Pico and MicroBit board databases, and alternate pin layouts (for third party boards in RP2040s case) more attainable.

Have had an org set up for a while, must have forgotten about it - https://github.com/pinout-xyz