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

Added fullpath to jupyter_server_extension #3270

Merged
merged 4 commits into from
Mar 28, 2022
Merged

Added fullpath to jupyter_server_extension #3270

merged 4 commits into from
Mar 28, 2022

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Mar 28, 2022

I noticed I couldn't get the Panel widget in jupyter lab to work in a non-base conda environment.
Screenshot 2022-03-28_13 25 03

With the output in my terminal:
Screenshot 2022-03-28_13 25 14

The error is because ~ is present in the path and when os.path.abspath is used it gives a wrong result.

path = "~/hello_there.mp4"
a_path = os.path.abspath(path)
ae_path = os.path.abspath(os.path.expanduser(path))
path, a_path, ae_path

image

The abspath command is called from bokeh and a fix should be implemented there too.

@codecov
Copy link

codecov bot commented Mar 28, 2022

Codecov Report

Merging #3270 (6bc3290) into master (37c4044) will decrease coverage by 0.01%.
The diff coverage is 60.00%.

@@            Coverage Diff             @@
##           master    #3270      +/-   ##
==========================================
- Coverage   83.14%   83.13%   -0.02%     
==========================================
  Files         195      195              
  Lines       26030    26031       +1     
==========================================
- Hits        21643    21641       -2     
- Misses       4387     4390       +3     
Impacted Files Coverage Δ
panel/io/jupyter_server_extension.py 0.00% <0.00%> (ø)
panel/param.py 86.66% <0.00%> (-0.15%) ⬇️
panel/command/serve.py 37.27% <50.00%> (+0.28%) ⬆️
panel/widgets/file_selector.py 84.52% <83.33%> (+0.09%) ⬆️
panel/io/reload.py 69.56% <100.00%> (-1.87%) ⬇️
panel/io/server.py 80.19% <100.00%> (ø)
panel/util.py 84.98% <100.00%> (+0.11%) ⬆️
panel/tests/command/test_serve.py 83.54% <0.00%> (-1.46%) ⬇️
panel/io/state.py 69.11% <0.00%> (-0.23%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37c4044...6bc3290. Read the comment docs.

@philippjfr
Copy link
Member

This is great thank you! I notice you added a utility but aren't using it consistently yet.

@hoxbro
Copy link
Member Author

hoxbro commented Mar 28, 2022

I only have it in panel/io/jupyter_server_extension.py to avoid long lines.

Then I just searched for abspath and updated it with expanduser because it was the easiest thing to do.

If you want, I can move the functions into a utils file and call it consistently.

@philippjfr
Copy link
Member

If you want, I can move the functions into a utils file and call it consistently.

Seems sensible.

@@ -160,7 +160,7 @@ def recurse_tree(path, excludes, opts):
"""
# use absolute path for root, as relative paths like '../../foo' cause
# 'if "/." in root ...' to filter out *all* modules otherwise
path = os.path.abspath(path)
path = os.path.abspath(os.path.expanduser(path))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is outside the panel module so I chose to keep it.

@hoxbro
Copy link
Member Author

hoxbro commented Mar 28, 2022

Done.

Just to be transparent, I have not changed lines where something like os.path.abspath(__file__) has been used.

@philippjfr philippjfr merged commit 7878f78 into holoviz:master Mar 28, 2022
@hoxbro hoxbro deleted the fix_path branch April 15, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants