constellation-app / constellation

A graph-focused data visualisation and interactive analysis application.
https://constellation-app.com
Apache License 2.0
386 stars 58 forks source link

Bug fixes and enhancements to python package for jupyter notebook #2096

Closed Quasar985 closed 3 months ago

Quasar985 commented 4 months ago

Prerequisites

Description of the Change

Changes include:

Alternate Designs

N/A

Why Should This Be In Core?

N/A

Benefits

Fix bug stopping package from working correctly and added functionality to reduce potential frustration.

Possible Drawbacks

None

Verification Process

FOR DEPRECATED CODE

  1. Open Consty
  2. Open a graph, or create a new graph
  3. Start Jupyter Notebook
  4. Run the following code:
    
    import io
    import os
    import pandas as pd
    import PIL.Image, PIL.ImageDraw, PIL.ImageFilter, PIL.ImageFont

Also import some of the notebook display methods so we can display nice things.

# from IPython.display import display, HTML, Image

This is a convenient Python interface to the REST API.

# import constellation_client

cc = constellation_client.Constellation()

df = cc.get_dataframe() df.head()

5. Verify no errors are thrown

FOR CHANGING REST PATH
1. Open Consty
2. Open a graph, or create a new graph
3. Click Setup->Options->CONSTELLATION
4. In "REST" directory (under Internal Webserver) type in a valid file path (e.g C:\Projects)
5. Observe warning message appear below REST directory input box
6. Click Apply, then OK
7. Click Tools->Start Jupyter Notebook
8. Run the following code and MAKE SURE TO CHANGE C:\Projects TO THE PATH SPECIFIED IN STEP 4:

import io import os import pandas as pd import PIL.Image, PIL.ImageDraw, PIL.ImageFilter, PIL.ImageFont

Also import some of the notebook display methods so we can display nice things.

# from IPython.display import display, HTML, Image

This is a convenient Python interface to the REST API.

# import constellation_client

cc = constellation_client.Constellation()

Tell constellation_client where rest.json is.

CHANGE C:\Projects TO THE PATH SPECIFIED IN STEP 4 ON GITHUB

cc.update_rest(r"C:\Projects")

df = cc.get_dataframe() df.head()


9. Verify no errors are thrown, and data from graph is shown (assuming current graph has data)

### Applicable Issues

<!-- Link any applicable issues here -->
https://github.com/constellation-app/constellation/issues/2073
OrionsGuardian commented 4 months ago

In the Constellation Options screen, there's a setting where you can specify the REST directory: image

This setting seems to be ignored. Starting the REST server when this setting is populated didn't put the rest.json file in the specified directory. Instead, the rest.json file was put into two folders: .CONSTELLATION and .ipython

Why are we writing two copies of the file? One copy should be sufficient.

Also, we should try to find a way to use the user specified directory to hold the rest.json file. There is a possibility that some users are on workstations that have limited permissions for writing files, so they will need the ability to specify which folder to use.

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
2 Security Hotspots
82.5% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud