Skip to content

Commit 656af0c

Browse files
author
Axel Dahlberg
authored
Fixed native mode examples (#247)
* Fixed native mode examples * Install using --user in CI * Only use --user on macos * Remove quotes
1 parent 4aed708 commit 656af0c

13 files changed

Lines changed: 44 additions & 64 deletions

File tree

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ matrix:
1818
os: osx
1919
osx_image: xcode10.2
2020
language: shell
21+
env:
22+
- PIPFLAG="--user"
2123
before_install:
2224
- make build
2325
install:
24-
- pip3 install dist/*.whl
26+
- pip3 install dist/*.whl $PIPFLAG
2527
script:
2628
- make lint
2729
- make tests

examples/nativeMode/corrRNG/aliceTest.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@
2828
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

3030
import logging
31-
import os
3231

3332
from simulaqron.local.setup import setup_local
3433
from simulaqron.general.hostConfig import socketsConfig
35-
from simulaqron.toolbox import get_simulaqron_path
34+
from simulaqron.settings import simulaqron_settings
3635
from twisted.internet.defer import inlineCallbacks
3736
from twisted.internet import reactor
3837
from twisted.spread import pb
@@ -120,14 +119,13 @@ def main():
120119
myName = "Alice"
121120

122121
# This file defines the network of virtual quantum nodes
123-
simulaqron_path = get_simulaqron_path.main()
124-
virtualFile = os.path.join(simulaqron_path, "config/virtualNodes.cfg")
122+
network_file = simulaqron_settings.network_config_file
125123

126124
# This file defines the nodes acting as servers in the classical communication network
127125
classicalFile = "classicalNet.cfg"
128126

129127
# Read configuration files for the virtual quantum, as well as the classical network
130-
virtualNet = socketsConfig(virtualFile)
128+
virtualNet = socketsConfig(network_file)
131129
classicalNet = socketsConfig(classicalFile)
132130

133131
# Check if we should run a local classical server. If so, initialize the code

examples/nativeMode/corrRNG/bobTest.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@
2929

3030

3131
import logging
32-
import os
3332

3433
from simulaqron.local.setup import setup_local
3534
from simulaqron.general.hostConfig import socketsConfig
36-
from simulaqron.toolbox import get_simulaqron_path
35+
from simulaqron.settings import simulaqron_settings
3736
from twisted.internet.defer import inlineCallbacks
3837
from twisted.spread import pb
3938

@@ -129,14 +128,13 @@ def main():
129128
myName = "Bob"
130129

131130
# This file defines the network of virtual quantum nodes
132-
simulaqron_path = get_simulaqron_path.main()
133-
virtualFile = os.path.join(simulaqron_path, "config/virtualNodes.cfg")
131+
network_file = simulaqron_settings.network_config_file
134132

135133
# This file defines the nodes acting as servers in the classical communication network
136134
classicalFile = "classicalNet.cfg"
137135

138136
# Read configuration files for the virtual quantum, as well as the classical network
139-
virtualNet = socketsConfig(virtualFile)
137+
virtualNet = socketsConfig(network_file)
140138
classicalNet = socketsConfig(classicalFile)
141139

142140
# Check if we should run a local classical server. If so, initialize the code

examples/nativeMode/extendGHZ/aliceTest.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2828
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

30-
import logging
3130
import os
31+
import logging
3232

3333
from simulaqron.local.setup import setup_local
3434
from simulaqron.general.hostConfig import socketsConfig
35-
from simulaqron.toolbox import get_simulaqron_path
35+
from simulaqron.settings import simulaqron_settings
3636
from twisted.internet.defer import inlineCallbacks
3737
from twisted.spread import pb
3838
from twisted.internet import reactor
@@ -121,14 +121,13 @@ def main():
121121
myName = "Alice"
122122

123123
# This file defines the network of virtual quantum nodes
124-
simulaqron_path = get_simulaqron_path.main()
125-
virtualFile = os.path.join(simulaqron_path, "config/virtualNodes.cfg")
124+
network_file = simulaqron_settings.network_config_file
126125

127126
# This file defines the nodes acting as servers in the classical communication network
128127
classicalFile = os.path.join(os.path.dirname(__file__), "classicalNet.cfg")
129128

130129
# Read configuration files for the virtual quantum, as well as the classical network
131-
virtualNet = socketsConfig(virtualFile)
130+
virtualNet = socketsConfig(network_file)
132131
classicalNet = socketsConfig(classicalFile)
133132

134133
# Check if we should run a local classical server. If so, initialize the code

examples/nativeMode/extendGHZ/bobTest.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2828
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

30-
import logging
3130
import os
31+
import logging
3232

3333
from simulaqron.local.setup import setup_local
3434
from simulaqron.general.hostConfig import socketsConfig
35-
from simulaqron.toolbox import get_simulaqron_path
35+
from simulaqron.settings import simulaqron_settings
3636
from twisted.internet.defer import inlineCallbacks
3737
from twisted.spread import pb
3838

@@ -128,14 +128,13 @@ def main():
128128
myName = "Bob"
129129

130130
# This file defines the network of virtual quantum nodes
131-
simulaqron_path = get_simulaqron_path.main()
132-
virtualFile = os.path.join(simulaqron_path, "config/virtualNodes.cfg")
131+
network_file = simulaqron_settings.network_config_file
133132

134133
# This file defines the nodes acting as servers in the classical communication network
135134
classicalFile = os.path.join(os.path.dirname(__file__), "classicalNet.cfg")
136135

137136
# Read configuration files for the virtual quantum, as well as the classical network
138-
virtualNet = socketsConfig(virtualFile)
137+
virtualNet = socketsConfig(network_file)
139138
classicalNet = socketsConfig(classicalFile)
140139

141140
# Check if we should run a local classical server. If so, initialize the code

examples/nativeMode/extendGHZ/charlieTest.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2828
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

30-
import logging
3130
import os
31+
import logging
3232

3333
from simulaqron.local.setup import setup_local
3434
from simulaqron.general.hostConfig import socketsConfig
35-
from simulaqron.toolbox import get_simulaqron_path
35+
from simulaqron.settings import simulaqron_settings
3636
from twisted.internet.defer import inlineCallbacks
3737
from twisted.spread import pb
3838

@@ -114,14 +114,13 @@ def main():
114114
myName = "Charlie"
115115

116116
# This file defines the network of virtual quantum nodes
117-
simulaqron_path = get_simulaqron_path.main()
118-
virtualFile = os.path.join(simulaqron_path, "config/virtualNodes.cfg")
117+
network_file = simulaqron_settings.network_config_file
119118

120119
# This file defines the nodes acting as servers in the classical communication network
121120
classicalFile = os.path.join(os.path.dirname(__file__), "classicalNet.cfg")
122121

123122
# Read configuration files for the virtual quantum, as well as the classical network
124-
virtualNet = socketsConfig(virtualFile)
123+
virtualNet = socketsConfig(network_file)
125124
classicalNet = socketsConfig(classicalFile)
126125

127126
# Check if we should run a local classical server. If so, initialize the code

examples/nativeMode/graphState/aliceTest.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

3030

31-
import logging
3231
import os
32+
import logging
3333

3434
from simulaqron.local.setup import setup_local
3535
from simulaqron.general.hostConfig import socketsConfig
36-
from simulaqron.toolbox import get_simulaqron_path
36+
from simulaqron.settings import simulaqron_settings
3737
from twisted.internet.defer import inlineCallbacks
3838
from twisted.spread import pb
3939
from twisted.internet import reactor
@@ -138,14 +138,13 @@ def main():
138138
myName = "Alice"
139139

140140
# This file defines the network of virtual quantum nodes
141-
simulaqron_path = get_simulaqron_path.main()
142-
virtualFile = os.path.join(simulaqron_path, "config/virtualNodes.cfg")
141+
network_file = simulaqron_settings.network_config_file
143142

144143
# This file defines the nodes acting as servers in the classical communication network
145144
classicalFile = os.path.join(os.path.dirname(__file__), "classicalNet.cfg")
146145

147146
# Read configuration files for the virtual quantum, as well as the classical network
148-
virtualNet = socketsConfig(virtualFile)
147+
virtualNet = socketsConfig(network_file)
149148
classicalNet = socketsConfig(classicalFile)
150149

151150
# Check if we should run a local classical server. If so, initialize the code

examples/nativeMode/graphState/bobTest.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@
2828
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

3030

31-
import logging
3231
import os
33-
32+
import logging
3433
import numpy as np
3534

3635
from simulaqron.local.setup import setup_local
3736
from simulaqron.general.hostConfig import socketsConfig
38-
from simulaqron.toolbox import get_simulaqron_path
37+
from simulaqron.settings import simulaqron_settings
3938
from twisted.internet.defer import inlineCallbacks
4039
from twisted.spread import pb
4140

@@ -138,14 +137,13 @@ def main():
138137
myName = "Bob"
139138

140139
# This file defines the network of virtual quantum nodes
141-
simulaqron_path = get_simulaqron_path.main()
142-
virtualFile = os.path.join(simulaqron_path, "config/virtualNodes.cfg")
140+
network_file = simulaqron_settings.network_config_file
143141

144142
# This file defines the nodes acting as servers in the classical communication network
145143
classicalFile = os.path.join(os.path.dirname(__file__), "classicalNet.cfg")
146144

147145
# Read configuration files for the virtual quantum, as well as the classical network
148-
virtualNet = socketsConfig(virtualFile)
146+
virtualNet = socketsConfig(network_file)
149147
classicalNet = socketsConfig(classicalFile)
150148

151149
# Check if we should run a local classical server. If so, initialize the code

examples/nativeMode/graphState/charlieTest.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@
2828
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

3030

31-
import logging
3231
import os
33-
32+
import logging
3433
import numpy as np
3534

3635
from simulaqron.local.setup import setup_local
3736
from simulaqron.general.hostConfig import socketsConfig
38-
from simulaqron.toolbox import get_simulaqron_path
37+
from simulaqron.settings import simulaqron_settings
3938
from twisted.internet.defer import inlineCallbacks
4039
from twisted.spread import pb
4140

@@ -169,14 +168,13 @@ def main():
169168
myName = "Charlie"
170169

171170
# This file defines the network of virtual quantum nodes
172-
simulaqron_path = get_simulaqron_path.main()
173-
virtualFile = os.path.join(simulaqron_path, "config/virtualNodes.cfg")
171+
network_file = simulaqron_settings.network_config_file
174172

175173
# This file defines the nodes acting as servers in the classical communication network
176174
classicalFile = os.path.join(os.path.dirname(__file__), "classicalNet.cfg")
177175

178176
# Read configuration files for the virtual quantum, as well as the classical network
179-
virtualNet = socketsConfig(virtualFile)
177+
virtualNet = socketsConfig(network_file)
180178
classicalNet = socketsConfig(classicalFile)
181179

182180
# Check if we should run a local classical server. If so, initialize the code

examples/nativeMode/graphState/davidTest.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@
2828
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

3030

31-
import logging
3231
import os
33-
32+
import logging
3433
import numpy as np
3534

3635
from simulaqron.local.setup import setup_local
3736
from simulaqron.general.hostConfig import socketsConfig
38-
from simulaqron.toolbox import get_simulaqron_path
37+
from simulaqron.settings import simulaqron_settings
3938
from twisted.internet.defer import inlineCallbacks
4039
from twisted.spread import pb
4140

@@ -144,14 +143,13 @@ def main():
144143
myName = "David"
145144

146145
# This file defines the network of virtual quantum nodes
147-
simulaqron_path = get_simulaqron_path.main()
148-
virtualFile = os.path.join(simulaqron_path, "config/virtualNodes.cfg")
146+
network_file = simulaqron_settings.network_config_file
149147

150148
# This file defines the nodes acting as servers in the classical communication network
151149
classicalFile = os.path.join(os.path.dirname(__file__), "classicalNet.cfg")
152150

153151
# Read configuration files for the virtual quantum, as well as the classical network
154-
virtualNet = socketsConfig(virtualFile)
152+
virtualNet = socketsConfig(network_file)
155153
classicalNet = socketsConfig(classicalFile)
156154

157155
# Check if we should run a local classical server. If so, initialize the code

0 commit comments

Comments
 (0)