{"id":96,"date":"2020-05-17T10:56:59","date_gmt":"2020-05-17T09:56:59","guid":{"rendered":"http:\/\/www.bolukan.nl\/?p=96"},"modified":"2021-01-03T12:39:07","modified_gmt":"2021-01-03T11:39:07","slug":"document-used-libraries-in-your-project","status":"publish","type":"post","link":"https:\/\/www.bolukan.nl\/?p=96","title":{"rendered":"Document the libraries you use in your platformio project"},"content":{"rendered":"\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/platformio.org\/\" target=\"_blank\">PlatformIO IDE<\/a> delivers a powerfull environment for your Arduino code projects and organises thousands of libraries including a project dependency manager. By adding the identifier into the platformio.ini file of your project, PlatformIO will download the library and its dependencies.  To document the libraries used, I insert comment lines in platformio.ini.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/www.bolukan.nl\/wp-content\/uploads\/2019\/11\/platformio-logo.17fdc3bc.png\" alt=\"Platform IO\" class=\"wp-image-76\" width=\"129\" height=\"129\"\/><\/figure>\n\n\n\n<p>To keep the comments correct and standardised I created an text file with all the comment lines on libraries. It became a job to add lines for new libraries and also slowed down adding libraries into new projects. Time to automate this job.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"160\" src=\"https:\/\/www.bolukan.nl\/wp-content\/uploads\/2020\/05\/dependencies_old-1024x160.png\" alt=\"\" class=\"wp-image-97\" srcset=\"https:\/\/www.bolukan.nl\/wp-content\/uploads\/2020\/05\/dependencies_old-1024x160.png 1024w, https:\/\/www.bolukan.nl\/wp-content\/uploads\/2020\/05\/dependencies_old-300x47.png 300w, https:\/\/www.bolukan.nl\/wp-content\/uploads\/2020\/05\/dependencies_old-768x120.png 768w, https:\/\/www.bolukan.nl\/wp-content\/uploads\/2020\/05\/dependencies_old-780x122.png 780w, https:\/\/www.bolukan.nl\/wp-content\/uploads\/2020\/05\/dependencies_old.png 1335w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Former list to documentation libraries<\/figcaption><\/figure>\n\n\n\n<p>First I looked into scraping PlatformIO library pages, but in a second attempt I discovered they offer a nice <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/platformio\/platformio-api\" target=\"_blank\">API<\/a>. The API endpoint <code>https:\/\/api.platformio.org\/lib\/info\/&lt;id&gt;<\/code> returns the needed info. I put the logic to retrieve and format the data in a PHP-page, which is available as gist on my github: <a rel=\"noreferrer noopener\" href=\"https:\/\/gist.github.com\/Bolukan\/8b49afa97f460549d526c641e8b75cac\" target=\"_blank\">platformio.php<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">How to use the code<\/h4>\n\n\n\n<p>Call the script as follows: <code>platformio.php?id=&lt;id&gt;[,&lt;id2&gt;]<\/code>. As you may notice the script can process multiple libraries in one call. Make sure not to overload your and their server! The returned lines are formatted with up to 80 characters and information will be split into multiple lines if needed. I also added extra information to document which version was used when the project was created.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"349\" src=\"http:\/\/www.bolukan.nl\/wp-content\/uploads\/2020\/05\/dependencies_new-1024x349.png\" alt=\"New layout of library documentation\" class=\"wp-image-99\" srcset=\"https:\/\/www.bolukan.nl\/wp-content\/uploads\/2020\/05\/dependencies_new-1024x349.png 1024w, https:\/\/www.bolukan.nl\/wp-content\/uploads\/2020\/05\/dependencies_new-300x102.png 300w, https:\/\/www.bolukan.nl\/wp-content\/uploads\/2020\/05\/dependencies_new-768x262.png 768w, https:\/\/www.bolukan.nl\/wp-content\/uploads\/2020\/05\/dependencies_new-780x266.png 780w, https:\/\/www.bolukan.nl\/wp-content\/uploads\/2020\/05\/dependencies_new.png 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Layout of library documenation using PHP-script<\/figcaption><\/figure>\n\n\n\n<p>Now I can add new libraries including the documentation very quickly. And it is no longer needed to maintain a text file with the standardized documentation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PlatformIO IDE delivers a powerfull environment for your Arduino code projects and organises thousands of libraries including a project dependency manager. By adding the identifier into the platformio.ini file of your project, PlatformIO will download the library and its dependencies. To document the libraries used, I insert comment lines in platformio.ini. To keep the comments [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[12],"class_list":["post-96","post","type-post","status-publish","format-standard","hentry","category-software","tag-platformio"],"_links":{"self":[{"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=96"}],"version-history":[{"count":6,"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=\/wp\/v2\/posts\/96\/revisions"}],"predecessor-version":[{"id":173,"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=\/wp\/v2\/posts\/96\/revisions\/173"}],"wp:attachment":[{"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bolukan.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}