-
Notifications
You must be signed in to change notification settings - Fork 476
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
Module improvement tracking issue #2252
Comments
I am definitely interested in seeing modules fleshed out a bit more. I'm coming from being a fairly heavy make user where our team could organize make 'stubs' and include them on a per-repo basis. Something like this was nice and handy in Make-land, and is definitely nearly there with Just
The recipe naming with the This has made it difficult to fully embrace modules, so we resort to using imports in Just and doing a more 'restrictive' faux-namespacing in the recipe names. I would therefore +1 all the following, as I think they all contribute
As an aside, I think I'd be perfect happy as well if recipe names could include some special characters that allow the 'faux' namespacing I mention, |
Adding this one to the list: #2271 |
We have nested just mods that goes:
Which allows us to call However from How exactly could I call a local task, without using the hierarchy? To highlight the issue in a different way: I have a parent git repo, which has git submodules. Each submodule I wish to have a Eg When running
But when I include it in a monorepo, and try to expose its tasks to a parent Justfile
|
I have put some thought into this. Should calls to just defined in a nested module not default to recipes in the current file, and then navigate up until it finds a recipe that matches? Why does a submodule need to be aware of its location in the module hierarchy? And similarly you can should be able to call a dependancy to a module, relative to the currently module hierarchy. ie Given
In deploy env="dev": (stack/deploy env)
# or
deploy env="dev":
just stack deploy {{env}}
# not
deploy env="dev":
just iac docker stack deploy {{env}} Not, as "docker/mod.just" would now have to know that it resides in iac, and can be installed anywhere else but in that exact hierarchy. |
I am particularly interested in "Allow submodules to load .env files". This is especially useful in Monorepo Setups. For example: Imagine a directory structure like this:
I use modules, to namespace the two projects and use the same recipe names (same ux) defined in The corresponding justfiles would look something like this:
If I execute I know there is the path syntax The cherry on top would be to be able to call modules directly as dependencies, maybe like this: tests: project1::test project2::test But this is not really necessary, as recursive calling tests:
@just project1 test
@just project2 test |
+1 to recipe dependencies between modules. I have a server plus database cloud deployment use case. I'm new to the stack, so I'm basically slapping commands together and I'd like Here's a subproblem from the project to illustrate my point. I'm keeping the Django and Google Cloud Platform details in case someone wants to debate whether the use case is legit. I have three recipes factored into two modules. I find these smaller files easier to maintain and I can use the module names as namespaces, so that I have a e.g.
because:
To break the circular dependency between the modules, I've put the # ==============================================================================
# In server/justfile
mod common
mod db
deploy:
just db::schema-update
gcloud run services update # ...
publish:
just common::server-publish
# ==============================================================================
# In server/db.just
mod common
schema-update:
just common::server-publish
# Invokes `python manage.py migrate`
gcloud run jobs execute migrate # ...
# ==============================================================================
# In server/common.just
server-publish:
python manage.py makemigrations
gcloud builds submit # ... The downside is that the foo: bar
bar: foo it can't detect: foo:
just bar
bar:
just foo Similarly, when there are multiple modules, the raw Here's a thought though: in the case of my simple dependency graph, should I have to factor the modules into a DAG? What if I could simply write: # ==============================================================================
# In server/justfile
mod db
deploy: db::schema-update
gcloud run services update # ...
publish:
python manage.py makemigrations
gcloud builds submit # ...
# ==============================================================================
# In server/db.just
mod server "justfile"
schema-update: server::publish
gcloud run jobs execute migrate # ... At the moment, modules only allow referencing of recipes, and not settings, variables etc. As long as there's no cycle between recipes, circular dependencies between modules could be allowed as a convenience. After all, it's a command runner, not a build system or a programming language. I appreciate that allowing circular dependencies between modules would prevent the implementation of a few of the features put forward by @casey, such as sharing variables (because their evaluation could trigger a cycle) or inheriting settings. But perhaps that's the scope of |
I'm also interested in "Allow submodules to load .env files". |
I haven't seen the ability to --list module recipes, so that would be great to add!
|
It does exist: for your example |
Ah thanks - that's good to know! I still think supporting running --list on modules with |
@vimota I definitely agree that would be nice. You could always make the default recipe in a module call # in foo.mod
default:
just --list foo And then you can do |
@casey Agreed, I can see how that'd be tricky. And that's a great idea - thanks!! |
This issue tracks improvements and missing features of submodules
.env
filesjust --show
work with modulesThis thread should probably be used for general discussion. If you're interested in one of the above features, mention it in this thread and I'll create a dedicated issue for it.
The text was updated successfully, but these errors were encountered: