-
Notifications
You must be signed in to change notification settings - Fork 724
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 python3 #332
Support for python3 #332
Changes from all commits
bbffc66
04a7aaf
f49ec46
be99db5
2b85c87
9e97aec
c9fd574
03af47c
76b3b18
00f6792
a32c3fd
dfed5ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
# Caches | ||
# Caches, build artifacts | ||
.DS_Store | ||
.cache/ | ||
*.egg* | ||
.gradle/ | ||
.idea/ | ||
*.py[cod] | ||
.pypirc | ||
.tox/ | ||
.*version | ||
.venv*/ | ||
__pycache__/ | ||
|
||
# Build artifacts | ||
activate | ||
build/ | ||
|
||
# Code coverage reports | ||
.coverage* | ||
coverage.xml | ||
htmlcov/ | ||
|
||
*.egg-info | ||
*.pyc | ||
dist/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
language: python | ||
python: | ||
- "2.7" | ||
- "3.6" | ||
|
||
before_install: | ||
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y | ||
- sudo apt-get update -qq | ||
- sudo apt-get install -qq g++-4.8 | ||
- export CXX="g++-4.8" CC="gcc-4.8" | ||
- sudo apt-get install git | ||
|
||
install: | ||
- pip install --upgrade pip | ||
- pip install --upgrade numpy scipy matplotlib pandas | ||
- pip install --upgrade scikit-learn scikit-image | ||
- pip install --upgrade h5py | ||
- pip install --upgrade sureal | ||
- pip install tox-travis | ||
|
||
script: | ||
- make | ||
- sudo make install | ||
- make testlib | ||
- export PYTHONPATH=$PWD/python/src:$PYTHONPATH | ||
- python -m unittest discover -s python/test -p '*_test.py' | ||
- python -m unittest discover -s python/test/lib -p '*_libtest.py' | ||
- tox -c python/ -- -v -p no:warnings -m 'main or lib' --doctest-modules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
*.pyc | ||
externals.py | ||
.pypirc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Notes on python2 / python3 support | ||
|
||
A `tox.ini` was added to help provide support for python3. Before running tests using tox, be sure to first run `make` under the root directory. | ||
|
||
First draft allows to do this: | ||
|
||
- python 3: | ||
- `tox -e venv`, to get a python3 venv in `./.venv` | ||
- `tox -e py37` to exercise all tests with python 3.7 | ||
- python 2: | ||
- `tox -e venv2`, to get a python2 venv in `./.venv2` | ||
- `tox -e py27` to exercise all tests with python 2.7 | ||
- you can also run `tox` to exercise all tests with both python 2.7 and 3.7 | ||
|
||
|
||
# Support for python3 status | ||
|
||
Search for `TODO python3` to spot which places in code still need attention regarding python3 support. | ||
|
||
All tests pass with both python2 and python3, however, a few test cases are disabled currently for python3, spot then with: | ||
|
||
```bash | ||
grep -r 'reason="TODO python3' . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Search for |
||
``` | ||
|
||
Here's the current list: | ||
|
||
- `scipy` v1.3.0 removed some deprecated functions tha vmaf still uses -> need to adapt those before we can upgrade to latest scipy | ||
- tests that rely on `random` do not yield the same results in python2 and python3 | ||
- vmaf uses `pickle` to serialize some objects, however "pickle is fickle", and a few objects fail to deserialize in python3 | ||
- `YuvReader` needs to be reviewed, it doesn't work in python3 | ||
- `map()` and `filter()` yield a generator (instead of list) in python3 -> this implies an extra call `to_list()` throughout the code | ||
(search for `to_list` to find all the spots where this is done). | ||
All usages of `map()`/`filter()` should be reviewed to leverage the speed generators offer | ||
|
||
|
||
# Test coverage | ||
|
||
If you run `tox`, a summary test coverage report will be shown in terminal, | ||
you can also see a full HTML report by looking at `.tox/coverage/index.html`. | ||
|
||
This report can be useful to spot any key part of the code that was not exercised (and thus possibly likely to fail under python3) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
VMAF - Video Multimethod Assessment Fusion | ||
========================================== | ||
|
||
.. image:: https://travis-ci.org/Netflix/vmaf.svg?branch=master | ||
:target: https://travis-ci.org/Netflix/vmaf | ||
:alt: Travis Build Status | ||
|
||
.. image:: https://ci.appveyor.com/api/projects/status/68i57b8ssasttngg?svg=true | ||
:target: https://ci.appveyor.com/project/li-zhi/vmaf | ||
:alt: AppVeyor Build Status | ||
|
||
VMAF is a perceptual video quality assessment algorithm developed by Netflix. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a placeholder README, there was no README before in this folder, I added one to make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. |
||
|
||
VMAF Development Kit (VDK) is a software package that contains the VMAF algorithm implementation, | ||
as well as a set of tools that allows a user to train and test a custom VMAF model. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
numpy | ||
# TODO python3: scipy 1.3.0 removed some previously deprecated functions, still used by vmaf | ||
scipy>=0.17.1,<1.3.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This makes it so that vmaf picks up scipy 1.2.1 (because that's the latest version it can pick up...), but python3 ends up getting 1.3.0, where they dropped some previously deprecated functions. |
||
matplotlib>=2.0.0 | ||
pandas>=0.19.2 | ||
scikit-learn>=0.18.1 | ||
scikit-image>=0.13.1 | ||
h5py>=2.6.0 | ||
sureal>=0.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis now exercises tests under both 2.7 and 3.6
All tests pass like before this change under 2.7
Under 3.6, a few tests are currently skipped because I'm not sure how to fix them
So end result after this commit should be: