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

Generation won't work with python >= 3.10 #8

Open
fblanchetNaN opened this issue Aug 1, 2022 · 4 comments
Open

Generation won't work with python >= 3.10 #8

fblanchetNaN opened this issue Aug 1, 2022 · 4 comments

Comments

@fblanchetNaN
Copy link

fblanchetNaN commented Aug 1, 2022

Due to:

https://docs.python.org/3/whatsnew/3.3.html#collections
https://docs.python.org/3/whatsnew/3.10.html#removed

dB cannot be generated from python 3.10

ImportError: cannot import name 'Iterator' from 'collections'

@fblanchetNaN fblanchetNaN changed the title Deprecated code Generation won't work with python >= 3.10 Aug 1, 2022
@jenshnielsen
Copy link
Contributor

Thanks @fblanchetNaN

This is indeed an issue. The versions of qcodes that were used to do this predatates that issue as well as several others. We have pre-generated all the existing dbs and I hope that we will not need to regenerate them

If one really needs to do this it is possible to make a patch release to the old versions of qcodes and make a patch release to support this. There may be other similar issues (e.g. that old versions of qcodes are tested against versions of numpy that predates support for python 3.10 so there may also be a need to adapt to new versions of numpy etc )

@fblanchetNaN
Copy link
Author

fblanchetNaN commented Aug 2, 2022

Actually I face that issue because I need DB to figure out why the qcodes CI failed on a PR and not locally. I think it will not be an issue if you generate some artifacts (and redirect to them in tests needed them (*)) containing DB for testing instead of just providing a code to generate them that can be outdated.

A solution can be to explicitly document which python versions should be used for each DB version, or to write a script using pyenv and pip to force generation with specific versions of python and dependencies.

(*) On a fresh installation, pytest -rsx says:
SKIPPED [...] No db-file fixtures found. You can generate test db-files using the scripts in the https://github.com/QCoDeS/qcodes_generate_test_db/

@jenshnielsen
Copy link
Contributor

Actually I face that issue because I need DB to figure out why the qcodes CI failed on a PR and not locally. I think it will not be an issue if you generate some artifacts (and redirect to them in tests needed them (*)) containing DB for testing instead of just providing a code to generate them that can be outdated.

That is more or less what we do. The fixtures are here https://github.com/QCoDeS/qcodes_db_fixtures they are added as a git submodule of qcodes

(*) On a fresh installation, pytest -rsx says:
SKIPPED [...] No db-file fixtures found. You can generate test db-files using the scripts in the https://github.com/QCoDeS/qcodes_generate_test_db/

As far as I remember there is one test that tries to upgrade from the current version to current version + 1 which is always skipped. That should probably be fixed

@fblanchetNaN
Copy link
Author

That is more or less what we do. The fixtures are here https://github.com/QCoDeS/qcodes_db_fixtures they are added as a git submodule of qcodes

I saw that module, but maybe the message
No db-file fixtures found. You can generate test db-files using the scripts in the https://github.com/QCoDeS/qcodes_generate_test_db/
Should refer to that repo and recommends doing a git submodule update --init

And https://github.com/QCoDeS/Qcodes/blob/master/CONTRIBUTING.rst should recommend doing a clone with --recurse-submodules.

bors bot added a commit to microsoft/Qcodes that referenced this issue Aug 3, 2022
4455: Improve instructions for db-file fixtures r=jenshnielsen a=fblanchetNaN

<!--

Thanks for submitting a pull request against QCoDeS.

To help us effectively merge your pr please consider the following check list.

- [ ] Make sure that the pull request contains a short description of the changes made.
- [ ] If you are submitting a new feature please document it. This can be in the form of inline
      docstrings, an example notebook or restructured text files.
- [ ] Please include automatic tests for the changes made when possible.

Unless your change is a small or trivial fix please add a small changelog entry:

- [ ] Create a file in the docs\changes\newsfragments folder with a short description of the change.

This file should be in the format number.categoryofcontribution. Here the number should either be the number
of the pull request. To get the number of the pull request one must
first the pull request and then subsequently update the number. The category of contribution should be
one of ``breaking``, ``new``, ``improved``, ``new_driver`` ``improved_driver``, ``underthehood``.

If this fixes a known bug reported against QCoDeS:

- [ ] Please include a string in the following form ``closes #xxx`` where ``xxx``` is the number of the bug fixed.

Please have a look at [the contributing guide](https://qcodes.github.io/Qcodes/community/contributing.html)
for more information.

If you are in doubt about any of this please ask and we will be happy to help.

-->

Improve `pytest.skip` messages when db-file are missing to point out at submodule qcodes_db_fixtures.

Explicitly recommend cloning with submodules, include the `git clone` command and options in the documentation.

Fix related error 404 in CONTRIBUTING.rst.

See QCoDeS/qcodes_generate_test_db#8

Co-authored-by: Jens H. Nielsen <Jens.Nielsen@microsoft.com>
Co-authored-by: Florian Blanchet <florian.blanchet@aalto.fi>
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

No branches or pull requests

2 participants