platformio / platformio-core

Your Gateway to Embedded Software Development Excellence :alien:
https://platformio.org
Apache License 2.0
7.92k stars 792 forks source link

Library Manager (Arduino / MSP430) #6

Closed ivankravets closed 10 years ago

ivankravets commented 10 years ago

We have excellent package managers like: pip, homebrew, bower, npm... I think it is time to create a libraries manager for different platforms (+ embedded). Each library should have library.json file, where will be necessary information like:

UPDATED: library.json specification

We have many excellent Arduino and MSP430 libraries on GtHub. It would be excellent to search and manage them with CLI:

$ platformio lib search %QUERY_HERE%
$ platformio lib install %LIBRARY_NAME%
$ platformio lib update
$ platformio lib uninstall
$ platformio lib list  # Show a list from installed libraries
$ platformio lib register %GITHUB_REPO_URL% # for developer of library

Then you can include installed libraries in your ".h/c/cpp" files. PlatformIO will parse them and build in auto-mode.

For example:

$ platformio lib search "arduino ir"
# answer ...
# Arduino-IRremote - Infrared remote library for Arduino: send and receive infrared signals with multiple protocols
$ platformio lib install Arduino-IRremote

Now, PlatformIO will install Arduino-IRremote library to special location. Then we can use it in our sketch ("my_ir.cpp"):

#include <IRremote.h>
#include <IRremoteInt.h> 

void setup () { /* */ }
void loop () { /* */ }

Any propositions/ides are welcome!

Bouni commented 10 years ago

That's an excellent idea! How do you plan to host the information about all the libs?

ivankravets commented 10 years ago

@Bouni All libraries will be hosted on GitHub. The one thing that developer should add is library.json file and register library via

$ platformio libs register %GITHUB_REPO_URL%

Then PlatformIO will use this library to propose for search/install operations.

Bouni commented 10 years ago

So you perform a search on Github for projects that provide a library.json file, or do you provide a list of all projects that has such a file? I just think about the time factor for such a large search!?

ivankravets commented 10 years ago

@Bouni It is another topic how PlatformIO should operate with registered libraries. I propose to create separated service (preferably Twisted Async App) that will serve each necessary information via REST API. User's PlatformIO CLI tool will communicate with this REST API for search/info operations. Also this service will collect all interesting information from libraries repo like:

Stars + Downloads will be used for RANK-ing search result.

Finally, there isn't a problem to create awesome WEB2.0 page which will allow to search/list/order libraries via browser.

Bouni commented 10 years ago

That sounds absolutely great to me :-) Hope you will get a lot of users for your project and also a lot of participating lib creators!

g7uvw commented 10 years ago

It's a good idea - one annoying thing with a lot of the Energia libs is that they only seem to live in forum postings. A more central repository of libs would be great.

ivankravets commented 10 years ago

@g7uvw Yep... I see one solution - to create separated account named "platformio-libs"(piolibs or piolibs-mirror) and here all people from the world will share interesting libraries (which don't live on GitHub at this time). Because I need real GitHub repository for each library. Only in this way I can monitor library changes, examples and etc.

See example of VIM-Scripts. They are hosted inside one account.

ivankravets commented 10 years ago

Guys @Bouni @g7uvw @hpsaturn, @elyulka,

I've just finished the work on external Library API + $ platformio lib.

Installation

You can install it (or update) from development branch via:

$ pip install https://github.com/ivankravets/platformio/archive/develop.zip

Documentation

Library Manager Documentation

Library Configuration File

I decided to not wait until lib's developers will add library.json file to their libs. I created separated repository with library config mirror.

Which libraries are suitable for PlatformIO? Please read http://docs.platformio.ikravets.com/en/latest/librarymanager/create.html

Binary Search

See http://docs.platformio.ikravets.com/en/latest/userguide/lib/cmd_search.html

Testing

I want to ask you to help me with testing and adding new library configs to https://github.com/ivankravets/platformio-libmirror/tree/master/configs. Tell me please which are your favourite libraries.

And... If it will work good I will start to work on the special WEB site with nice GUI :)

Thanks a lot!

Bouni commented 10 years ago

I will test the new feature as soon as i have some free time :-)

ivankravets commented 10 years ago

Guys @Bouni @g7uvw @hpsaturn, @elyulka, @lesilva00, @skraelings, @translucide

Great news! PlatformIO has own WebSite http://platformio.ikravets.com

So, you can list an embedded libraries via nice Web-GUI.

Please help with testing and filling of the libraryconfigs https://github.com/ivankravets/platformio-libmirror/tree/master/configs

Which are your favourite libraries that aren't presented in PlatformIO Library list now?