PlatformIO Community

Keep a local library in design for archive?

Hello !
I have a question related to library.
When creating a project on atom, for arduino, esp8266, whatever, it will be created an src and lib directory.
Most of library I use are from library manager: I search and “install” them from the library gui in atom/platformio.

Then, I use github to manage and store my code.

Is there a way to automatically create a copy of library I use in my_project/lib directory ?

I would like to make sure I can freeze in github a full copy of my code, including library.

If the libraries you are using are from the library manager, use your platformio.ini file lib_deps parameter to specify libraries your project needs, and if you want a specific version, that specific version… then you don’t need the distribute the library… it will be automatically installed (to the .piolibdeps folder).

https://docs.platformio.org/en/latest/projectconf/section_env_library.html#lib-deps

Hi !!!
I’m very sorry, I missed the answer to my post and just discover now!
The issue is still valid :slight_smile:

Can I just do like this :

[env:d1_mini_pro]
    platform = espressif8266
    board = d1_mini_pro
    framework = arduino

    lib_deps =
    PubSubClient@2.7
    PCF8583@1.0.0 

My expectation is that it will stick to pubsubclient v2.7 & PCF8583 v1.0.0 (those libs are installed from platformIO library) even if I update my libs ?

My intention is that I can then freeze all used libs when I want to release a working code.

Ah, while having a look in “PIO Home” (in vscode), I notice that each lib has an “installation” tab that just show perfect examples with various situation on how to do what I need :blush:

I add a screenshot in case it helps some other:

1 Like

Yes, exactly. For example, this is the configuration for code I’m currently working on…

platform = espressif8266@2.3.0
framework = arduino
lib_deps = 
   PCA9685 16-Channel PWM Driver Module Library@1.2.9
   ESPAsyncTCP@1.2.0
   ESP Async WebServer@1.2.0
   ESPAsyncWiFiManager@0.20
   AsyncMqttClient@0.8.2

… and it locks not just the version of the libraries, but also the platform/core version, (2.3.0 = esp8266/arduino 2.6.1, 2.3.1 = 2.6.2).

1 Like