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

Add binder preview on PR #46

Merged
merged 24 commits into from
Apr 23, 2023
Merged

Add binder preview on PR #46

merged 24 commits into from
Apr 23, 2023

Conversation

steff456
Copy link
Contributor

@steff456 steff456 commented Apr 12, 2023

This PR has the main objective of adding a preview in the PRs to check both installation and changes in a JupyterLab interface.

This PR,

  • Adds a binder folder with the environment.yml and postBuild
  • Adds a github action that will comment in the opened PRs to see the changes
  • Adds a binder to preview the extension on the main branch - creating a demo 🎉
  • Fixes missing variables in JupyterLab 3.6.x in the Pitaya Smoothie theme

As this PR is setting an action the idea is to squash all the commits once it is working.

@steff456 steff456 closed this Apr 12, 2023
@steff456 steff456 reopened this Apr 12, 2023
@steff456
Copy link
Contributor Author

Screenshot of the last binder link:

image

Copy link
Contributor

@gabalafou gabalafou left a comment

Choose a reason for hiding this comment

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

I have a question about the workflow file

Comment on lines +6 to +8
push:
branches:
- main
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand this part. Does this say to run the workflow whenever a commit is pushed to the main branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! With that we will have a working demo that gets deployed in main 🤓

Copy link
Member

Choose a reason for hiding this comment

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

In this case., we might want to add a badge in the README file to point to the demo, otherwise, people will not even know this exists unless they look at the PRs

.github/workflows/binder-on-pr.yml Show resolved Hide resolved
@trallard
Copy link
Member

I have not had time for a deep review - but just from a glance on the screenshot in the previous message I can see icons in black on top of the purple background... and I am going to go on a wild guess and mention

  1. I am sure that is not expected - in any case fallback icons should be the same lavender shade as in the sidebar
  2. black on that purple/indigo will not meet a 3:1 contrast so needs changing anyway

@trallard
Copy link
Member

Question: is there a way to update the binder preview comment instead of creating a new comment on every commit?

This will/might get annoying pretty soon, i.e. too many notifications and noise - especially when folks like me who send looooads of small commits in quick succession work on PRs

@steff456
Copy link
Contributor Author

I have not had time for a deep review - but just from a glance on the screenshot in #46 (comment) I can see icons in black on top of the purple background... and I am going to go on a wild guess and mention

I'm checking this issue and it is only happening in binder, I'll take a look why this is happening.

Question: is there a way to update the binder preview comment instead of creating a new comment on every commit?

I'm going to see how to do it

@Quansight-Labs Quansight-Labs deleted a comment from github-actions bot Apr 12, 2023
@Quansight-Labs Quansight-Labs deleted a comment from github-actions bot Apr 12, 2023
@Quansight-Labs Quansight-Labs deleted a comment from github-actions bot Apr 12, 2023
@Quansight-Labs Quansight-Labs deleted a comment from github-actions bot Apr 12, 2023
@Quansight-Labs Quansight-Labs deleted a comment from github-actions bot Apr 12, 2023
@Quansight-Labs Quansight-Labs deleted a comment from github-actions bot Apr 12, 2023
@Quansight-Labs Quansight-Labs deleted a comment from github-actions bot Apr 12, 2023
@Quansight-Labs Quansight-Labs deleted a comment from github-actions bot Apr 12, 2023
@Quansight-Labs Quansight-Labs deleted a comment from github-actions bot Apr 12, 2023
@github-actions
Copy link

github-actions bot commented Apr 12, 2023

Binder 👈 Launch a binder notebook on branch Quansight-Labs/jupyterlab-accessible-themes/add-preview
Comment updated on 2023-04-17T20:21:25.981Z

@Quansight-Labs Quansight-Labs deleted a comment from github-actions bot Apr 12, 2023
@steff456
Copy link
Contributor Author

So apparently, the difference is that Binder is using JupyterLab verison 3.6.3 and my local environment was using 3.5.3. I'm not sure why, in the change of versions of 3.5.x to 3.6.x they decided to change the variable --jp-inverse-layout-colorX to --jp-inverse-layoutX.

For now, I duplicated the variables, in the way that the extension will work with both and it is now working in binder as expected 🎉

image

@trallard
Copy link
Member

So apparently, the difference is that Binder is using JupyterLab verison 3.6.3 and my local environment was using 3.5.3. I'm not sure why, in the change of versions of 3.5.x to 3.6.x they decided to change the variable --jp-inverse-layout-colorX to --jp-inverse-layoutX.

Ok this raises another item to look at. Python 3.6 has reached its end of life and 3.7 is not far off see https://devguide.python.org/versions/.

I would suggest then targeting Python >= 3.8 and drop anything below that

Copy link
Member

@trallard trallard left a comment

Choose a reason for hiding this comment

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

Thanks @steff456 - left a few comments and suggestions

In addition to the comments there:

  1. The PostBuild script is a Python script atm - is there a particular reason this was preferred over a bash script? Pure curiosity as I usually use the latter and find it easier and it helps me avoid calling subprocesses
  2. The colours in the theme - did you use the ones in thetrallard/pitaya_smoothie repo or the Jupyterlab one? either is fine, but if you used the latter one I might need to tweak some colours (nothing bad nor for you to take on)

Comment on lines +6 to +8
push:
branches:
- main
Copy link
Member

Choose a reason for hiding this comment

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

In this case., we might want to add a badge in the README file to point to the demo, otherwise, people will not even know this exists unless they look at the PRs

.github/workflows/binder-on-pr.yml Outdated Show resolved Hide resolved
.github/workflows/binder-on-pr.yml Outdated Show resolved Hide resolved
.github/workflows/binder-on-pr.yml Outdated Show resolved Hide resolved
binder/environment.yml Outdated Show resolved Hide resolved
binder/environment.yml Outdated Show resolved Hide resolved
binder/environment.yml Show resolved Hide resolved
"""
print("\n\t", " ".join(args), "\n")
return_code = subprocess.call(args, **kwargs)
if return_code != 0:
Copy link
Member

Choose a reason for hiding this comment

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

would it not be best to raise a proper exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was part of the template I used. I think they do it to return the complete stacktrace into the console in case there's an error and not only the error.

binder/postBuild Outdated Show resolved Hide resolved
@steff456
Copy link
Contributor Author

Hi @trallard,

The PostBuild script is a Python script atm - is there a particular reason this was preferred over a bash script? Pure curiosity as I usually use the latter and find it easier and it helps me avoid calling subprocesses

I'm using the template of binder for extensions and they are using a Python script instead of a bash one.. I don't have any preference but decided to take the template as it is.

The colours in the theme - did you use the ones in the trallard/pitaya_smoothie repo or the Jupyterlab one? either is fine, but if you used the latter one I might need to tweak some colours (nothing bad nor for you to take on)

I used the colors present in the JupyterLab extension repo, I'll create an issue to update the colors so they match the trallard/pitaya_smoothie repo.

@steff456
Copy link
Contributor Author

In this case., we might want to add a badge in the README file to point to the demo, otherwise, people will not even know this exists unless they look at the PRs

Apparently we already have a binder badge in the README on the main branch. It is currently broken, but it will work once we merge this PR.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done 💪🏾
Development

Successfully merging this pull request may close these issues.

3 participants