arduino / arduino-cli

Arduino command line tool
https://arduino.github.io/arduino-cli/latest/
GNU General Public License v3.0
4.32k stars 373 forks source link

Version restriction for installing library #105

Open scls19fr opened 5 years ago

scls19fr commented 5 years ago

Hello,

I noticed in doc:

 $ arduino-cli lib install "WiFi101"

install latest "registered" library named WiFi101.

I wonder if it's currently possible to restrict version of library to install a library using a command line like

 $ arduino-cli lib install "ArduinoJson<6.0.0,>=5.0.0"

or simply

 $ arduino-cli lib install "ArduinoJson<6.0.0"

Such a command could install latest version between 5.0.0 (include) and 6.0.0 (exclude) ie, currently 5.13.4.

This is quite similar to Python requirements.txt syntax. See https://www.python.org/dev/peps/pep-0440/#compatible-release and https://stackoverflow.com/questions/8795617/how-to-pip-install-a-package-with-min-and-max-version-range

Installing a given version should also be considered (or documented)

 $ arduino-cli lib install "ArduinoJson==5.13.4"

Specifying an "unregistered" library could also be supported (with care) ( #128 )

https://stackoverflow.com/questions/16584552/how-to-state-in-requirements-txt-a-direct-github-source

Kind regards

PS : related issue https://github.com/arduino/Arduino/issues/5795 PS2 : installing several differents versions of a library could be done using environments https://github.com/arduino/arduino-cli/issues/108

phd commented 3 years ago

Installing a given version should also be considered (or documented)

 $ arduino-cli lib install "ArduinoJson==5.13.4"

You can install a specific version of a library with:

$ arduino-cli lib install "ArduinoJson@5.13.4"
scls19fr commented 3 years ago

Thanks @phd . That's an interesting improvement of arduino-cli. But I don't think version restriction are currently implemented (ie lib version number lower than a given version number and greater than an other one)

ubidefeo commented 3 years ago

@silvanocerza do we support this? Might be an interesting one if we don't :)

silvanocerza commented 3 years ago

I like this, would be something nice to have. I think it would be feasible but I'd have to investigate a bit first just to be sure.