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

Use aiidalab wide logo in notebook interface #416

Merged
merged 4 commits into from
Dec 1, 2023
Merged

Conversation

unkcpz
Copy link
Member

@unkcpz unkcpz commented Nov 14, 2023

No description provided.

@unkcpz unkcpz requested a review from danielhollas November 14, 2023 15:50
@unkcpz unkcpz added this to the 2023.1014 milestone Nov 14, 2023
Copy link
Contributor

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

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

Could you please add a screenshot? Where is this logo going to show up in the UI?

@@ -105,3 +105,9 @@ ENV NOTEBOOK_ARGS \
"--MappingKernelManager.cull_interval=300" \
"--TerminalManager.cull_inactive_timeout=600" \
"--TerminalManager.cull_interval=60"

# Set up the logo of notebook interface
COPY --chown=${NB_UID}:${NB_GID} aiidalab-wide-logo.png ${CONDA_DIR}/notebook-logo.png
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you put the logo in $CONDA_DIR? Isn't /opt/ a better place? Perhaps /opt/static/?

Copy link
Member Author

Choose a reason for hiding this comment

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

Could be, I'll use /opt, it is a temporary location, and I think it is better to use mv instead of cp.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can't use /opt since I didn't run fix-permission. I use /tmp instead, so I can use mv to avoid


# Set up the logo of notebook interface
COPY --chown=${NB_UID}:${NB_GID} aiidalab-wide-logo.png ${CONDA_DIR}/notebook-logo.png
# the folder of logo.png is get by find "$CONDA_DIR/lib" -path "*/notebook/static/base/images/logo.png"
Copy link
Contributor

Choose a reason for hiding this comment

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

I am very confused by this code. Why is this find necessary? Isn't the original logo always in the same 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.

Isn't the original logo always in the same path?

Not exactly the path now is /opt/conda/lib/python3.9/site-packages/notebook/static/base/images/logo.png, thus also dependent on the python version.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but we control the python version and it's value is available in the Dockerfile you only need to somehow get rid of the patch version.e.g 3.9.13 to 3.9, but I am assuming that should be possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Did not manage to do it simply.

I can do:

RUN export PYTHON_VERSION_MAJOR_MINOR=$(python -c "import sys; print('python{}.{}'.format(*sys.version_info[:2]))") && \
    mv /tmp/notebook-logo.png "$CONDA_DIR/lib/$PYTHON_VERSION_MAJOR_MINOR/site-packages/notebook/static/base/images/logo.png"

But I don't think it is simple. If read from PYTHON_VERSION then the problem is it can be 3.9 or 3.9.13, so it is not easy to parse the <major>.<minor> from it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I add a comment to explain the usage of find, I assume the -exec is a common option to execute the command on the result of find command.

Copy link
Member Author

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

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

The logo appear on the left-up corner replace the "Jupyter" logo, now it look like.

image

@@ -105,3 +105,9 @@ ENV NOTEBOOK_ARGS \
"--MappingKernelManager.cull_interval=300" \
"--TerminalManager.cull_inactive_timeout=600" \
"--TerminalManager.cull_interval=60"

# Set up the logo of notebook interface
COPY --chown=${NB_UID}:${NB_GID} aiidalab-wide-logo.png ${CONDA_DIR}/notebook-logo.png
Copy link
Member Author

Choose a reason for hiding this comment

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

Could be, I'll use /opt, it is a temporary location, and I think it is better to use mv instead of cp.


# Set up the logo of notebook interface
COPY --chown=${NB_UID}:${NB_GID} aiidalab-wide-logo.png ${CONDA_DIR}/notebook-logo.png
# the folder of logo.png is get by find "$CONDA_DIR/lib" -path "*/notebook/static/base/images/logo.png"
Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't the original logo always in the same path?

Not exactly the path now is /opt/conda/lib/python3.9/site-packages/notebook/static/base/images/logo.png, thus also dependent on the python version.

stack/lab/Dockerfile Outdated Show resolved Hide resolved
f-d

Co-authored-by: Daniel Hollas <[email protected]>
@unkcpz unkcpz merged commit b08027b into main Dec 1, 2023
25 checks passed
@unkcpz unkcpz deleted the fix/xx/add-logo branch December 1, 2023 13:39
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.

2 participants