-
Notifications
You must be signed in to change notification settings - Fork 13
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
Centralise Cylc CLI Functionality #69
Comments
With entry points, another repository would be reasonable. Git submodules (for "shared components"?) are interesting but I haven't worked with them enough (or at all) to have a good feel for whether or not we should use them for this or anything else. (Maybe others have?). |
Interesting, I think I haven't seen this done in another Python project. Maybe @sgaist will have an opinion on this too, or maybe he's seen entry points used this way? Note that when we started to move to setuptools/setup.py, namespaces, So given the number of modules, and the combinations that people can have for their environments (pip, conda, maybe some will want RPM or DEB packages, or even pyinstaller/spack/pipx/poetry/etc), I would only check if this change wouldn't become an issue later. Another thing that needs to be checked is circular dependency. I think it won't happen as your suggestion would move only Other than that, +1 |
I think the new #!psudocode
print('cylc', __version__)
for package in entry_points:
version = package.__version__
if is_git_repo(package.__file__):
version += '-' + '$(git describe --abbrev=4 --always)'
print(package.__name__, version) |
No me neither. I think most of the time you have one "core" package and lots of "plugins". With Cylc it's a bit different as we are installing different bits of a system on different machines so we can't rely on the "core" Cylc Flow package always being installed. Note: we may well chop Cylc Flow down further to avoid having to install the entire package on remote hosts when all job hosts really need is |
Ah, that sounds even more interesting. Maybe if you have time later to try a proof of concept of how it would work, then we can have a look and discuss more. I'd be happy to have some fun trying it out, and testing locally too 👍 |
(Another thing to note, add a post-requirement task to update our Conda recipes, and add this one to the Conda Forge too) |
We have some static resources which could do with being common as well e.g. the Cylc logo. |
@kinow Do you mean you are looking for a project that extends a "core" Click command group with further commands ? |
Hi @sgaist , more a case where the core command is in a separate repository. The cases I know have the core command as part of the main utility/repository (e.g. But it could be that I am simply being too dense for being more used/familiar to But if having |
OK some quick context:
Basically Besides I think we need to centralise the CLI anyway:
Listing registered packages via entry points should be easy. |
I am aware that most our users now are scientists. Many of the changes we have made in the past months make things more complicated for scientists (multiple repositories, no more batteries included, need to use conda or pip to install, etc). But I think we did these changes for a good reason. And the old So there is a counter argument for each of your arguments. I also don't think having a command in front of jupyterhub, or that If you say that will be best for users, I will have no objection and won't try to block any of these changes 👍 |
Scientists won't see these changes, they will just use the installation they are given. But even crossing off those arguments we are still left with:
|
@oliver-sanders - another point @kinow made offline (he can correct me if I misrepresent him) is, thinking ahead to looser cloud-based deployments where J-hub might be separately deployed to one host, UI Server(s) to another(s), cylc-flow to others, or whatever, ... where the main CLI command resides is clear enough if it stays with cylc-flow, but otherwise (if it needs to know about all components) not so clear. E.g. if we don't end up modifying J-hub at all (and hopefully we won't) it may not even get installed via Cylc. So how is our The only sticking point for me is, it does seem unnecessary to have to install the full cylc-flow package just to get the main |
Not really. If we have installations in different containers that's no problem, we wouldn't expect the installation in one container to know about the installation in another. Whenever you run a
Easy, like this:
[options.entry_points]
console_scripts=
cylc-hub = jupyterhub.app:main
cylc-uiserver = cylc.uiserver.main:main
cylc.module=
uiserver = 1.0.0 |
This ticket seems to have generated a lot of discussion which confuses me. So to quickly explain what I've proposed on the
[options.entry_points]
console scripts=
cylc-run = cylc.flow.scripts.run.main:main
...
module=
flow = 8.0.0
[options.entry_points]
console_scripts=
cylc-hub = jupyterhub.app:main
cylc-uiserver = cylc.uiserver.main:main
cylc.module=
uiserver = 1.0.0
def version():
print(f'Cylc {__version__}'
for module, version in get_entry_point('cylc.module).items():
print(f' {module}: {version}') We don't actually need the This is fully independent of PIP, Conda, Docker, whatever, it simply lists the names and versions of and Cylc packages installed in the local Python environment. Managing stacks, environments and containers is your own lookout, we can't help you there! |
FYI a couple of projects which iterate over entry points to list plugins: pytest pygments And some Python documentation on how to do this: https://packaging.python.org/guides/creating-and-discovering-plugins/#using-package-metadata |
Thanks for the code example, that clarifies a bit (I thought you wanted to list the version of For me, if a user reported an issue that I thought could involve a problem in the dependency list, I'd prefer to get a list of modules (example support in jupyterhub this kind of info too (though I expect users will understand that if using Conda/rpm/etc, they may need to translate that command to something else - and I think their users are sometimes researchers too)
The current example duplicates the version info, but I can see your point, as otherwise we need to hardcode which modules we want to display in the version output. Users can still install any dependency they want, either via pip/conda/rpm/etc or just something like Also, any user installing
In this case, his suite could be running
Using the other virtual environment, or going to the box running the suite, he would see:
Sorry if this example is too contrived. I am just trying to explain why I dont' think The other issue I have with this proposal is the moveof I don't expect to have anything in that command that could run JupyterHub, or any other utility. If I am writing a suite, I don't expect to be able to run This is my opinion, but I can see others would disagree and find convenience in having more subcommands. So I don't think this should be a blocker for this issue. If you really think this will be useful for support, and won't become a maintenance issue in the long term, then all good for me.
👍 this was mentioned in cylc/cylc-flow#2989 and cylc/cylc-flow#2959. I'm +1 for that. |
I think there has been a lot of confusion here. Sorry for not explaining better. All I want to do is to print a list of Cylc entry points in one environment. If the user has multiple environments the command would not report this information, the user would not expect it to.
Exactly! The only way to tell what the user has actually installed (which works for everything) is to iterate over modules or entry points. Running
It's not contrived, this is probably how our site installations will look, however, I can't see why it would be a problem: $ . /path/to/uiserver-env/bin/activate
$ cylc version --long
Cylc 8.0a2
Flow - 8.0a1
UI Server - 1.0.0 $ . /path/to/flow-env/bin/activate
$ cylc version --long
Cylc 8.0a1
Flow - 8.0a2
Xtriggers - 1.0.1 We would expect different results! |
This is the main point of this issue. Up for debate, but we do need a solution to the problem: We don't require a full Cylc Flow installation on job hosts, we only require certain functionality namely some cylc subcommands. How do we make it so that we can have commands like:
If we don't centralise CLI functionality then what should we do instead?
|
This issue has become too convoluted for progress, the Superseeding this issue with #76 which poses questions but doesn't propose solutions. |
At present the
cylc
command lives in Cylc Flow.As of cylc/cylc-flow#3413 it is possible for other Cylc components to add their own Cylc commands.
It would probably make more sense for the
cylc
command to live in a common module which the others could used in turn. This common module should also contain thecylc version
command which should now provide the version of the Cylc "super package", and, on-request a list of installed components and their versions. Note the list of installed components could be obtained from "entry points" in some way, this would work for both pipy and conda installations.This "common module" could be:
git
submodule.The text was updated successfully, but these errors were encountered: