materialsproject / fireworks

The Fireworks Workflow Management Repo.
https://materialsproject.github.io/fireworks
Other
351 stars 184 forks source link

Fix version flags of lpad + {q,m,r}launch CLIs #478

Closed janosh closed 2 years ago

janosh commented 2 years ago

Follow up to #476.

@computron I'm very sorry about this. Turns out I did sloppy work in #476. Should have included tests that would have caught the fact I was importing importlib incorrectly:

- import importlib # bad
+ import importlib.metadata # good

The former does not make importlib.metadata.version available resulting in the following error when trying to use any of the CLIs:

Traceback (most recent call last):
  File "/Users/janosh/.venv/py310/bin/qlaunch", line 8, in <module>
    sys.exit(qlaunch())
  File "/Users/janosh/.venv/py310/lib/python3.10/site-packages/fireworks/scripts/qlaunch_run.py", line 104, in qlaunch
    fw_version = importlib.metadata.version("fireworks")
AttributeError: module 'importlib' has no attribute 'metadata'

This PR fixes all 4 CLIs and adds tests for this new functionality. I hope it can also serve as a starting point to test other parts of the CLIs in Fireworks in the future. I started with the lpad get_fws command.

Hopefully, this can be released as a patch release before many people upgrade to 2.0.0 and encounter this error.