-
Notifications
You must be signed in to change notification settings - Fork 14
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
Recursive deps #12
Recursive deps #12
Conversation
Refactor defcmd Move dependency code to deps namespace
b4e2e7a
to
af430eb
Compare
favor sh over println
af430eb
to
a83e802
Compare
c8df707
to
338aad0
Compare
Wow, thanks a lot for working on this! Are there specific parts you want feedback on? Yes, Do you have an example project using this? (I'm not sure yet how to test the code in |
I'll open a PR for I'd like some feedback on Also the use of I tested quickly by having What do you think about making these fn's multimethods? We could have options to fetch dependencies from bitbucket, cloning repos instead of fetching archives etc... Something like: :dependencies [[kgann/foo "branch-name" :source :bitbucket :type :clone] ;; clones a bitbucket branch
[kgann/bar "1.0.0"]] ;; defaults to github tar If this sounds good, I'd like to get some input on the types of options we'd like to implement and how best to specify them. |
I think The use of They should probably become multimethods, yes. I have thought about different providers before, just haven't needed them so far. I've just created a separate issue for them: #13. In the future we should also use |
@heyLu How should we test this? Do you want to create some example projects under pixie-lang? It may be easier to test with local projects once that is implemented. |
Yes, local projects seem to be the way to go. So, I'd say we test it manually for now. To be honest, I haven't thought too much about testing yet. It will likely be a combination of a Makefile/scripts and pixie tests, but I need a bit of time to think about it. Ideas & suggestions welcome! |
3e97e9c
to
3c4d138
Compare
@heyLu I made a few updates:
Let me know if you spot any issues! |
(rest) | ||
(p/project->map) | ||
(eval) | ||
(assoc :path dir))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is :path
used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, right here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sorry, i missed that. :)
|
I'm not sure about other langs that do it implicitly - I'll try to explain why I think it's necessary (I may be wrong)
Yes, you're correct.
If a project depends on
The We could use bash to print all lines except the last but then you'd still see the terminal hanging and then finally spit out all the "Download..." messages before loading the repl. To clarify this one, the goal was to show the dependency fetching as it happens while you're waiting for your repl. |
Couldn't we just do this with an explicit command, like So the workflow would be download dependencies once, do whatever (including editing stuff, running code, starting a repl) and only fetching again when adding new dependencies or wanting to update them.
|
Here is the It was removed once One positive of The only issue I see is that commands like The implicit fetching was to curb issues where someone forgot or thought they had already fetched dependencies - sometimes I start implementing too much - sorry about that. There is a guard to prevent needless fetching. I'll revert back to manually requiring a |
Ah ok, I understand why you added Yes, please revert back the implicit fetching for now. It's certainly something to discuss, but we should do it in a separate pull-request/issue. Sorry about the back-and-forth, but thanks a lot for working on this! |
No worries - I wanna make this a great tool so feedback and criticism welcome! To be clear, revert to explicit dependency fetching and keep |
Yes, keep |
I remember another reason why I went with implicit deps. Since we need the project maps from each dependency (to inspect their Removing the implicit deps will take a little refactoring to make the other commands that used to inspect the projects dependencies ( Perhaps this is a sign that mutating p/project when resolving dependencies is not the way to go. I'll give this a shot this weekend. Let me know if you have some better ideas or if the above doesn't make sense. TL;DR a lot of commands rely on dependencies and their read project maps - right now only |
Made the requested changes. The only issue I see is that I made a test repo kgann/dust-test that depends on and a local (defproject local-repo "0.1.0"
:description "Local repo"
:dependencies [[kgann/dust-test "0.1.0"]]) $ ls -a
project.pxi $ dust deps
kgann/dust-test 0.1.0 $ dust describe
local-repo@0.1.0
Description: Local repo
Dependencies:
- kgann/dust-test@0.1.0 $ dust load-path
Please run `dust get-deps` $ dust get-deps
Downloading kgann/dust-test
Downloading heyLu/hiccup.pxi
$ ls -a
.load-path deps project.pxi
$ dust get-deps
# no output $ cat .load-path
--load-path deps/heyLu/hiccup.pxi/src --load-path deps/kgann/dust-test/src --load-path deps/kgann/dust-test/lib --load-path src $ dust load-path
deps/heyLu/hiccup.pxi/src
deps/kgann/dust-test/src
deps/kgann/dust-test/lib
src $ dust repl
Pixie 0.1 - Interactive REPL
(darwin_x86_64, clang)
:exit-repl or Ctrl-D to quit
----------------------------
user => @load-paths
["/Users/kgann/src/pixie" "." "deps/heyLu/hiccup.pxi/src" "deps/kgann/dust-test/src" "deps/kgann/dust-test/lib" "src"] |
ed408b0
to
4565667
Compare
I do have one final thing: I think The reason is that we will always need a command that updates all the dependencies, including updating already fetched dependencies to a more recent version. As we currently don't do anything "fancy" with dependencies, |
Ok, that makes sense. See 373c0f8 |
Thanks! I think this is ready to merge now. Do you want to fix/change something else before merging? |
minor nitpick: wouldn't it be nicer not to rely on a global ref (deps) and pass it as argument everywhere it's needed instead? |
It's trivial to remove |
I went ahead and updated the README and removed I've got no more plans for this branch. Let me know if you'd like me to squash some of these commits. |
Ah no, I think I like having the history availlable. So I'll merge this now. Again, thanks a lot for working on this (and sticking with it). ✨ |
This is a WIP implementation of recursive dependencies
I'm using
tree-seq
to walk the dependencies so if this ends up getting merged, we may want to consider adding it topixie.stdlib
.To implement this I had to refactor some of
src/project.pxi
so I could reuse some code in thedust.deps
namespace - unfortunately it makes the PR a little noisy.I'm looking for feedback to the approach before continuing. So far it appears to work fine.
I also extracted the
(load-file "project.pxi")
calls todefcmd
- If the cmd var contains a truthy:no-project
metadata, the loading is skipped - probably should have been a separate PR. I was just thinking of people writing their owndefcmd
's. I can remove this if need be.Thanks for taking a look!