apache / kibble-1

Apache Kibble - a tool to collect, aggregate and visualize data about any software project
https://kibble.apache.org/
Apache License 2.0
59 stars 28 forks source link

Kibble cli init #89

Closed skekre98 closed 4 years ago

skekre98 commented 4 years ago

I have currently initialized the cli with version and setup. I have currently left the setup function open since I believe the set up workflow is a work in progress. Let me know how you'd like me to handle this and what else to build out.

turbaszek commented 4 years ago

I have currently left the setup function open since I believe the set up workflow is a work in progress.

@skekre98 it would be awesome to rewrite it to using click 👍

turbaszek commented 4 years ago

Also the click library should be added to required dependencies in setup.py:

➜ kibble version
Traceback (most recent call last):
  File "/Users/turbaszek/.pyenv/versions/kibble/bin/kibble", line 33, in <module>
    sys.exit(load_entry_point('apache-kibble', 'console_scripts', 'kibble')())
  File "/Users/turbaszek/.pyenv/versions/kibble/bin/kibble", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/Users/turbaszek/.pyenv/versions/3.8.0/lib/python3.8/importlib/metadata.py", line 75, in load
    module = import_module(match.group('module'))
  File "/Users/turbaszek/.pyenv/versions/3.8.0/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/turbaszek/code/kibble/kibble/__main__.py", line 17, in <module>
    import click
ModuleNotFoundError: No module named 'click'

Adding this click==7.1.2 to setup.py INSTALL_REQUIREMENTS should solve the issue

skekre98 commented 4 years ago

Hi @turbaszek, how are you building the actual cli? I was testing by running python __main__.py 😅. In other words how can I run kibble version or other commands with kibble?

turbaszek commented 4 years ago

Hi @turbaszek, how are you building the actual cli? I was testing by running python __main__.py 😅. In other words how can I run kibble version or other commands with kibble?

Here are basic information: https://github.com/apache/kibble/blob/main/CONTRIBUTING.md#development-installation

You need to install kibble package, the -e flag is for editable installation.

skekre98 commented 4 years ago

@turbaszek apologies for the delay. I've been able to successfully migrate save_config from setup.py to __main__.py by using KibbleConfigParser. Will work on implementing create_index using click as well. Let me know if there is anything else you would like to see as well.

skekre98 commented 4 years ago

This is the current output with the cli:

(home) Sharvils-MacBook-Pro:kibble sharvilkekre$ kibble
Usage: kibble [OPTIONS] COMMAND [ARGS]...

  A simple command line tool for kibble

Options:
  --help  Show this message and exit.

Commands:
  setup    starts the setup process for kibble
  version  displays the current kibble version
(home) Sharvils-MacBook-Pro:kibble sharvilkekre$ kibble version
1.0.0dev
(home) Sharvils-MacBook-Pro:kibble sharvilkekre$ kibble setup
Welcome to the Apache Kibble setup script!
Elasticsearch: elasticsearch:9200
~/projects/kibble/kibble/api/yaml/kibble.yaml already exists! Writing to ~/projects/kibble/kibble/api/yaml/kibble.yaml.tmp instead
Writing Kibble config to ~/projects/kibble/kibble/api/yaml/kibble.yaml.tmp

All done, Kibble should...work now :)

This is currently only missing create_index

turbaszek commented 4 years ago

@skekre98 could you please rebase?

turbaszek commented 4 years ago

Hey @skekre98 any update on this one?

skekre98 commented 4 years ago

Hi @turbaszek, this is still in progress. I have been caught up with work the past few days.

skekre98 commented 4 years ago

Got it, I've noticed this PR has quite a lot of fluff so I'm going to go ahead and close this one and open a new one with the correct changes. Apologies for the misunderstanding 😅