I believe the namespace will be needed as number of packages increases.
Look at a real example of npm.
At the beginning It used the one global namespace, and later introduced the scoped package.
As for snapcraft now, when I try to register “firefox” snap, I got the following message.
The name ‘firefox’ is already taken.
Here’s what you can do:
Choose an alternative name that people can associate with you, for example ‘hnakamur-firefox’.
File a dispute to request the existing snap be renamed.
I think this convention is not so good way because of the following two reasons.
If your snap username is something that seems like a package name, it becomes confusing. For example, if your snap username is “firefox”, then the suggested snap package name becomes “firefox-firefox”.
You cannot reserve snap package names starting with your snap name like “username-*” beforehand. Someone might create packages with prefix of your username.
the conflict happens on your machine instead of the store.
I believe this is the very reason why we need namespace.
Snap files are located at /snap/, so we need to choose name which does not conflict to other snap packages.
If you use only the registered snaps, the conversations around conflicts works fine.
However, if you want to use unregistered private snaps as well as the registered snaps, you cannot rely conversations to address conflicts.
We need the naming scheme for avoiding conflicts without the conversations.
So how about adding the user namespace as well as the global namespace?
To minimize the change, I think of two options on the naming scheme.
Prefix snap name with username followed by double hyphens. For example, username–snap-name. The modification needed is denying two consecutive hyphens in snap names, and ask users to change snap names if they have two consecutive hyphens.
Prefix snap name with hyphen, username, and hyphen (like css vendor prefix). For example, -username-snap-name. The modification needed is allowing a hyphen at start.
In both ways, the validation is needed so that only prefix of your username is allowed.
These package name lives alongside the global packages like snap-name nicely.
I’m new to snap and it seems a nice packaging method which overcome the problems of the existing packaging like deb or rpm.
I think it is crucial to have reserved namespaces for a user so that snap will be successful with a massive packages.