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

Make a CLI #5

Open
jetuk opened this issue Oct 9, 2018 · 15 comments
Open

Make a CLI #5

jetuk opened this issue Oct 9, 2018 · 15 comments

Comments

@jetuk
Copy link
Contributor

jetuk commented Oct 9, 2018

Probably using a click.

Some example commands.

hydra-cli network delete 5

hydra-cli project add "My Awesome Project"

hydra-cli project rename "My Awesome Project" "My Very Awesome Project"

hydra-cli user list
@dastamoghno
Copy link

i would like to work on this issue

@dastamoghno
Copy link

however, i am still new to all this, so if you could suggest some resources to catch up i would love to learn

@jetuk
Copy link
Contributor Author

jetuk commented Oct 11, 2018

@dastamoghno I am imagining a CLI using click: https://click.palletsprojects.com/en/7.x/
It would mostly provide convenient access to some of the library functions in hydra-base: https://github.com/hydraplatform/hydra-base

A similar CLI using click and this library has been written for hydra-pywr. See the cli.py module: https://github.com/pywr/hydra-pywr

This CLI would be more general though.

Perhaps an easy one to start with would be to list all the projects? I would expect it to work something like this.

$ hydra-cli project list
  [1] - "project A"
  [2] - "my other project"
  [5] - "another project"

Where [x] is the project ID.

@dastamoghno
Copy link

ok, so which projects need to be included in the list as of now?

@jetuk
Copy link
Contributor Author

jetuk commented Oct 11, 2018

The new programme hydra-cli needs to inspect the database using the hydra-base library to produce a list of the current projects in the database.

@dastamoghno
Copy link

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-xYByle/mysqlclient/
I get the following error while trying to install hydra-base. What do i do about it?

@knoxsp
Copy link
Contributor

knoxsp commented Oct 11, 2018

Take a look at the example code here:
https://github.com/hydraplatform/hydra-client-python/tree/master/examples

You'll need to have installed hydra_base first, using python setup.py develop from here:
https://github.com/hydraplatform/hydra-base

The basic workflow to my mind is:
A user logs in

hydra-cli connect

Underneath it's doing hydra_client.login()

Then the user requests his networks:

hydra-cli project list

Underneath it's doing: hydra_client.get_projects()

Just getting that far would be super awesome.

@knoxsp
Copy link
Contributor

knoxsp commented Oct 11, 2018

why not try python setup.py develop?
My guess is that there is some kind of inconsitency in the egg, as the mysqlclient library is a recent addition.

@dastamoghno
Copy link

I installed hydra-base in my virtual environment and then created a launcher file setup.py for my cli, but then renamed it to setup_cli.py, and now there exists no such file as setup.py
I'm sorry for asking such noobie questions, but I am kind of stuck, in spite of trying really hard. Please help

@dastamoghno
Copy link

Can i please get the link to the login function in hydra-client? I am having problems in understanding the parameters to send to the function

@knoxsp
Copy link
Contributor

knoxsp commented Oct 11, 2018

The login function you want is located in here:
https://github.com/hydraplatform/hydra-client-python/blob/master/hydra_client/connection/json_connection.py

You don't need to pass any arguments to it. It should prompt you for a username and password when you call the function and don't pass in arguments.

@dastamoghno
Copy link

I am sorry, but I dont understand the code too well. As i said i am just a beginner getting exposed to the command line, hence facing lots of issues and i dont even know how to describe them

@jetuk
Copy link
Contributor Author

jetuk commented Oct 11, 2018

I think it defaults to username root with an empty password.

@dastamoghno
Copy link

dastamoghno commented Oct 11, 2018 via email

@jetuk
Copy link
Contributor Author

jetuk commented Oct 11, 2018

OK, no problem. Thanks for looking in to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants