Client.instance(image, name) :: change name when it contains '-'
Hello,
when one instanciate an instance giving a name that contains a - (minus sign).
the generated instance have a name slightly changed to name whit - (minus) replaced by _ underscore. see:
>>> Client.instance('/my/image.sif', name='foo-1.2.3')
instance://foo_1.2.3
as far I as understand this is due to: the call of generate_name in spython/instance/__init__.py
def generate_name(self, name=None):
"""generate a Robot Name for the instance to use, if the user doesn't
supply one.
"""
# If no name provided, use robot name
if name is None:
name = self.RobotNamer.generate()
self.name = name.replace("-", "_")
I was expecting to have an instance with name according to the one provided
is there a reason, that I don't catch, for this change
regards
Eric
We don’t allow the dashes and use underscores instead. It’s just a convention.
hummm
ok I will adapt to this convention. NB in my case (packaging stuff) having instances with the name of the tools I'm packaging is helpfull eg
blast-2.14.1
hmmer-3.4
anyway I can live with that or just comment the replace line in my own spython copy ;-)
Eric
I would be OK with matching the convention that SIngularityCE uses - if they allow dashes (and have a regex to check) we can do that too. I'm open to reviewing a PR that makes this change if you'd like it!
look like dash is allowed.
when checking singularity instance_linux.go you can see that name must comply with authorizedChars reg-exp that is defined this way.
authorizedChars = ^[a-zA-Z0-9._-]+$
PR submited.
regards
Eric