Restrict the versions and add 3.1

'~> 2.6' will match 2.7.x.