ORNL / flowcept

Runtime data integration system that empowers any data processing system to capture and query workflow provenance using data observability.
MIT License
1 stars 3 forks source link

Find out how to run create_settings_file() in the setup.py directly with pip install from pypi #119

Open renan-souza opened 7 months ago

renan-souza commented 7 months ago

When you pip install flowcept in a Python environment, then import the package with import flowcept, it gives the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/g/Desktop/ORNL/OLCF/flowcept/src/flowcept/__init__.py", line 3, in <module>
    from flowcept.configs import SETTINGS_PATH
  File "/Users/g/Desktop/ORNL/OLCF/flowcept/src/flowcept/configs.py", line 19, in <module>
    raise Exception(
Exception: Settings file /Users/g/.flowcept/settings.yaml was not found. You should either define the environment variable FLOWCEPT_SETTINGS_PATH with its path or install Flowcept's package to create the directory ~/.flowcept with the file in it.
A sample settings file is found in the 'resources' directory under the project's root path.

Obviously it's looking for a settings file in my home directory but the implementation of this is a poor user experience. The user should not be required to create such a file just to use the package. Some options to fix this are:

wigging commented 7 months ago

One thing you need to do is put the sample_settings.yaml file in the flowcept package itself. So move resources/sample_settings.yaml to flowcept/sample_settings.yaml. This will make sure the file is in the built package that is pushed up to PyPI. That way when a user does a pip install it will include the yaml file. The next step is to move the yaml file from the installed package to a location where the user can easily edit it.

wigging commented 7 months ago

Something to consider is that a user may already have a settings file. Maybe they got it from someone else or have one from installing a previous version of the package. So when that user installs flowcept in a new environment, they don't want flowcept to overwrite their existing settings file. They just want to point flowcept to their existing settings file.

wigging commented 7 months ago

Providing a settings file for users feels like the installation process for the sphinx package. After you pip install sphinx, you run a sphinx command from the terminal to create a config file which is later used to generate documentation. How about doing a similar thing for flowcept? A user pip installs flowcept then they run a command like flowcept config which would create the settings file in a default location or in the same directory where the command is run. If the settings file already exists in that location then abort creating the file.

wigging commented 2 weeks ago

There was no description so I added one.

wigging commented 2 weeks ago

The title for this issue is about to be invalid because the setup.py file will be gone soon. Actually, this issue should be closed and issue #147 should be reopened to take its place.