Library.create_new_library checks existence wrong
The create_new_library method first checks the existence of the library, and then creates the library only if it does not exist.
However, when checking existence, it uses library_name, while when creating it uses safe_name. If the library_name is not equal to the safe_name, the next time the library existence check will not succeed, however creation of the library would also fail - because the function attempts to create a different name.
The correct logic would be to convert the library name to the safe name as early as possible, and conduct further manipulations (checking existence etc.) with the safe name.
@b4nt0 - thanks, this is a really good catch - agree that it should be tightened. Please feel free to submit a PR if you are interested to work on it - otherwise, I will try to get to it early next week. thanks! Darren
There is also an opportunity to move some logic somewhere else, for example the following code block does not dependent on account_name, nor does it depend on library_name.
https://github.com/llmware-ai/llmware/blob/2563496a45b0b7defbcd10c926779536628b077c/llmware/library.py#L174-L199
Everything it does is setting path variables, and then creating these paths and changing the access rights.