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

Same changes made to original branch except no manual documentation g… #919

Merged
merged 3 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,34 @@ jobs:
run: python -m pip install -U tox setuptools virtualenv wheel
- name: Install and Run Tests
run: tox -e py
# windows-tests:
# name: tests-python${{ matrix.python-version }}-windows
# runs-on: windows-latest
# strategy:
# matrix:
# python-version: ["3.9", "3.10"]
# steps:
# - uses: actions/checkout@v3
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Pip cache
# uses: actions/cache@v3
# with:
# path: ~\AppData\Local\pip\Cache
# key: ${{ runner.os }}-${{ matrix.python-version }}-pip-tests-${{ hashFiles('setup.py','requirements-dev.txt','requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-${{ matrix.python-version }}-pip-tests-
# ${{ runner.os }}-${{ matrix.python-version }}-pip-
# ${{ runner.os }}-${{ matrix.python-version }}-
# - name: Install deps
# run: |
# python -m pip install -U tox cvxopt setuptools virtualenv wheel
# shell: pwsh
# - name: Install and Run Tests
# run: tox --sitepackages -e py
# shell: bash -l {0}
windows-tests:
name: tests-python${{ matrix.python-version }}-windows
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Pip cache
uses: actions/cache@v3
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-tests-${{ hashFiles('setup.py','requirements-dev.txt','requirements.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-tests-
${{ runner.os }}-${{ matrix.python-version }}-pip-
${{ runner.os }}-${{ matrix.python-version }}-
- name: Install deps
run: |
python -m pip install -U tox cvxopt setuptools virtualenv wheel
shell: pwsh
- name: Install and Run Tests
run: tox --sitepackages -e py
shell: bash -l {0}
lint:
name: lint
runs-on: ubuntu-latest
Expand Down
21 changes: 11 additions & 10 deletions qiskit_metal/tests/test_toolbox_metal.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,19 @@ def test_toolbox_metal_open_docs(self):
except Exception:
self.fail("open_docs() failed")

def test_toolbox_metal_orient_me(self):
# def test_toolbox_metal_orient_me(self):
"""Test that orient_me in about.py produces detailed information about the user without any
errors."""
try:
about.orient_me(True)
except Exception:
self.fail("orient_me() failed")
try:
about.orient_me(False)
except Exception:
self.fail("orient_me() failed")


# try:
# about.orient_me(True)
# except Exception:
# self.fail("orient_me() failed")
# try:
# about.orient_me(False)
# except Exception:
# self.fail("orient_me() failed")

def test_toolbox_metal_get_platform_info(self):
"""Test that get_platform_info in about.py returns a string with the platform information without any errors."""
Expand Down Expand Up @@ -856,6 +858,5 @@ def test_toolbox_metal_layer_stack_handler_pilot_error(self):
multiplanar_design,
(ls_file_path, None)).layer_stack_handler_pilot_error(), None)


if __name__ == '__main__':
unittest.main(verbosity=2)
43 changes: 21 additions & 22 deletions qiskit_metal/toolbox_metal/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,36 +115,35 @@ def open_docs(page='https://qiskit.org/documentation/metal/'):
"""
webbrowser.open(page, new=1)

######################################################################################
# More detailed information to orient a user.
# For debug purposes.
# Main function: ``orient_me```

######################################################################################
# More detailed information to orient a user.
# For debug purposes.
# Main function: ``orient_me```


def orient_me(do_print: bool = True) -> Union[None, str]:
#def orient_me(do_print: bool = True) -> Union[None, str]:
"""Full system, python, user, and environemnt information.

Args:
do_print(bool): Return the string if True, else format and print.
"""

text = get_platform_info()
text += \
f" User and directories:\n\n"\
f" User : {getpass.getuser()}\n"\
f" User home dirctry : {Path.home()}\n"\
f" Current directory : {Path.cwd()}\n\n"\
f" Conda default env : {os.environ.get('CONDA_DEFAULT_ENV', 'N/A')}\n"\
f" Conda current env : {os.environ.get('CONDA_PREFIX', 'N/A')}\n"\
f" Python executable : {sys.executable}\n"\

if do_print:
text = style_colon_list(text, Color.BOLD, Color.END)
print(text)
return None

return text
# text = get_platform_info()
# text += \
# f" User and directories:\n\n"\
# f" User : {getpass.getuser()}\n"\
# f" User home dirctry : {Path.home()}\n"\
# f" Current directory : {Path.cwd()}\n\n"\
# f" Conda default env : {os.environ.get('CONDA_DEFAULT_ENV', 'N/A')}\n"\
# f" Conda current env : {os.environ.get('CONDA_PREFIX', 'N/A')}\n"\
# f" Python executable : {sys.executable}\n"\

# if do_print:
# text = style_colon_list(text, Color.BOLD, Color.END)
# print(text)
# return None

# return text


def get_platform_info() -> str:
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
addict
descartes
gdspy>=1.5.2
geopandas; platform_system != "Windows" #pip install geopandas causes fiona errors. Therefore, if you use `conda env`, you must first run `conda install fiona`, while if you use `python venv` you must first download the gdal and fiona wheels from https://www.lfd.uci.edu/~gohlke/pythonlibs/ and manually pip install them in that order.
geopandas
ipython
matplotlib
numpy
Expand All @@ -16,5 +16,5 @@ scipy
shapely
scqubits
gmsh
pyaedt #since conda-forge doesn't have pyaedt, we have to manually pip install or completely switch to virtualenv . virtualenv uses less memory than conda.
pyaedt #since conda-forge doesn't have pyaedt, we have to manually pip install or completely switch to virtualenv . virtualenv uses less memory than conda.
# jupyter (if you need a fresh install) or ipykernel (if you prefer to make of this a new kernel to use from an existing jupyter install)