-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add directory
to support installing in a different directory than 'package-name'
#236
base: main
Are you sure you want to change the base?
Conversation
e3edd6e
to
198ab02
Compare
Hi @poliorcetics, this looks like it will mess up the import system a lot to me; have you considered the implications of this change? My main question here is what is the benefit of decoupling the protobuf import path with the buffrs package name? And if there is a benefit, isn't the scenario solvable by refactoring the underlying protos/adapting the build system? |
This is preparatory work to introduce `PackageDirectory`
198ab02
to
ff3de6d
Compare
Hi @mara-schulke. I have been looking into As pointed out many times by others, this forces one to:
From your comments, it seems that this is actually a feature in your setup. Maybe I misunderstand how you are using |
Hi @dgehriger, yes I agree with the beauty of hierarchical package definitions! The problem with the proposed solution (as much as id like to implement it) is that it silently introduces ambiguity in which packages control which namespace in the generated code. Ie. imagine that we have two packages So what I'm trying to point out is: If you introduce hierarchy into package names and allow the owned namespaces of buffrs packages to overlap, you can cause very nasty incompatibilities between packages that won't compile anymore: Imagine both of the example packages declaring the same The easy solution we went here (instead of doing rather complex analysis of package contents to verify they don't declare any subpackages or overlapping types) is to bind the buffrs package name to its very own protobuf package scope. This is pretty much inspired from rust fwiw. I'm pretty sure that there is a design that does both? But we haven't had the time to implement this properly so far and there would be a unclear ROI of this feature as it is mostly cosmetics (for Helsing) - for companies trying to port over existing hierarchical apis this does look different. I'm happy for any PRs on this! |
Edit: If you are only talking about the directory that buffrs installs its files into yes that is infact right. The reason we have not implemented this change is that there have been plans on enforcing the alignment of the protobuf package names with the buffrs one. Currently this is only a lint (see buffrs lint) and not something that prevents you from publishing but I would very much advise against starting with this for the aforementioned reasons. So it's best to align protobuf package name and buffrs package name for disambiguating types and preventing compilation errors - further allowing the buffrs package name to diverge from the protobuf package name in the current way things are implement would only worsen the problem. So recapping the above:
|
@mara-schulke Thank you very much for your detailed answer. I went ahead and implemented a possible solution (opt-in) in PR #251. Let me know what you think! |
@mara-schulke : I totally get your point about the ambiguity arising from using nested packages. My ultimate goal is to be able to us |
Closes #230
TODOs
directory
key is something completely different to the package nameregistry
: how to add them ? I need to add a column to thepackages
table.