Closed tannewt closed 6 years ago
@tannewt @kattni Not sure if this will work as a reply. I had inquired about some drivers and when they would be available on Pypi. I am working on a project using Adafruit boards with a Raspberrypi. I was asked if I would like to help with the conversion. I said yes and was directed here. Would like to help.
Mark
Hey @Navyjetfixer. Sorry for the silence. I've been busy. What libraries are you looking to have? Steps 5-8 above are ones you should be able to help with to get started. Someone can then follow up with the others. Thanks!
I was unable to get travis
installed using Ruby on Mac OS X. I instead used brew install travis
using this formula. It still requires Ruby be installed, which I had also done through brew
.
Following travis
installation, I had to chmod
the ~/.travis
folder to get it to work properly. I don't know if this is a step that will be required for everyone, but I'm including it in the event that anyone else runs into issues as well.
I was attempting to install Motor and PCA9686 on my Pi this morning when I saw the builds were requested in Travis, but did not go through to deploy due to an error in .travis.yml
:
provider: releases
should be - provider: releases
.
I suggest adding a few steps to the workflow to prevent this:
master
, validate the .travis.yml
using travis-lint (gem install travis-lint
). pip install libName
This has been completed on everything except CircuitPlayground Express cpx
Express
lib, and the Featherwing helper library. The Featherwing library I plan to revisit at some point. The structure of the library caused a number of issues that ended with Sphinx requiring an autodock_mock_import
of adafruit_featherwing
which meant that api.rst
was no longer populated by the modules, which caused a build failure.
Otherwise, this is completed for all existing libraries and helper functions.
We want to use CircuitPython libraries on other platforms such as CPython on Raspberry Pi and MicroPython. To do so, we need to better document the dependencies and get builds auto-released to pypi where
pip
gets them from.Requirements
To do this work you'll need the
adafruit-travis
pypi username and password. You will also needadafruit-adabot
s GitHub password. Please contact @tannewt or @kattni if you are interested.You must have Ruby and
travis
installed. Instructions can be found on the Travis CI repo. On Mac OS, once you have Ruby updated, if you run into issues, you canbrew install travis
(see comment below for details).Instructions
Upgrading a repo requires a number of steps: 1) Use
travis
(the Ruby CLI) to encrypt the pypi password into the travis.yml. The blob changes every repo. You MUST be logged into the Travis CLI using theadafruit-adabot
GitHub credentials. Runtravis encrypt --com --add deploy.password
and follow the prompt. It will reformat the.travis.yml
and drop the header comment. That's ok and can be left as is. The result will be that .travis.yml has something like this:2) Now modify the deploy section to add a pypi section and including the password portion in it. You may need to add the
-
beforeprovider: releases
and addoverwrite: true
as well.3) The pypi release step runs commands in the console after the serial section so we need to ensure we leave it in the top level. So, change the docs line by adding
&& cd ..
to the end. The end result is:4) Add an install command for installing the requirements.txt
- pip install -r requirements.txt
into.travis.yml
. Full section:note circuitpython-travis-build-tools was renamed circuitpython-build-tools
5) Next we need to add/update a
setup.py
file to the repo. Change the name to match the GitHub repo except lowercase and-
instead of_
. Update the description, url and packages list. If the library is a single py file replacepackages
withpy_modules
. They both take a list without the .py extension. Here is a full example:if its a single-python-file type driver, use something like:
py_modules=['adafruit_mcp230xx'],
6) Update dependencies! Dependencies are documented in two places:
install_requires
requirements.txt
file. Check the source files for imports from other libraries and add them in both places. If CircuitPython APIs are used such asdigitalio
,busio
orfrom micropython import const
then addAdafruit-Blinka
as a dependency.adafruit-circuitpython-bus-device
toadafruit-circuitpython-busdevice
in requirements.txtdocs/conf.py
because sphinx and Travis will install therequirements.txt
before running sphinx. 7) Test the setup.py locally withpython3 setup.py sdist
. 8) Commit or PR the changes. 9) Once the change is in the GitHub repo watch Travis and make sure the build remains green. 10) Create a new release to trigger the actual pypi deploy. Increment the patch position (the right-most number.) All libraries should have release notes of the form:To use in CircuitPython, download the .mpy file and copy it to the
lib
folder on theCIRCUITPY
drive. Or, simply install the Adafruit CircuitPython bundle.To use in CPython,
pip install adafruit-circuitpython-<libname>
.Read the docs for info on how to use it.