PRQL project structure
Followup for https://github.com/PRQL/prql/pull/3000#discussion_r1272280056
I propose that we restructure the repo, so it reflects the whole project not just the prql-compiler.
This more of a issue about the structure of the PRQL project, and not the files and directories.
I see the project structured like this:
PRQL/
website & documentation/
prql-compiler/
pq/
prql-vscode/
Our main repo does correspond to the prql-compiler, but the language as a whole, so having crates/ in the root tells me that these crates are essential to the language. Which is not true - they are just a reference implementation of the compiler, which could be implemented some other way.
If we wanted to follow advice in https://matklad.github.io/2021/08/22/large-rust-workspaces.html, we'd have something like this:
prql/
web/
prql-compiler/
crates/
ast/
parser/
frontend/
backend-sql/
To repeat what I said in the other thread:
A
cratesdirectory containing directories named after the crates is a well-established convention that helps new contributors quickly find the source code of crates. Putting the AST and the parser under compiler doesn't make any sense to me since they can very well be used on their own.
But I appreciate that you now explained your motivation for suggesting this change:
Our main repo does correspond to the prql-compiler, but the language as a whole, so having crates/ in the root tells me that these crates are essential to the language. Which is not true - they are just a reference implementation of the compiler, which could be implemented some other way.
I think you're missing a "not" in there. Anyway I think your concern that people migth conflate the language with the reference implementation is a reasonable concern ... however I think the proper way to address this would be to move the specification of the language to a separate repository ... perhaps prql-spec. This would also enable us to strictly separate language design issues from implementation-specific issues. And with GitHub issue templates we could link the "new issue" page for issues about the language to the other issue tracker ... just an idea.
I agree with the structure — but how would that work in practice? We'd have prql-compiler with exactly one path, crates?
Where would the external compile function live?
Not to pull in the whole of https://slatestarcodex.com/2014/11/21/the-categories-were-made-for-man-not-man-for-the-categories/ — but no representation is perfect, we're just trying to group approximate clusters of things that require more shared context...
I think you're missing a "not" in there.
I do, sorry:
Our main repo does not correspond to the prql-compiler, ...
I see, we are already conflating the two with GitHub issues. Splitting them would probably be hard, because a lot of the times it's not obvious if the problem is with the language or the implementation.
We'd have prql-compiler with exactly one path,
crates?
Let me try to flash it out, I'll push a branch up.
Splitting them would probably be hard, because a lot of the times it's not obvious if the problem is with the language or the implementation.
I'd say that's just because the language isn't properly specified currently. If there is a clear spec it's easy to say if an issue is about a change to the spec or a change to the implementation. Though I'd probably reduce the spec to syntax and semantics and leave the details of the output SQL to the implementation.
I really don't see the point in moving the crates/ directory out of the root directory ... it just makes them harder to access. When it comes to having the crate directory names be different from the crate names, I'm strongly opposed.
Here it is: https://github.com/PRQL/prql/tree/compiler-dir?search=1
PS: do we really need that many dotfiles?
Ad dotfiles: Yeah I think we should move as many of them as we can without effecting the developer experience into .config/.
Ad dotfiles: Yeah I think we should move as many of them as we can without effecting the developer experience into
.config/.
I think we already have! Open to more assuming it didn't add complexity to the calling command
There is quite a lot:
.cargo
.config
.devcontainer
.github
.vscode
.dockerignore
.gitattributes
.gitignore
.markdownlint-cli2.yaml
.mega-linter.yaml
.pre-commit-config.yaml
.prettierignore
.prettierrc.yaml
.sqlfluff
There is quite a lot:
Agree! Find one to cut...
I don't completely get the point of the extra level with prql-compiler, vs just crates?
crates is also more widely used.
(That said, this is easy-ish to change, and I don't have a strong view)
That's the separation between the lang and the compiler I'm talking about.
crates is wildly used for repos where crates are the main product of the project.
The book, the playground and the website are still largely about the implementation and not "just the language" ... so do you want to move them into prql-compiler as well?
If you were serious about separation we'd just have prql-compiler/ and spec/ but that of course doesn't make much sense ... at that point we could just have a separate repository for the spec as I suggested earlier.
(hit the wrong button)
No, book almost completely about the language (apart from the project part). Playground is also a separate project dealing with UI. They are not the thing that takes PRQL source and makes SQL source.
And we don't have much of the spec? There is some in the book, but for a lot of things, the compiler is the reference of behavior.
The book mostly describes the language by input & output examples from the compiler. The playground is a UI for the compiler.
Our main repo does not correspond to the prql-compiler, but the language as a whole
I'd say it's just the name of the repository that refers solely to the language. The repository might just as well be named prql-compiler ... the only directories here that aren't strictly related to the compiler are grammars/prql-lezer/ and the website which serves as the frontpage for the language as a whole. I'd be in favor of moving both out to separate repositories.
Yeah, this seems like a classic tradeoff of whether a cluster use big enough to justify a new hierarchy...
I'm not sure the best way to resolve given it's not really an empirical problem. (I also think it's easy to bikeshed)
I see we have lots of threads about refactoring:
- https://github.com/PRQL/prql/pull/3131
- https://github.com/PRQL/prql/pull/3126
- https://github.com/PRQL/prql/issues/3108
- https://github.com/PRQL/prql/pull/3033
One thing I would say — and where I can potentially be helpful as someone who doesn't have strong views on much beyond making the project successful and building a great space for contributions:
It's very easy to bikeshed on abstract notions such as "is a whale is a behemah or a dag??". Because they require so much tacit context, discussion can be less productive than on more analytical questions. They're also things which often become easier to see with time and context and — at least in software engineering — are easy to change in the future.
So I would essentially:
- exclude refactorings-without-consensus from the principle we have of "merge first, review later"
- suggest that @aljazerzen make any small adjustments in the wake of #3000 that he sees fit, given he has so much context about the library
- if we can get consensus about refactorings, then by all means go for it
- if we can't, we live with the imperfections for a bit while we solve the more concrete problems. If we can't solve a concrete problem because the abstractions are really that bad, then we can prioritize it.
What do folks think? @aljazerzen @not-my-profile ?
Note that even jq, which is widely used, has only a single repository that includes the reference implementation and documentation. Of course, detailed documentation of the language specification would be great, but is not a priority at this time, I think.
jq self-describes as a command-line tool, while PRQL self-describes as a language ... there tend to be higher expectations for languages.
ad @max-sixty: I don't consider discussions about what belongs in which crate to be bikeshedding ... it's rather fundamental, since getting this wrong pretty much prevents refactors of the parts in question without breaking the public API. Personally I am not interested in doing refactors if they require breaking a public API in a way that could have very easily been prevented.
(for context on our long-term commitments — while we should indeed try and maintain library API compatibility — we have very few folks linking against the library itself — we're a bit freer than many projects there)
And so we can focus the current discussion — without closing anything off in the longer term — I'm quite against moving docs out to another repo for the short-term. It's useful to have the docs tested against the library on every commit, and they provide a good source of tests for the library. And it would be a big change. So that will have to wait for a while, at least unless lots of others feel very strongly in the other direction.
I was about to create new issue but this seems to fit to my request.
@max-sixty Could we have PRQL specification in a separate project than compiler or other tools?
I just looked at https://github.com/PRQL/prql/releases looking for changes in PRQL specification. There is so much noise there related to compiler, or possibly other tools, that it is not easy to track releases of PRQL (not prql tools).