-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
jqnpm - a package manager built for jq as an example implementation #659
Comments
@joelpurra Yes!!! I'll take a closer look this evening. An external pkg manager will make a jq 1.5 release a beautiful thing. Thank you! |
Skimming the README I see you've put a lot of effort into this. I greatly appreciate it. Feel free to file a new issue for jq 1.6 or whatever milestone later than 1.5 for pkg-related features you want natively in jq in the future. |
(Small and urgent extensions might still get into 1.5 though. Now is the time to request them though.) |
Oops. Had a bug which ended execution if debugging wasn't enabled through the undocumented |
@nicowilliams: glad to see some enthusiasm! Keeping the discussion in this issue thread for now, as my proposals will be related to jqnpm. This is what I came up with at the moment - I feel most of it is about removing unnecessary fluff from the core and letting the package manager deal with it. Regarding
|
On Mon, Dec 29, 2014 at 02:40:27PM -0800, Joel Purra wrote:
Well hey, it's a nice gift from you. Incidentally, happy holidays!
Is this because mapping With the Does the .jq extension need to be included in the string? That would seem weird. How do I tell if the path is absolute? Or should I require that it be relative (because i always append it to a path that ends in '/')? I prefer the latter so I don't have to have any OS-dependent code to check if the path is relative. I wouldn't want to try the path as-is last because that would make the current directory always part of the search path, and that's not something I'm fond of.
I'm not sure I follow. Can you show me an example?
It might be useful for single-file modules though -- sure, it's a pain for some kinds of metadata (e.g., commit hashes), so you might not use it; it costs nothing to keep anyways. For the same reason I'd like to keep
I may do that, yeah. @pkoppstein seemed to like being able to import into the caller's namespace. @wtlangford didn't like defaulting to that. You don't like it in any case. Is there a compromise to be made? I'm leaning to just requiring the
It may be, but for simple single-file modules (which jqnpm might well not support ever) it could be useful (no commit hashes and so on, but maybe a homepage, mailto, ...). Is it harmful? Actually, I have a use for something like a Perhaps it should be something like:
and even:
It can do that regardless :) Especially once I add support for reading it automatically. See above.
Yeah, I need to make that work. That's probably urgent.
Can I assume you mean "prepend the user's If the problem is OS-dependence then I can always add a token for "default system path here".
Prepend or append?
It's quite useful for testing; I could drop it from the docs but keep it. It could also be useful for keeping multiple universes of jq modules lying around. (Think NixOS-style packaging.) I'd rather keep it altogether. |
@joelpurra - Your package manager seems to be quite complex to use. Who is responsible for writing jq.json? In the julia-inspired view of things, the end-user would not have to do anything beyond:
Zero configuration. All dependencies taken care of automagically. (For per-project installation, the end-user would use |
I don't know when I'll have enough time to implement the desired changes to |
I'm surprised to see a developer of a json tool see a json file this small as a complex problem. Of course the package developer is responsible for it - especially if the package will be published. That said, the For now the
Yes, that is also possible with Every time I read about an npm package, the author says the equivalent of
That is not zero configuration.
That is also configuration, except you seem to have to do it every time you execute code. |
On the README.md page, it would perhaps help to have separate sections for package developers and package end-users.
Could you please explain? If you are saying that declarative statements such as "add NAME" and "import NAME" (with no reference to location or the like) are "configuration parameters", then you are using a very wide net. There is an important and useful distinction to be made between such "what-is-needed" declarations and "how-to-do-it" configuration parameters. One of the features of Julia-like package managers is that for registered packages (irrespective of where they are located) the end-user need not know where they are located. Since that does not seem to be a feature of jqnpm, it would be helpful if the end-user documentation could also explain the process of package discovery. Thanks. |
I think I'm done with the labels work now (not pushed yet), which would leave just this and #454 as the outstanding issues for a 1.5 release, plus the work of producing the release. I'll know later this week when I can realistically finish this. |
Ah, yes, you are right. I'll look into it.
I see
Are you referring to setting the Could add a simple explanation of the default install location as well as |
@nicowilliams wrote:
No, the package manager has no reason to parse
Excellent!
Not for package names
Not a fan of absolut paths in
56ae88d#diff-d2fa3f3320a35df5eca0fe665267bd2fR2343
I would not like to be the maintainer of that syntax, when there are external package managers doing (aiming to do) it better.
Great!
Oh, and I would also remove
Harmful as in splitting efforts to modularize the jq ecological system perhaps, as there would be two competing systems - and harmful to time and effort spent developing duplicate/parallel systems. I strongly prefer packages that consist of a single "module" for extreme/atomical reusability - though
Very much unnecessary. The If Referencing a namespaced package
Not super urgent for me, but it would be very nice to have later on. I already have at least a couple cases where I already use external json files strictly for lookups, and they are loaded as
Correct.
That could work; would add some prepend/append flexibility.
Haven't decided which is more useful, if there's only once choice.
I don't really see the usability of |
On Tue, Dec 30, 2014 at 01:26:53AM -0800, Joel Purra wrote:
Refusing to use
Now, you could use jq to get that metadata, use it to learn how to find the dependency Also, ISTM that the pkg mgr's JSON database ought to be more like a cache: if damaged, you should be able to re-create it. Here, once more, the import metadata of installed .jq files seems authoritative.
There wouldn't be package names, just the
There's an Internet-Draft for the file: URI scheme. It's... not that simple...
There'd be no need to maintain it if unused. Still no harm. (But see above.)
It was. More later. GTG. |
jq programs must Also, I still think that putting metadata in the |
This is the only issue left for 1.5 now. I'll try to get around to it before the weekend (otherwise it will have to be three weeks from now). I don't think I'll remove all the things you don't want to use @joelpurra, but you can always not use them; the other changes I will make. |
Implementing (Briefly, the linker tries to avoid compiling the same file twice. What the linker does then is bind (pointer-wise) dependents to the "blocks" generated by the parser for their dependencies, changing the dependecie's symbol names on the fly to deal with the |
Anyways, this has:
Other things:
Bang on this guys, please. Don't be upset if I missed something: this took a lot of doing. I'm done for the night. |
BTW, @joelpurra, you got most of what you asked for. I didn't remove Thanks for your comments and ideas! |
Also, the metadata on |
On Tue, Dec 30, 2014 at 01:26:53AM -0800, Joel Purra wrote:
Ah, the right thing happens. No need to even include metadata on
Right. Check the latest.
Dependencies couldn't force
I'll make it so.
I just merged the two things.
I haven't either. I think overriding the builtin setting is the thing that the user wants. It may not be what everyone wants, but it should be the 80/20, and acceptable enough.
Sure it's useful! Suppose i have a jq program I'm working on and I want to try it with different installed universes of modules: with Now, |
Oh, actually, And now, I'm done for the night. Again, the |
|
I had some bugs in the linker left. I pushed a new HEAD (sorry for the rebasing) to For example, renaming
Now fix pack4 and it works:
Do you really want that "src" directory in the way? Seems gratuitous. Granted, if I'm running from a source tree that I'm building, and I'm "building" the .jq files, then I might want a directory in the way, but probably "build", not "src" (jq aside I prefer not building in place, but I digress). |
Similarly renaming pack3's and pack4's .jq files finally makes running the deep example work:
|
Ditto flat. |
@joelpurra Sent a PR :) |
Eh, I didn't close this issue, I just pushed my changes to master so I can make a 1.5rc1 tag. EDIT: Yes, I know that github closed this automatically because the commit said "fix #659". |
@nicowilliams: $ git clean -fdX :/ && autoreconf -i && ./configure && make clean && make -j8 && make check && ./jq --version
By the way: I see the clean up routines in I'll start looking at the rest now. |
@nicowilliams: Oh, I see now that |
@nicowilliams wrote:
There have been ways for Sorry, but I don't agree with repeating the last part of a package name to resolve the main
Yes -- I like separating code from the root directory -- it is a sane default for public open source packages. Separation of concerns, considering how many Keep in mind that my suggested @nicowilliams: I'm very thankful for your help. Sorry that I'm not up to speed with C and the jq internals enough to make the changes myself. |
@nicowilliams: added an override for you to test If you want to see commands as executed by New tests -- primarily to test
|
@nicowilliams wrote:
Haha, glad my copy-paste bash hacks are useful outside of their current, narrow scope. More hacks in my shell-based music queue manager |
On Thu, Jan 01, 2015 at 01:21:41AM -0800, Joel Purra wrote:
Yeah, I never use git clean in active workspaces. It's very risky. Instead I keep a separate workspace for release work, but I get lazy and don't make check in that workspace before every push. I do use it around releases, and then I realize that I forgot to git add some file and so on; it's a bit embarrassing. What I should do is rig my dev workspace to always fetch and make check in the clean workspace when either making with no extant changes or when pushing. |
Let's come up with a compromise for the "/src/" thing that works for us both and, barring any new bugs, we'll be ready for a 1.5 release. Do keep banging on jq. If you find any bugs, let me know! |
Note: the |
Glad to let you know that Edit: |
Do check out the command Happy package generating =) |
I've created proof-of-concept patch showing how to find the package root for a given path, and how to use package root-relative
Together with @nicowilliams' patch 6e7cf81 for Next steps:
Yay, very happy things are moving forward =) |
@joelpurra wrote:
Hmmm. I typed
But I already have recent homebrew versions of bash, bison and git! (Specifically: bash 4.3.26 ; bison 3.0.2; and git 2.0.0.)
My target audience will be frightened off by talk about "detached HEADs". |
I'm all brew and see it as the primary alternative on Mac. This is not a jqnpm issue; you can try
It doesn't break
Switched to using git and tags instead of 1 Seems brew takes care of the bison keg path during brew info bison
# Look for the path: /usr/local/Cellar/bison/3.0.3
export "/usr/local/Cellar/bison/3.0.3/bin:$PATH"
# jq build steps here |
@pkoppstein: oh, and thanks for trying it out =) |
I don't mean to be AWOL on this. I just am :( I hope to find time for jq. But there's a lot on my plate at this time. |
@nicowilliams: no worries, I believe you gave a heads-up in December =) |
@nicowilliams, @pkoppstein, @wtlangford, others:
Hacked together a package manager for you to play with:
https://github.com/joelpurra/jqnpm
It works within the current
import
limitations such as:jq
not being aware of there being an official package manager, asnpm
is treated as fornode
.import
.See also previous discussions in #491, #566, #535 regarding my preferred package manager style. Let me know if you have any questions, fixes, workarounds!
The text was updated successfully, but these errors were encountered: