Can I obtain platformio.ini lib_deps from an external file?

I would like to obtain some values in my platformio.ini from an external file. Specifically, I would like to obtain lib_deps from an external file, because this would allow me to streamline CI/CD builds: during normal development I would refer to all libraries without version information, but just before building a distribution I would annotate each external library with @version so that a release of my software would have the dependencies hard-coded.

Is this possible?

Per documentation (here, and here) the lib_deps expression allows the file:// pseudo-protocol, so yes, you can do stuff like

lib_deps = 
   MyLibrary=file://C:\some\path\to\lib\folder

By using lib_extra_dirs, you can also point to a folder containing your library folders, that will be used.

@maxgerhardt I think my description of the problem was not clear.

I want to have a text file with a list of the dependency libraries, so that I can change that file in the repo and have the CI/CD do the right thing. So, inventing nonexistent syntax:

platformio.ini:

lib_deps = include-file("platformio-lib-deps.txt")

platformio-lib-deps.txt during normal development:

Adafruit NeoPixel
Time
Timezone
ArduinoJson
ArduinoJWT

platformio-lib-deps.txt on the commit that builds a release:

Adafruit NeoPixel@~1.3.5
Time@~1.6
Timezone@~1.2.4
ArduinoJson@~6.14.1
ArduinoJWT@~1.0.1

But then you would have to be extremely careful that the libraries during develeopment and the code that is then released matches the later-annotated versions of the libraries.

Hm if it’s just important for CI, you can create a second platformio_dev.ini and in the pio ci command for compiling / testing the library, you can use the -c option to refer to that file (docs).

As to my knowledge and the documentation, there exists no feature where you can include other files in the platformio.ini. I may be wrong and it exists or it does not, in both cases a question / feature request to https://github.com/platformio/platformio-core/issues would be the way to go.

But then you would have to be extremely careful that the libraries during develeopment and the code that is then released matches the later-annotated versions of the libraries.

That is exactly the point. While developing I use the most recent release of each dependent library. When I’m ready to release I manually inspect the version numbers, and hard-code them. Then I build the release, which will be tagged for all posterity with versions that are known to work. Think a method analogous to Python’s pip freeze.

I’ll wait a bit longer to see whether anyone else has suggestions and otherwise submit a feature request on GitHub.

I’ve just stumbled accross a feature that allows you to include other .ini files: extra_configs. But that then only includes whole files and not specific values for only one setting. However, you can also setup two environments, one for dev and one for release, and run CI in a specific environment (using pio run -e <environment> or pio ci -c <platformioini_for_dev_file.