So far I have:
* Publish your project on Github. eg.
https://github.com/mcauser/micropython-am2320
* Add setup.py to your project. eg.
https://github.com/mcauser/micropython- ... r/setup.py
* Tag with a version, eg 1.0.0. eg.
https://github.com/mcauser/micropython- ... tag/v1.0.0
* Use x.x.x. for version numbers - see.
http://semver.org/
* Read instructions
https://packaging.python.org/tutorials/ ... ct-to-pypi
* Create login on
https://pypi.python.org/pypi/
* Create ~/.pypirc to store pypi auth (in plaintext!)
* In your project dir, create a Source Distribution. This creates /dist/*.tar.gz
* Upload to pypi using twine. Twine will handle registering the project
Code: Select all
$ pip install twine
$ twine upload dist/*
* You should now see your package on
https://pypi.python.org/pypi eg.
https://pypi.python.org/pypi/micropython-am2320/1.0.0
* Connect to your MicroPython device. eg. WeMos D1 Mini
Code: Select all
$ screen /dev/tty.wchusbserial1420 115200
Code: Select all
MicroPython v1.9-1-ge5e49be-dirty on 2017-06-09; ESP module with ESP8266
>>> import network
>>> sta_if = network.WLAN(network.STA_IF)
>>> sta_if.active(True)
(upip needs access to the internet)
>>> import os
>>> os.listdir('lib')
[]
>>> import upip
>>> upip.install('micropython-am2320')
Installing to: /lib/
Warning: pypi.python.org SSL certificate is not validated
Installing micropython-am2320 1.0.0 from https://pypi.python.org/packages/52/7a/7002dadbc77ed0ea437331d038a5d69f169f4f450da03f96c01d7cce1919/micropython-am2320-1.0.0.tar.gz
Error installing 'micropython-am2320': [Errno 22] EINVAL, packages may be partially installed
>>> os.listdir('lib')
['am2320.py']
(library is there)
>>> import am2320
>>> from machine import I2C, Pin
>>> i2c = I2C(scl=Pin(5), sda=Pin(4))
>>> sensor = am2320.AM2320(i2c)
>>> sensor.measure()
(and it works)
>>> os.remove('/lib/am2320.py')
(delete it)
It works, but I'm still trying to figure out that
[Errno 22] EINVAL, packages may be partially installed error.
You can find my drivers by using the
Programming Language :: Python :: Implementation :: MicroPython classifier.
https://pypi.python.org/pypi?:action=browse&c=639