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

Fix pre-commit in the image #507

Merged
merged 4 commits into from
Nov 13, 2024
Merged

Fix pre-commit in the image #507

merged 4 commits into from
Nov 13, 2024

Conversation

danielhollas
Copy link
Contributor

@danielhollas danielhollas commented Nov 11, 2024

Fixes pre-commit by moving the pip.conf configuration (which automatically sets the --user option to pip install) from the global etc/pip.conf to site-specific /opt/conda/pip.conf. In this way, the configuration does not mess with virtual environments. See the long comment in the Dockerfile for detailed explanation.

Fixes #501

@danielhollas danielhollas changed the title mv /etc/pip.conf ~/.config/pip/pip.conf Move /etc/pip.conf -> /opt/conda/pip.conf Nov 12, 2024
@danielhollas danielhollas changed the title Move /etc/pip.conf -> /opt/conda/pip.conf Move /etc/pip.conf to /opt/conda/pip.conf Nov 12, 2024
@danielhollas danielhollas marked this pull request as ready for review November 12, 2024 17:44
@danielhollas danielhollas changed the title Move /etc/pip.conf to /opt/conda/pip.conf Fix pre-commit in the image Nov 12, 2024
@danielhollas
Copy link
Contributor Author

@PNOGillespie could you please take a look and see if the image ghcr.io/aiidalab/full-stack:pr-507 fixes your pre-commit issue?

Tagging multiple people for review so that we're all aware that this pip configuration exists.

Copy link

@PNOGillespie PNOGillespie left a comment

Choose a reason for hiding this comment

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

Just checked out your image and pushed a test commit to my own remote, no issues to report! (at least from the perspective of a contributor rather than a core dev)

@@ -42,8 +42,19 @@ RUN cat /opt/requirements.txt | xargs -I{} conda config --system --add pinned_pa

# Configure pip to use the same requirements file as constraints file.
ENV PIP_CONSTRAINT /opt/requirements.txt
# Ensure that pip installs packages to ~/.local by default
COPY pip.conf /etc/pip.conf
# Ensure that pip installs packages to '~/.local/lib/python3.X/site-packages/' by default
Copy link
Member

Choose a reason for hiding this comment

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

Is this means when python version changed in the image, dependencies of apps need to be reinstalled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, see #317

Copy link
Member

@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.

Thanks @danielhollas
One question in comment. The changes looks all good.

Comment on lines +52 to +57
# Other locations such as '~/.config/pip/pip.conf' or '/etc/pip.conf' would interfere with virtual environments,
# for example those used by pre-commit.
# We can't use the PIP_USER env variable for the same reason.
# To better understand this, try running `pip config debug` and see
# https://github.com/aiidalab/aiidalab-docker-stack/issues/501
COPY pip.conf "${CONDA_DIR}/pip.conf"
Copy link
Member

Choose a reason for hiding this comment

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

Makes sense to me.

@danielhollas
Copy link
Contributor Author

@PNOGillespie thank you very much for testing, and thank you @unkcpz for review!

I am going to merge this in the afternoon and release a new image version (which will also include AiiDA 2.6.3)

@danielhollas danielhollas merged commit 7050f0b into main Nov 13, 2024
15 checks passed
@danielhollas danielhollas deleted the externally-managed branch November 13, 2024 15:18
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.

[Dev] Installing pre-commit hooks fails due to PIP_USER=1
3 participants