Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, a web toolkit designed to help citizens, conservation practitioners, municipal decision-makers, researchers, educators, and students advance knowledge and stewardship of fresh water. New to EnviroDIY? Start here

Managing EnviroDIY libraries and dependencies

Home Forums Mayfly Data Logger Managing EnviroDIY libraries and dependencies

Viewing 7 reply threads
  • Author
    Posts
    • #13884
      Matt Barney
      Participant

      I’m still a newbie when it comes to PlatformIO and dependency management. What is a recommended best practice for managing the versions of EnviroDIY libaries that I have installed? Do you post notifications on the forum when new stable releases come out? I program each Mayfly from my laptop before shipping it out to the field, and I haven’t updated any dependencies on my machine in a couple of months or so. Should I be doing a ‘pio lib -g update’ more often?

      A somewhat-related PlatformIO question: If I want to tweak settings for a particular project (e.g. trying out changes to the AT commands that DigiXBeeCellularTransparent sends), do I need to clone the whole ModularSensors repository to my machine? I could modify the source code in my .platformio\lib\EnviroDIY_ModularSensors_ID1648, but of course that would affect all projects that I build. Sorry if the answer is already out there — it likely is. If so, feel free to point me to the relevant pages.

      Thanks for your advice and help!

      Matt

    • #13888
      Sara Damiano
      Moderator

      Personally, I don’t install any libraries at all to my “global” folder in platformio.  (ie user\me_xx\.platformio\lib\xxx)  I always reclone the entire batch of libraries into the .pio\libdeps\xxx folder for each project.  That way I can recreate a specific program with the libraries just as they were when the program was used and can update at will for any given project.  It means re-downloading the files a bunch of times and wasting space on your computer with those files, but they’re fairly small text files.

    • #13889
      Sara Damiano
      Moderator

      If you have the same library installed in a global folder (ie user\me_xx\.platformio\lib\xxx) and the local project library dependency folder (project_xx\.pio\libdeps\xxx) PlatformIO should select the local one to build that project and ignore the global installation.  Here’s the docs on the prioritization of installed libraries used at compile time: https://docs.platformio.org/en/latest/librarymanager/ldf.html#dependency-finder-mode

    • #13895
      Matt Barney
      Participant

      Thanks Sara, that’s very helpful. -Matt

    • #13896
      Sara Damiano
      Moderator

      Also, I’m shamefully bad about notifying anyone when I’ve updated the libraries.

    • #13904
      Matt Barney
      Participant

      I understand. I assume that whatever is in the master branch is considered stable and OK to deploy in the field (while keeping in mind all standard caveats to software development and testing 🙂 ).

       

    • #13969
      Matt Barney
      Participant

      Hi Sara,

      Today I started to shift my workflow to having all dependencies local to a given project as you suggested. I’m wondering whether it’s even necessary to clone the ModularSensors dependencies into the project’s .pio\libdeps path? If I create a new PlatformIO project and modify its .ini file to include:

      … then PIO populates a number of dependencies into .pio\libdeps\mayfly\*  …It’s not everything from here, but it’s enough to let the project successfully build. [edit 3/21: I ran pio lib update, and it fully populates the dependencies here.]

      I have not seen this dependency population happen before, and I’m wondering whether this is new behavior? I updated my PIO core to the latest, 4.3.1, today.

      Another question, if you don’t mind: Do you normally specify the version of ModularSensors in your ini when you’re preparing code for a particular Mayfly (as opposed to when you’re doing development work on the library itself)? Initially I was specifying version, simply because I had started from one of the examples, and its ini specified EnviroDIY_ModularSensors@0.23.16. Or do you just leave off the version number and let it grab the latest?

      Thanks!

      Matt

    • #13972
      Sara Damiano
      Moderator

      That automatic library population used to happen in PIO version 3ish, but it got lost somewhere in the updates.  It’s good to hear it’s back again.

      I don’t usually specify the version of ModularSensors in my ini file, but it’s not a bad idea to do so.  If you want to later recreate the set-up exactly, then it’s definitely easier if the version number is in the set-up.  Most of the time for us, though, when something goes wrong in the field, we reprogram it with the newest version of the library rather than reprogram with the version it had had previously.

Viewing 7 reply threads

You must be logged in to reply to this topic.