-
Notifications
You must be signed in to change notification settings - Fork 341
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
Codespaces support for v4 #1635
Open
bramathon
wants to merge
1
commit into
rigetti:v4
Choose a base branch
from
bramathon:codespaces-support
base: v4
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// For use with Visual Studio Code | ||
{ | ||
"name": "${localWorkspaceFolderBasename}", | ||
"dockerComposeFile": [ | ||
"../docker-compose.yaml", | ||
"docker-compose.extend.yaml" | ||
], | ||
"remoteUser": "rigetti", | ||
"service": "lab", | ||
"workspaceFolder": "/home/rigetti/${localWorkspaceFolderBasename}", | ||
"shutdownAction": "stopCompose", | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"ms-toolsai.jupyter", | ||
], | ||
"settings": { | ||
"python.defaultInterpreterPath": "/home/quil/.venv/${localWorkspaceFolderBasename}/bin/python", | ||
"python.pythonpath": "/home/rigetti/.venv/${localWorkspaceFolderBasename}/bin/python" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version: '3' | ||
services: | ||
lab: | ||
# Overrides default command so things don't shut down after the process ends. | ||
command: /bin/bash -c "while sleep 1000; do :; done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,67 @@ | ||
# use multi-stage builds to independently pull dependency versions | ||
ARG quilc_version=1.20.0 | ||
ARG qvm_version=1.17.1 | ||
ARG python_version=3.7 | ||
# syntax=docker/dockerfile:1.3 | ||
ARG PYTHON_VERSION=3.9 | ||
FROM python:$PYTHON_VERSION AS dev | ||
|
||
# use multi-stage builds to independently pull dependency versions | ||
FROM rigetti/quilc:$quilc_version as quilc | ||
FROM rigetti/qvm:$qvm_version as qvm | ||
FROM python:$python_version-buster | ||
USER root | ||
|
||
ARG pyquil_version | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
curl \ | ||
wget \ | ||
git \ | ||
build-essential \ | ||
software-properties-common \ | ||
bash-completion \ | ||
libblas-dev \ | ||
libffi-dev \ | ||
liblapack-dev \ | ||
libzmq3-dev \ | ||
sudo | ||
|
||
# copy over the pre-built quilc binary from the first build stage | ||
COPY --from=quilc /src/quilc/quilc /src/quilc/quilc | ||
# Create the docker user 'rigetti' | ||
ENV USER=rigetti | ||
ARG UID=1000 | ||
ARG GID=1000 | ||
RUN addgroup --gid ${GID} ${USER} \ | ||
&& adduser \ | ||
--disabled-password \ | ||
--gecos ${USER} \ | ||
--gid ${GID} \ | ||
--uid ${UID} \ | ||
--home /home/rigetti/ \ | ||
${USER} \ | ||
&& usermod -aG sudo ${USER} \ | ||
&& passwd -d ${USER} | ||
|
||
# copy over the pre-built qvm binary from the second build stage | ||
COPY --from=qvm /src/qvm/qvm /src/qvm/qvm | ||
# Create our project directory and switch to it | ||
ARG PROJECT_SLUG=pyquil | ||
ARG SRC_DIR=. | ||
ENV APP_DIR=/home/${USER}/${PROJECT_SLUG} | ||
RUN mkdir -p ${APP_DIR}/${SRC_DIR} && chown -R ${USER}:${USER} ${APP_DIR}/${SRC_DIR} | ||
|
||
# install the missing apt packages that aren't copied over | ||
RUN apt-get update && apt-get -yq dist-upgrade && \ | ||
apt-get install --no-install-recommends -yq \ | ||
git libblas-dev libffi-dev liblapack-dev libzmq3-dev && \ | ||
rm -rf /var/lib/apt/lists/* | ||
WORKDIR ${APP_DIR}/${SRC_DIR} | ||
|
||
# install ipython | ||
RUN pip install --no-cache-dir ipython | ||
USER ${USER} | ||
|
||
# install pyquil | ||
RUN pip install pyquil==$pyquil_version | ||
# Install poetry | ||
RUN curl -sSL https://install.python-poetry.org | python3 - | ||
ENV PATH="${PATH}:/home/${USER}/.local/bin" | ||
RUN mkdir -p /home/${USER}/.config/pypoetry/ | ||
|
||
# use an entrypoint script to add startup commands (qvm & quilc server spinup) | ||
COPY ./entrypoint.sh /src/pyquil/entrypoint.sh | ||
ENTRYPOINT ["/src/pyquil/entrypoint.sh"] | ||
CMD ["ipython"] | ||
# Install the package | ||
COPY --chown=${USER}:${USER} ${SRC_DIR}/README.md ${SRC_DIR}/pyproject.toml ${SRC_DIR}/poetry.lock ./ | ||
COPY --chown=${USER}:${USER} --chmod=775 ${SRC_DIR}/pyquil/__init__.py ./pyquil/__init__.py | ||
RUN poetry install \ | ||
--no-interaction \ | ||
--no-ansi \ | ||
--extras latex | ||
RUN rm -r ./pyquil | ||
|
||
# Set up the venv | ||
RUN mkdir ${HOME}/.venv/ && ln -s $(poetry env info -p) /home/${USER}/.venv/${PROJECT_SLUG} | ||
ENV VIRTUAL_ENV=/home/${USER}/.venv/${PROJECT_SLUG} | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
|
||
WORKDIR ${APP_DIR} | ||
ENV SHELL /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
version: '3' | ||
version: '3.5' | ||
|
||
services: | ||
lab: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
PYTHON_VERSION: ${PYTHON_VERSION:-3.9} | ||
volumes: | ||
- .:/home/rigetti/pyquil/ | ||
environment: | ||
- QCS_SETTINGS_APPLICATIONS_PYQUIL_QVM_URL=http://qvm:5000 | ||
- QCS_SETTINGS_APPLICATIONS_PYQUIL_QUILC_URL=tcp://quilc:5555 | ||
quilc: | ||
image: rigetti/quilc | ||
command: -S | ||
expose: | ||
command: | ||
- -R | ||
- -p | ||
- "5555" | ||
ports: | ||
- '5555:5555' | ||
networks: | ||
- test | ||
|
||
- -P | ||
qvm: | ||
image: rigetti/qvm | ||
command: -S | ||
expose: | ||
command: | ||
- -p | ||
- "5000" | ||
ports: | ||
- '5000:5000' | ||
networks: | ||
- test | ||
|
||
networks: | ||
test: | ||
driver: bridge | ||
|
||
- -S |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These environment variables should be
QCS_APPLICATIONS_QVM_URL
QCS_APPLICATIONS_QUILC_URL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Will update since targeting v4