Library guidelines

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
Kenneth
Posts: 11
Joined: Wed May 07, 2014 10:29 am

Library guidelines

Post by Kenneth » Wed May 07, 2014 7:29 pm

I just wrote a first quick version for a library for SSD1306 oled displays (128x64 and 128x32), tested for 128x32.

The file is called ssd1306.py and you can place it next to your main.py. after that, you can use code like:

Code: Select all

from ssd1306 import SSD1306
display = SSD1306(pinout={'sda': 'Y1',
                          'sck': 'Y2',
                          'dc': 'Y3',
                          'res': 'Y4',
                          'cs': 'Y5'},
                  external_vcc=True)

current = False
try:
  display.poweron()
  display.init_display()
  
  while True:
    current = not current
    display.set_pixel(0, 0, current)
    display.display()
    pyb.delay(1000)
except:
  display.poweroff()
However, what are the guidelines to contribute libraries (in this case, the ssd1306.py file)? I could not find a proper location in the repo, or should we create a new repo with various libraries that people can use?

Maybe a folder per library with in that folder the py file(s) and a readme with more information.

Any suggestions?

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Library guidelines

Post by pfalcon » Wed May 07, 2014 7:41 pm

A suggestion is to do the same as general Python community does - make your module easily available to the rest community (e.g. via PyPI), but maintain it yourself. There're already proof-of-concept support for installing modules from PyPI, number of modules posted already as part of http://forum.micropython.org/viewtopic.php?f=5&t=70 project, and RFC for packaging guidelines at https://github.com/micropython/micropython/issues/413 .
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

domgiles
Posts: 10
Joined: Fri Aug 08, 2014 2:54 pm

Re: Library guidelines

Post by domgiles » Fri Aug 08, 2014 2:56 pm

Hi Kenneth

Is this the I2C variants of the SSD1306 displays. I'd be really interested in using it/contributing.

Thanks

Dom

Turbinenreiter
Posts: 288
Joined: Sun May 04, 2014 8:54 am

Re: Library guidelines

Post by Turbinenreiter » Fri Aug 08, 2014 4:24 pm

What I do is to just create a Github repository and post links to the wiki and in the forum.

See http://forum.micropython.org/viewtopic.php?f=5&t=226


However, maybe it would be a good idea to create an 'micropython-devlib' repository in the micropython account (https://github.com/micropython).
Having everything in one place would help with two things:
1. Finding stuff is easier, so you won't start hacking on a module to just find out that someone already did it later.
2. Consistency. People would see other modules and talk to other authors, leading to more consistent modules.

Maintaining would be tricky, tough.

Post Reply