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

Support for Python 3.9 #1197

Merged
merged 33 commits into from
Dec 18, 2020
Merged

Conversation

shagunsodhani
Copy link
Contributor

Motivation

Support for Python 3.9

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

CI

Related Issues and PRs

(Is this PR part of a group of changes? Link the other relevant PRs and Issues here. Use https://help.github.com/en/articles/closing-issues-using-keywords for help on GitHub syntax)

#1062

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 11, 2020
@shagunsodhani shagunsodhani marked this pull request as draft December 11, 2020 19:58
@shagunsodhani
Copy link
Contributor Author

shagunsodhani commented Dec 12, 2020

Code changes:

  1. importlib_resources is not available in Python 3.9 and we switch to importlib.resources. Relevant change

  2. In Python 3.9, traceback displays the absolute path for __main__ module frames. This breaks some tests where we match the stack trace of the error. For example

Stack trace with Python < 3.9

...
"File "my_app.py", line 13, in my_app" 
...

Stack trace with Python 3.9

...
"File "/private/home/sodhani/projects/hydra/tests/test_apps/app_with_runtime_config_error/my_app.py", line 13, in my_app"
...

We have added a function to perform regex-like match on the stack trace.

Questions

  1. Supporting windows: We havent supported windows since 3.7. I tried enabling support for 3.9 but ran into a bunch of errors. What is the stance on support for windows + Python 3.9

  2. How do we go about updating the plugins? I can update the setup.py for all of them in this PR or make n other PRs.

@shagunsodhani shagunsodhani marked this pull request as ready for review December 12, 2020 00:12
@shagunsodhani shagunsodhani requested review from omry and jieru-hu and removed request for omry December 12, 2020 00:12
@shagunsodhani
Copy link
Contributor Author

One more question: I had to bump hydra version in setup.py of discovery test plugin. I understand why it should be bumped. I am not sure why did this not throw an error earlier (since we have been on Hydra 1.1* for some time now).

@omry
Copy link
Collaborator

omry commented Dec 12, 2020

  1. Try to enable windows support before landing this:
    I disabled it in Re-enable CI for Windows #1056 due to some issues mentioned in there.

  2. plugins:
    You can add Python 3.9 testing for all plugins as a part of this PR. If any of them is causing issue you can create a separate issue to track it.

  3. discovery test:
    dunno why it worked before. I think you can just require hydra-core without a version (it should be installed from the repo anyway).

Copy link
Collaborator

@omry omry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice.
a few comments and see my answer to your questions.

tests/standalone_apps/discovery_test_plugin/setup.py Outdated Show resolved Hide resolved
tests/test_hydra.py Show resolved Hide resolved
@shagunsodhani
Copy link
Contributor Author

  1. Try to enable windows support before landing this:
    I disabled it in Re-enable CI for Windows #1056 due to some issues mentioned in there.

The suggested fix there is to use older version of virtualenv (== 20.0.33) which was released one day before python 3.9 :(

@omry
Copy link
Collaborator

omry commented Dec 12, 2020

  1. Try to enable windows support before landing this:
    I disabled it in Re-enable CI for Windows #1056 due to some issues mentioned in there.

The suggested fix there is to use older version of virtualenv (== 20.0.33) which was released one day before python 3.9 :(

Is pinning virtualenv to 20.0.33 for now a viable solution until conda and virtualenv figure out their shit?
If now, we may try to skip conda on Windows and install directly in a virtualenv on circle.

.circleci/config.yml Show resolved Hide resolved
.circleci/config.yml Show resolved Hide resolved
hydra/test_utils/test_utils.py Show resolved Hide resolved
noxfile.py Outdated Show resolved Hide resolved
@shagunsodhani
Copy link
Contributor Author

Is pinning virtualenv to 20.0.33 for now a viable solution until conda and virtualenv figure out their shit?
If now, we may try to skip conda on Windows and install directly in a virtualenv on circle.

I mean that python 3.9 does not virtualenv==20.0.33. Can try direct installation on virtualenv

@omry
Copy link
Collaborator

omry commented Dec 12, 2020

Is pinning virtualenv to 20.0.33 for now a viable solution until conda and virtualenv figure out their shit?
If now, we may try to skip conda on Windows and install directly in a virtualenv on circle.

I mean that python 3.9 does not virtualenv==20.0.33. Can try direct installation on virtualenv

What does that mean?

@shagunsodhani
Copy link
Contributor Author

Force pushed to rebase

Copy link
Collaborator

@omry omry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, please clean up your comments.

hydra/test_utils/test_utils.py Show resolved Hide resolved
plugins/hydra_nevergrad_sweeper/setup.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@omry omry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@shagunsodhani shagunsodhani merged commit 93eea6d into facebookresearch:master Dec 18, 2020
shagunsodhani added a commit to shagunsodhani/hydra that referenced this pull request Dec 18, 2020
* Fix importlib error when using py3.9

* Fix lint errors

* Add a method to match lines based on regex

* fix lint error

* bump hydra version in discovery test plugin

* Add python 3.9 in setup.py

* Skip python 3.9 tests on windows

* use assert_text_same when lengths of actual and expected output do not match

* Remove dependency on hydra version

* Check python version to decide if importlib_resources should be imported

* Update the install script for plugins to reflect support for python 3.9

* pin virtualenv to 20.0.33 for windows

* Fix lint error

* Enable CI for 3.9 on windows

* Update circle ci config

* Update circle ci config

* Fix issues with windows

* Skip Ray test for Python 3.9

* Incorporate feedback

* Fix circleci config

* Fix lint errors

* Fix circleci config

* Fix some ci errors

* Fix lint error

* Fix lint error

* Update setup.py for some plugins

* Disable windows 9 support

* Ax plugin doesnt support 3.9 for now

* Nevergrad python 3.9 support depends on Scikit-learn

* Add news entries

* Accidentally removed support for optuna on windows

* Incorporate feedback

* Disable windows test for optuna
shagunsodhani added a commit to shagunsodhani/hydra that referenced this pull request Dec 18, 2020
* Fix importlib error when using py3.9

* Fix lint errors

* Add a method to match lines based on regex

* fix lint error

* bump hydra version in discovery test plugin

* Add python 3.9 in setup.py

* Skip python 3.9 tests on windows

* use assert_text_same when lengths of actual and expected output do not match

* Remove dependency on hydra version

* Check python version to decide if importlib_resources should be imported

* Update the install script for plugins to reflect support for python 3.9

* pin virtualenv to 20.0.33 for windows

* Fix lint error

* Enable CI for 3.9 on windows

* Update circle ci config

* Update circle ci config

* Fix issues with windows

* Skip Ray test for Python 3.9

* Incorporate feedback

* Fix circleci config

* Fix lint errors

* Fix circleci config

* Fix some ci errors

* Fix lint error

* Fix lint error

* Update setup.py for some plugins

* Disable windows 9 support

* Ax plugin doesnt support 3.9 for now

* Nevergrad python 3.9 support depends on Scikit-learn

* Add news entries

* Accidentally removed support for optuna on windows

* Incorporate feedback

* Disable windows test for optuna
shagunsodhani added a commit that referenced this pull request Dec 19, 2020
* Support for Python 3.9 (#1197)

* Fix importlib error when using py3.9

* Fix lint errors

* Add a method to match lines based on regex

* fix lint error

* bump hydra version in discovery test plugin

* Add python 3.9 in setup.py

* Skip python 3.9 tests on windows

* use assert_text_same when lengths of actual and expected output do not match

* Remove dependency on hydra version

* Check python version to decide if importlib_resources should be imported

* Update the install script for plugins to reflect support for python 3.9

* pin virtualenv to 20.0.33 for windows

* Fix lint error

* Enable CI for 3.9 on windows

* Update circle ci config

* Update circle ci config

* Fix issues with windows

* Skip Ray test for Python 3.9

* Incorporate feedback

* Fix circleci config

* Fix lint errors

* Fix circleci config

* Fix some ci errors

* Fix lint error

* Fix lint error

* Update setup.py for some plugins

* Disable windows 9 support

* Ax plugin doesnt support 3.9 for now

* Nevergrad python 3.9 support depends on Scikit-learn

* Add news entries

* Accidentally removed support for optuna on windows

* Incorporate feedback

* Disable windows test for optuna

* Remove some commented statements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants