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

feat: create the CLI command flexmeasures show reporters #686

Merged
merged 7 commits into from May 19, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/spellright.dict
Expand Up @@ -246,8 +246,8 @@ deserializing
kwargs
fsdomain
filepath
spellright
Changelog
Bugfixes
Dockerfile
nt
20 changes: 18 additions & 2 deletions documentation/dev/introduction.rst
@@ -1,6 +1,7 @@
.. _developing:



Developing for FlexMeasures
===========================

Expand Down Expand Up @@ -36,8 +37,6 @@ Clone the `FlexMeasures repository <https://github.com/FlexMeasures/flexmeasures

$ git clone https://github.com/FlexMeasures/flexmeasures.git

.. note:: Are you using Visual Studio Code? Then the code you just cloned also contains the editor configuration (part of) our team is using!


Dependencies
^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -211,6 +210,23 @@ If ``flake8``, ``black`` or ``mypy`` propose changes to any file, the commit is
The changes proposed by ``black`` are implemented automatically (you can review them with `git diff`). Some of them might even resolve the ``flake8`` warnings :)


Using Visual Studio, including spell checking
----------------------------------------------

Are you using Visual Studio Code? Then the code you just cloned also contains the editor configuration (part of) our team is using (see `.vscode`)!

We recommend installing the flake8 and spellright extensions.

For spellright, the FlexMeasures repository contains the project dictionary. Here are steps to link main dictionaries, which usually work on a Linux system:

.. code-block:: bash

$ mkdir $HOME/.config/Code/Dictionaries
$ ln -s /usr/share/hunspell/* ~/.config/Code/Dictionaries

Consult the extension's Readme for other systems.



A hint about using notebooks
---------------
Expand Down
3 changes: 2 additions & 1 deletion flexmeasures/cli/data_add.py
Expand Up @@ -1133,7 +1133,8 @@ def add_schedule_for_storage(
default="PandasReporter",
required=True,
type=click.STRING,
help="Reporter class registered in flexmeasures.data.models.reporting or in an available flexmeasures plugin.",
help="Reporter class registered in flexmeasures.data.models.reporting or in an available flexmeasures plugin."
" Use the command `flexmeasures show reporters` to list all the available reporters.",
)
@click.option(
"--sensor-id",
Expand Down
23 changes: 23 additions & 0 deletions flexmeasures/cli/data_show.py
Expand Up @@ -376,4 +376,27 @@ def plot_beliefs(
click.secho("Data saved to file.", **MsgStyle.SUCCESS)


@fm_show_data.command("reporters")
@with_appcontext
def list_reporters():
"""
Show available reporters.
"""

click.echo("Reporters:\n")
click.echo(
tabulate(
[
(
reporter_name,
reporter_class.__version__,
str(reporter_class.__author__),
victorgarcia98 marked this conversation as resolved.
Show resolved Hide resolved
)
victorgarcia98 marked this conversation as resolved.
Show resolved Hide resolved
for reporter_name, reporter_class in app.reporters.items()
],
headers=["name", "version", "author"],
)
)


app.cli.add_command(fm_show_data)