Skip to content
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

Support different targets #64

Open
Eggiverse opened this issue Sep 7, 2020 · 7 comments
Open

Support different targets #64

Eggiverse opened this issue Sep 7, 2020 · 7 comments
Labels
build system issues about Comonicon build system enhancement New feature or request

Comments

@Eggiverse
Copy link
Contributor

Add a switch so that Comonicon can generate targeting CLI or GUI.

@Roger-luo Roger-luo added build system issues about Comonicon build system enhancement New feature or request labels Sep 7, 2020
@Roger-luo
Copy link
Collaborator

I think as for Comonicon projects, this is quite simple, we can just have an extra field in Comonicon.toml to control this (which also means a newly available kwargs in install and build), e.g

name = "ion"
target = ["julia/basic", "completion/zsh", "julia/poptart"]

however, if we generate an entry for GUI, we might want to have different installation options/paths for target julia/poptart, e.g on Mac OS, this should in the Applications folder, which makes it more viable to the system instead of .julia/bin. We might want to have some more detailed configurations. I haven't come up with a good design on this yet, let me think about it a bit more.

@Eggiverse
Copy link
Contributor Author

I am not sure how target can be used in install and build.

If it is in Python, I would import a package that provides the corresponding codegen for target when reading configs.

In Julia, it is not allowed to import a package in a function. It seems to me that this means either packages that provide targets become dependences of Comonicon or users manually import the packages.

We certainly do not want the latter one. Is there a better solution other than making all extended packages as dependence?

@Roger-luo
Copy link
Collaborator

target is a parameter for codegen, and codegen itself doesn't necessarily need to depend on the runtime it targets (tho for convenience it sometimes depends on that).

If it is in Python, I would import a package that provides the corresponding codegen for target when reading configs.

Note, this can be a harmful way of writing a package that aims for stable behaviour, there's going to have no way to do version control on the dependency. It can be a bad design in Python and cause a lot version conflicts, unless the developer handles all the version control inside the code at runtime, which is too evil.

We certainly do not want the latter one. Is there a better solution other than making all extended packages as dependence?

IIUC, currently ComoniconGUI does not overloads the interfaces of Comonicon, e.g
https://github.com/Eggiverse/ComoniconGUI.jl/blob/master/src/codegen/poptart.jl#L44

as a result, it conflicts with the interface of Comonicon, the right way is to make overlapping part (which is all the parse code) and overload the function Comonicon.codegen rather than define your own ComoniconGUI.codegen. Then simply depends on Comonicon will provide a stable way to insert codegen passes with version control.

This is also the point of multiple dispatch and generic function: a safer way to write runtime overloaded interfaces.

@Roger-luo
Copy link
Collaborator

The first thing I'd do is to try to move whatever is missing in the parse part to Comonicon, given this should be the same for both GUI and CLI as a frontend. Unless you want to support a different semantic in the API, which is going to be much more work than the current implementation in ComoniconGUI.

@Eggiverse
Copy link
Contributor Author

Currently, configuration (Comonicon.toml) is not loaded if it is not used for a Package.

This needs to be changed if target is in the configuration.

Is it going to call install whether it is in a Package or a new function other than install is going to be used?

@Roger-luo
Copy link
Collaborator

Roger-luo commented Sep 18, 2020

I just realize we probably want to wait for 1.6's new stdlib Preferences.jl (JuliaLang/julia#37595) so that the user can choose whether to use GUI or CLI or both as an external switch for the codegen/build function instead of doing a workaround ourselves. This configuration is likely configured only be the user and as developers, we actually won't be able to know what to install unless things are built into standalone applications.

@Eggiverse
Copy link
Contributor Author

I am studying how Pluto works and try making a web-based GUI target.

During this, I will try exploring how different GUI targets coexist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system issues about Comonicon build system enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants