Cutehacks/qpm

Package name without domain

benlau opened this issue · 3 comments

Hi,

First of all, I would like to thank to start this project. We, Qt Developers, really need this project!

Back to my question, I would like to publish my package QuickPromise to qpm.io .

After setup the repo, then I run qpm publish

Running check
QPM: 2015/10/06 13:51:29 WARNING: stat QuickPromise.qrc: no such file or directory
QPM: 2015/10/06 13:51:29 WARNING: open QuickPromise.qrc: no such file or directory
OK!

Publishing
QPM: 2015/10/06 13:51:34 ERROR:rpc error: code = 3 desc = "name requires a specific format"

(Just ignore the warning of missing .qrc file, I would like to post in another issue)

According to the README.md, qpm recommends to use reverse DNS naming scheme for project, however, it is really weird for a small project of Qt/QML without own website to use reverse DNS naming scheme. Because qpm also enforce .qrc to have prefix same as project name, it will also change the way of using import statement from user.

Currently, user import QuickPromise by

import QuickPromise 1.0

If I publish to qpm.io, it need to change to

import xxx.QuickPromise 1.0

Since QtQuick also don't use reversed domain for package name, it is quite odd.

Moreover, in compare with npm, the user experience will be quite different if reversed domain is enforced. When I use npm, usually I could remember the name of most of package I used. If it is not installed, then I just go to terminal to type npm install --save $package. I don't even need to search. But I don't think I could remember the domain of those packages.

Hi Ben!

Thanks for being an early adopter! When we started developing qpm we did not require the reverse DNS package names, but we thought it would be rather restrictive if only the package name was unique. For example, for common package names like components or button or even utils we didn't think it would be fair if one person "owned" that package name. I know that is how npm and bower do it, but we decided to require a namespace.

That being said, we could potentially solve your use case by allowing qpm install to not require the namespace if the package name itself was unique. So if someone installed qpm install QuickPromise that would work fine, but if someone else published a fork of your repository, then we would issue a warning and say that that they have to be more specific. I have created a roadmap item for this so feel free to vote!

https://trello.com/c/bBWo4zqG

I understand that the majority of small projects do not have their own website. I think the solution here is that we allow for more components in the namespace so you can use subdomains or paths. Right now we are limited to com.bar.foo, but we should at least support com.baz.bar.foo as well as other variations. If this was fixed, then your namespace could be com.github.benlau.quickpromise. Would that work for you? I just pushed a patch that should enable this functionality in in acce87a. Let me know what you think!

Finally, the reason that the QRC file has to be "namespaced" as well is because when a resource file is compiled by Qt's rcc compiler, it will generate a cpp file of the same name in the build directory so if you have two components installed that both have the same resource file (eg: qml.qrc) then it would result in two cpp files with the same name in the build directory which is not going to work. To ensure that the name of the generated cpp files are unique across the entire qpm landscape, we use the fully qualified package name, but replacing . (dot) with _ (underscore).

for common package names like components or button or even utils we didn't think it would be fair if one person "owned" that package name

yes, that is true for this condition. However, if I already chose unique / special name. In someday, other publish a package with same name but different domain. Then it also quite odd.

then your namespace could be com.github.benlau.quickpromise. Would that work for you?

Personally, I don't like it but it is an acceptable solution. Thanks you!

By the way , I have submitted another package before your reply. It use "com.github" as domain name, if user account should be included as part of domain, then I prefer to unpublish to change the name. Can I unpublish a package?

Finally, the reason that the QRC file has to be "namespaced" as well is because when a resource file is compiled by Qt's rcc compiler

In fact, I am talking about another issue. If I have qmldir in the top level directory and its module name is different then the package name. It will complain:

$ qpm check
QPM: 2015/10/06 20:43:44 ERROR: the qmldir module (QuickPromise) does not equal (com.github.benlau.quickpromise)
OK!

And ofcoz I don't wish user to import in that way:

import com.github.benlau.quickpromise 1.0;

https://trello.com/c/bBWo4zqG

That will be much better. I have voted. thx.