Skip to content

Commit f4011d9

Browse files
authored
Merge branch 'develop' into some-small-changes-to-readme
2 parents f04f391 + 6e07e52 commit f4011d9

File tree

9 files changed

+176
-93
lines changed

9 files changed

+176
-93
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN apt-get update -y && \
1010
apt-get clean
1111

1212
# Set up user
13-
ARG USER=vscode
13+
ARG USER=pydev
1414
ENV PATH /home/${USER}/.local/bin:$PATH
1515
RUN groupadd -r ${USER} && \
1616
useradd -m -r -s /bin/bash -g ${USER} ${USER} && \

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"build": {
44
"dockerfile": "Dockerfile",
55
"args": {
6-
"USER": "vscode"
6+
"USER": "pydev"
77
}
88
},
9-
"remoteUser": "vscode"
9+
"remoteUser": "pydev"
1010
}

README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,84 @@ $ mypy -p opensquirrel
8383
```shell
8484
$ pytest
8585
```
86+
87+
## Dev Container
88+
89+
### PyCharm
90+
91+
Open the Dev Container configuration file located at `.devcontainer/devcontainer.json` in the PyCharm editor.
92+
93+
On the left of the editor, in the gutter, you should see the Docker icon:
94+
<img src="docs/_static/devcontainer_docker_icon.png" width="20" height="20"> or
95+
<img src="docs/_static/devcontainer_docker_icon_2.png" width="20" height="20">.
96+
97+
Upon clicking on the Docker icon, the following options appear (depending on the PyCharm version used):
98+
- **Create Dev Container and Mount Sources...**, and
99+
- **Show Dev Containers**.
100+
101+
If no Dev Containers have been created previously,
102+
select the former option and proceed to create a Dev Container,
103+
otherwise select the latter option to list the existing Dev Containers.
104+
105+
#### Create Dev Container and Mount Sources...
106+
107+
1. If you select **Create Dev Container and Mount Sources...**,
108+
a separate window (*Building Dev Container*) will open and
109+
a Dev Container will be built according to the specification in the `devcontainer/Dockerfile`.
110+
2. The system dependencies are installed, a user account (*i.e.* **pydev**) is created,
111+
and additional Python packages and Poetry are installed.
112+
3. Upon completion the status messages should read something like:
113+
*'Dev Container' has been deployed successfully* and *Environment is successfully prepared…*
114+
4. Proceed by choosing your PyCharm installation, from the dropdown menu that appears at the top,
115+
and click **Continue**.
116+
5. A connection is established with the remote host and a new PyCharm window is opened.
117+
6. Skip the following subsection and proceed below.
118+
119+
#### Show Dev Containers
120+
121+
1. If you select **Show Dev Containers**,
122+
a separate window appears where the existing (previously created) Dev Containers are listed by their name and status
123+
(*i.e.* either running or idle). In general, all docker containers (including idle ones) can be listed using:
124+
125+
```bash
126+
docker ps -a
127+
```
128+
129+
2. If they are idle they can be started by clicking on their name or on the play button.
130+
An idle (Dev) Container can also be started from the terminal:
131+
132+
```bash
133+
docker container start <container-name>
134+
```
135+
136+
A running Dev Container can be accessed from the terminal, accordingly:
137+
138+
```bash
139+
docker exec -it <container-name> bash
140+
```
141+
142+
The `-i` flag stands for interactive session and the `-t` stands for running it in the terminal.
143+
144+
Once you have accessed the Dev Container, change to the user **pydev**:
145+
146+
```bash
147+
sudo -u pydev -i
148+
```
149+
150+
And make sure to navigate to the project root folder:
151+
152+
```bash
153+
cd /IdeaProjects/OpenSquirrel/
154+
```
155+
156+
Continue to install the dependencies (if not done already in this container; otherwise you may skip this step):
157+
158+
```bash
159+
poetry install
160+
```
161+
162+
and initiating the Poetry shell environment:
163+
164+
```bash
165+
poetry shell
166+
```
1.07 KB
Loading
1.11 KB
Loading

docs/_static/terminal_icon.png

66.6 KB
Loading

opensquirrel/parsing/libqasm/libqasm_ir_creator.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ def _get_expanded_squirrel_args(cls, generator_f, cqasm_args):
6060
)
6161

6262
expanded_args = [
63-
cls._get_qubits(cqasm_arg)
64-
if expected_parameter.annotation == Qubit
65-
else [cls._get_literal(cqasm_arg)] * number_of_operands
63+
(
64+
cls._get_qubits(cqasm_arg)
65+
if expected_parameter.annotation == Qubit
66+
else [cls._get_literal(cqasm_arg)] * number_of_operands
67+
)
6668
for cqasm_arg, expected_parameter in zip(cqasm_args, parameters)
6769
]
6870

poetry.lock

Lines changed: 85 additions & 85 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ mkdocs-material = "^9.4.12"
4444
libqasm = "0.5.2"
4545

4646
[tool.poetry.group.dev.dependencies]
47-
black = "^23.11.0"
47+
black = ">=23.11,<25.0"
4848
coverage = {extras = ["toml"], version = "^7.3.2"}
4949
isort = "^5.11.4"
50-
pytest = {extras = ["toml"], version = "^7.4.3"}
50+
pytest = {extras = ["toml"], version = ">=7.4.3,<9.0.0"}
5151
pytest-cov = "^4.1.0"
5252
mypy = "^1.7.0"
5353

0 commit comments

Comments
 (0)