8000 Do Python version check in init by nonhermitian · Pull Request #349 · Qiskit/qiskit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Do Python version check in init #349

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

Merged
merged 3 commits into from
Mar 19, 2018
Merged

Do Python version check in init #349

merged 3 commits into from
Mar 19, 2018

Conversation

nonhermitian
Copy link
Contributor

Check Python version in init as done by NumPy and SciPy for equivalent checks.

Description

Do Python version check at import, as opposed to a manual assert (as done in the tutorials).

Motivation and Context

Having a manual assert in the tutorials is silly. Checks in tutorials can be removed after commit.

How Has This Been Tested?

I ran it.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

This does the Python version check in a similar manner as NumPy and SciPy equivilent checks.
@ajavadia
Copy link
Member

@nonhermitian thanks Paul. There are some linter errors, mainly having to do with putting code above the imports. Maybe it is better to put this check in qiskit/_util.py, since that already has a check for the API version in it. Then include a reference to it at the bottom of __init.py__.

@nonhermitian
Copy link
Contributor Author

Surely you would like to do the check before doing the actual imports, A la SciPy __init__? Why load something if the versions are not correct. There may be issues that raise exceptions before one even gets to the bottom of the __init__ .

@nonhermitian
Copy link
Contributor Author

It seems that wrong-import-order is already disabled for pylint. Why not add wrong-import-position to the list and do the check first?

@ajavadia
Copy link
Member

Ok, that works. The same argument can be applied to check_ibmqe_version, which importing QuantumProgram depends on.

@ajavadia
Copy link
Member

Thanks!

@ajavadia ajavadia merged commit 7077653 into Qiskit:master Mar 19, 2018
@nonhermitian nonhermitian deleted the check_pyver_init branch March 22, 2018 01:58
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
* Do Python version check in init

This does the Python version check in a similar manner as NumPy and SciPy equivilent checks.

* Fix pylint issues

* Pylint 10/10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0