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

Information about accessing local files #2433

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

drnw
Copy link

@drnw drnw commented Mar 26, 2021

A small change to the docs.

y='count():Q',
color='weather:N'
)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's not use an altair-plot directive here, as it will attempt to render a chart and fail due to the data URL not being present. Instead you can make it a standard RST code block.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, localhost:8888 is not always the place where files are served. We should preface this with more info, e.g. "For example, if you are using a local JupyterLab instance that is hosted on http://localhost:8888, then your URL might look something like this for a data file located in the same directory where jupyterlab was started:"

All these required caveats are why I've not previously included something like this in the docs.

Copy link
Collaborator

@jakevdp jakevdp Mar 26, 2021

Choose a reason for hiding this comment

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

One question though: is it true that the full URL is required? I seem to remember that you could do something like files/data.json depending on your browser's security settings, though it's been a while since I've used Altair on Jupyterlab.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed, the full URL is not required in JupyterLab. See #2432 (comment)

@@ -68,6 +68,21 @@ Similarly, we must also specify the data type when referencing data by URL:
y='Miles_per_Gallon:Q'
)

You can use any URL visible to your frontend (i.e. JupyterLab, Jupyter Notebook, Colab, VSCode, Streamlit, etc.)

All of those frontends have different mechanisms for accessing local files (if they have a mechanism at all), so there is no way to provide general advice for how to proceed. By way of example, consider a JupyterLab setup with seattle-weather.csv and a notebook in the top level folder. In this case, the full URL needs to be given.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this phrasing makes sense in the context of a question about how to display local files, but sounds strange here when talking about URLs in general. Maybe start by saying something like "For accessing data by URL that is stored on your local machine, you can use any URL..."

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