Qiskit development container for use in VSCode.
You need to fork Qiskit first. Once you have your own fork you can then clone it to your machine.
git clone https://github/<your-repo>/qiskit
Clone this directory next to your fork.
git clone https://github.com/amaloney/qiskit-dev-container
Copy the .devcontainer
and Dockerfile
to your Qiskit fork.
cp -R qiskit-dev-container/.devcontainer qiskit
cp Dockerfile qiskit
Open up VSCode and point it to your Qiskit fork. VSCode should detect that there is a devcontainer folder and will ask you if you want to install the container. You can run tox after successfully installing the devcontainer. Open up a terminal in VSCode and execute the following command.
tox
If you get to the lint-incr
stage for tox and it complains about git permissions on
the qiskit folder, then make sure you have done the following two things.
- Add your name and email to the git config.
- Make sure the user and group is set to the user/group within the devcontainer.
Then rerun the tox
command. This should run all the tests and lint the codebase.
Make sure you run tox
after any changes you make to the code.
Please note that the Dockerfile installs Qiskit using pip install --editable .
. As
stated in their documentation, in editable mode the compiled extensions are built in
debug mode without optimizations. If you do not want this then you will need to run the
following.
python setup.py build_rust --release --inplace
Or replace the pip install --editable .
command with the one above.