-
Notifications
You must be signed in to change notification settings - Fork 20
Support different "environments" / non-mandatory dependencies #80
Comments
I thought about this some more and have a question: How do you propose setting the environment Lake uses? Are you envisioning having to pass a flag e.g., |
I'm recently quite enamored with how hatch does this, which is our cool new Python ecosystem tool. It supports both dropping into an activated shell or separately also explicitly passing the name of the environment as an argument or envvar. |
@Julian I am a little confused as to how that would apply here. I imagine the goal here is not to run a shell (as this issue, at least as far as I understand, is about dependency sets), so what are you envisioning as the Lake equivalent? |
I sort of mixed the two (dependency sets and environment-specific commands) in the issue description and title, because they're quite related. Concretely, if I just make up some lakefile syntax for a minute, given:
I now have 2 environments, a default one and a testing one with one additional dependency and a script that works only within it. Running Or for the script, similarly, Of course running Where a shell comes in is if you want to allow someone to be able to run 10 commands in a row within an environment The last part with a shell is for me personally not top priority relative to the other, I never use it in Python, but it's undoubtedly extremely popular, so I mentioned it given your question about
Does that help? |
@Julian okay, that helps. Note that you can already pass options to a Lake configuration via require mathlib from git
"https://github.com/leanprover-community/mathlib4.git"@"master"
meta if get_config? env = "testing" then
require lspec from git "https://github.com/yatima-inc/lspec"@"master"
meta if get_config? env = "testing" then
script greet (args) do
-- ... Then running |
Ah nice. That indeed would seem like it'd get reasonably far. I don't know much about lake's internals but if you had conflicting dependency versions -- e.g. if an environment "foo" depends transitively on If the above works too then yeah I think that likely does get quite far and maybe just could be documented as the way to do this with no real extra support. |
They would not fight but they would also not select the right one each time. They would end up on which ever one was installed first. However, Lean itself, at the moment, doesn't really support competing versions of used modules in the first place (i.e., you would need to rebuild all dependent code every time you swapped back and forth). So, unless the code in environment |
Aha, got it. Good to know, thanks for explaining. Certainly I'm happy if you close this then and we see how things go with the |
The Lake repository is being deprecated and its issues transferred to leanprover/lean4. As |
(I'm assuming this has at least been thought about, but filing it since I don't see another place tracking it).
I'd like to add a dev dependency which isn't/shouldn't be required by users of my thing. It would be nice to have syntax in a lakefile to create separate environments with their own dependencies (and perhaps subcommands or scripts only relevant to them), so a "testing" environment, where I'd declare a dependency on LSpec and some testing related commands, a "dev" environment where I'd install some future nice development tools, and then a "normal" environment which end-users use.
The text was updated successfully, but these errors were encountered: