Skip to content

Travis setup #86

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 37 commits into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
705b960
setup Travis-CI by adding a .travis.yml file. Add pytest to requireme…
leotrs May 24, 2020
67b88aa
add pytest to setup
leotrs May 24, 2020
da9d4a8
fix: remove trailing comma
leotrs May 24, 2020
6077328
Remove windows from the build matrix, as Travis-CI does not currently…
leotrs May 24, 2020
032c097
remove macOS from the build matrix as it is not currently supported b…
leotrs May 24, 2020
ceb6a1d
try a better build matrix
leotrs May 24, 2020
66d24c6
keep trying on macOS
leotrs May 24, 2020
3ec1bd7
fix the build matrix (the os section was triggering unnecessary build…
leotrs May 24, 2020
60c9235
fix: apparently, rich does not support python 3.8.3 yet, but it does …
leotrs May 24, 2020
8706817
Test new travis job matrix (with Windows too)
safinsingh May 24, 2020
e4ecc2f
use the right branch
safinsingh May 24, 2020
cda168a
Rename linux to mac in build config
safinsingh May 24, 2020
786031e
Add refreshenv to windows
safinsingh May 24, 2020
cc5dd14
try python version 3.8.0, as rich does not seem to support it
leotrs May 24, 2020
2572a01
specify both the python version and the destination folder
leotrs May 24, 2020
f7c7cef
travis environment variables go on the same line
leotrs May 24, 2020
f8fa823
try with pip3
leotrs May 24, 2020
409f702
here goes nothing
leotrs May 24, 2020
2b69de1
Try using pip from python
eulertour May 25, 2020
8afc7d2
It didn't work
eulertour May 25, 2020
facbcaa
update PATH
safinsingh May 25, 2020
d28dfca
Add user option to pip
safinsingh May 25, 2020
791a672
Well that broke it
safinsingh May 25, 2020
2ce0ffa
Add python -m on windows
safinsingh May 25, 2020
6c8a475
try to make cairo work with windoze??
safinsingh May 25, 2020
44b200f
Clarify lines and fix windows installs
safinsingh May 25, 2020
4338520
Remove double build
safinsingh May 25, 2020
e08c1c8
Refresh env vars after pytest install (win)
safinsingh May 25, 2020
f9bb278
Add python -m for windows pytest
safinsingh May 25, 2020
7221634
Try to fix opencv + ffmpeg on win
safinsingh May 25, 2020
3c0643a
Remove OpenCV completely
safinsingh May 25, 2020
eb4819e
Merge branch 'master' into travis-setup
safinsingh May 25, 2020
e9b02b3
Remove .imports
safinsingh May 25, 2020
acbd4eb
One more import
safinsingh May 25, 2020
ab9ac29
Add build badge to readme [skip ci]
safinsingh May 25, 2020
963d66e
Housekeeping & pytest dev-only req [skip-ci]
safinsingh May 25, 2020
af53017
Test master [skip ci]
safinsingh May 25, 2020
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
135 changes: 135 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
jobs:
include:
# Linux Jobs
- os: linux
language: python
python: 3.6
install:
- pip3 install --upgrade pip
- pip3 install -r ./.travis/travis-requirements.txt
- pip3 install pycairo pytest
- pip3 install .
script:
- pytest

- os: linux
language: python
python: 3.7
install:
- pip3 install --upgrade pip
- pip3 install -r ./.travis/travis-requirements.txt
- pip3 install pycairo pytest
- pip3 install .
script:
- pytest

- os: linux
language: python
python: 3.8
install:
- pip3 install --upgrade pip
- pip3 install -r ./.travis/travis-requirements.txt
- pip3 install pycairo pytest
- pip3 install .
script:
- pytest

# MacOS (OSX) Jobs
- os: osx
language: sh
python: 3.6
env: PYVER="3.6.10"
install:
- pip3 install --upgrade pip
- pip3 install -r ./.travis/travis-requirements.txt
- pip3 install pycairo pytest
- pip3 install .
script:
- pytest

- os: osx
language: sh
python: 3.7
env: PYVER="3.7.7"
install:
- pip3 install --upgrade pip
- pip3 install -r ./.travis/travis-requirements.txt
- pip3 install pycairo pytest
- pip3 install .
script:
- pytest

- os: osx
language: sh
python: 3.8
env: PYVER="3.8.0" # Using Python 3.8.0 due to error with rich
install:
- pip3 install --upgrade pip
- pip3 install -r ./.travis/travis-requirements.txt
- pip3 install pycairo pytest
- pip3 install .
script:
- pytest

# Windows Jobs
- os: windows
language: sh
python: 3.6
# the latest version available on chocolatey is 3.6.8
env: PYVER="3.6.8" PYDIR="Python36"
install:
- choco install python --version=$PYVER
- export PATH="/c/$PYDIR:/c/$PYDIR/Scripts:$PATH"
- choco install ffmpeg
- cmd.exe //c "RefreshEnv.cmd"
- python -m pip install --upgrade pip
- python -m pip install --user -r ./.travis/travis-requirements.txt
- python ./.travis/cairo-windows.py
- cmd.exe //c "RefreshEnv.cmd"
- python -m pip install --user .
script:
- python -m pytest

- os: windows
language: sh
python: 3.7
env: PYVER="3.7.7" PYDIR="Python37"
install:
- choco install python --version=$PYVER
- export PATH="/c/$PYDIR:/c/$PYDIR/Scripts:$PATH"
- choco install ffmpeg
- cmd.exe //c "RefreshEnv.cmd"
- python -m pip install --upgrade pip
- python -m pip install --user -r ./.travis/travis-requirements.txt
- python ./.travis/cairo-windows.py
- cmd.exe //c "RefreshEnv.cmd"
- python -m pip install --user .
script:
- python -m pytest

- os: windows
language: sh
python: 3.8
env: PYVER="3.8.0" PYDIR="Python38" # Using Python 3.8.0 due to error with rich
install:
- choco install python --version=$PYVER
- export PATH="/c/$PYDIR:/c/$PYDIR/Scripts:$PATH"
- choco install ffmpeg
- cmd.exe //c "RefreshEnv.cmd"
- python -m pip install --upgrade pip
- python -m pip install --user -r ./.travis/travis-requirements.txt
- python ./.travis/cairo-windows.py
- cmd.exe //c "RefreshEnv.cmd"
- python -m pip install --user .
script:
- python -m pytest

before_install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then chmod +x ./.travis/osx.sh; sh ./.travis/osx.sh; fi

branches:
only:
- master

notifications:
email: false
51 changes: 51 additions & 0 deletions .travis/cairo-windows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import platform
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the same script as in #71? If so, please make sure to use that script once #71 is merged, because when it does, this script will be in two different places.

import os
import sys
import urllib.request

if 'Windows' in platform.system():
#In case the python version is 3.6 and the system is 32-bit, try pycairo‑1.19.1‑cp37‑cp37m‑win32.whl version of cairo
if sys.version[:3]=='3.6' and platform.machine()=='x86':
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/pycairo-1.19.1-cp36-cp36m-win32.whl", "pycairo-1.19.1-cp36-cp36m-win32.whl")
os.system("pip install pycairo-1.19.1-cp36-cp36m-win32.whl")
os.remove("pycairo-1.19.1-cp37-cp37m-win32.whl")

#In case the python version is 3.6 and the system is 64-bit, try pycairo‑1.19.1‑cp37‑cp37m‑win32.whl version of cairo
elif sys.version[:3]=='3.6' and platform.machine()=='AMD64':
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/pycairo-1.19.1-cp36-cp36m-win_amd64.whl", "pycairo-1.19.1-cp36-cp36m-win_amd64.whl")
print("Sucessfully downloaded Cairo for your system")
print("Installing Cairo")
os.system("pip install pycairo-1.19.1-cp36-cp36m-win_amd64.whl")
os.remove("pycairo-1.19.1-cp36-cp36m-win_amd64.whl")

#In case the python version is 3.7 and the system is 32-bit, try pycairo‑1.19.1‑cp37‑cp37m‑win32.whl version of cairo
if sys.version[:3]=='3.7' and platform.machine()=='x86':
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/pycairo-1.19.1-cp37-cp37m-win32.whl", "pycairo-1.19.1-cp37-cp37m-win32.whl")
print("Sucessfully downloaded Cairo for your system")
print("Installing Cairo")
os.system("pip install pycairo-1.19.1-cp37-cp37m-win32.whl")
os.remove("pycairo-1.19.1-cp37-cp37m-win32.whl")

#In case the python version is 3.7 and the system is AMD64, try pycairo-1.19.1-cp37-cp37m-win_amd64.whl version of cairo
elif sys.version[:3]=='3.7' and platform.machine()=='AMD64':
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/pycairo-1.19.1-cp37-cp37m-win_amd64.whl", "pycairo-1.19.1-cp37-cp37m-win_amd64.whl")
print("Sucessfully downloaded Cairo for your system")
print("Installing Cairo")
os.system("pip install pycairo-1.19.1-cp37-cp37m-win_amd64.whl")
os.remove("pycairo-1.19.1-cp37-cp37m-win_amd64.whl")

#In case the python version is 3.8 and the system is 32-bit, try pycairo-1.19.1-cp38-cp38-win32.whl version of cairo
elif sys.version[:3]=='3.8' and platform.machine()=='x86':
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/pycairo-1.19.1-cp38-cp38-win32.whl", "pycairo-1.19.1-cp38-cp38-win32.whl")
print("Sucessfully downloaded Cairo for your system")
print("Installing Cairo")
os.system("pip install pycairo-1.19.1-cp38-cp38-win32.whl")
os.remove("pycairo-1.19.1-cp38-cp38-win32.whl")

#In case the python version is 3.8 and the system is AMD64, try pycairo-1.19.1-cp38-cp38-win_amd64.whl version of cairo
elif sys.version[:3]=='3.8' and platform.machine()=='AMD64':
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/pycairo-1.19.1-cp38-cp38-win_amd64.whl", "pycairo-1.19.1-cp38-cp38-win_amd64.whl")
print("Sucessfully downloaded Cairo for your system")
print("Installing Cairo")
os.system("pip install pycairo-1.19.1-cp38-cp38-win_amd64.whl")
os.remove("pycairo-1.19.1-cp38-cp38-win_amd64.whl")
12 changes: 12 additions & 0 deletions .travis/osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
##### THIS IS FOR TRAVIS BUILDS, DO NOT RUN THIS ON YOUR COMPUTER! #####

brew update
brew install openssl readline
brew outdated pyenv || brew upgrade pyenv
brew install pyenv-virtualenv
pyenv install $PYVER
export PYENV_VERSION=$PYVER
export PATH="/Users/travis/.pyenv/shims:${PATH}"
pyenv virtualenv venv
source ~/.pyenv/versions/venv/bin/activate
python --version
14 changes: 14 additions & 0 deletions .travis/travis-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
argparse
colour
numpy
Pillow
progressbar
scipy
tqdm
# opencv-python
# pycairo
pydub
pygments
pyreadline; sys_platform == 'win32'
rich
pytest
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](logo/cropped.png)

[![Build Status](https://travis-ci.org/3b1b/manim.svg?branch=master)](https://travis-ci.org/3b1b/manim)
[![Build Status](https://travis-ci.com/ManimCommunity/manim.svg?branch=master)](https://travis-ci.com/ManimCommunity/manim)
[![Documentation](https://img.shields.io/badge/docs-EulerTour-blue.svg)](https://www.eulertour.com/docs)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://choosealicense.com/licenses/mit/)
[![Manim Subreddit](https://img.shields.io/reddit/subreddit-subscribers/manim.svg?color=ff4301&label=reddit)](https://www.reddit.com/r/manim/)
Expand Down
2 changes: 1 addition & 1 deletion logo/logo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from manim.imports import *
from manim import *

NEW_BLUE = "#68a8e1"

Expand Down
94 changes: 47 additions & 47 deletions manim/scene/scene_from_video.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
from tqdm import tqdm as show_progress
import cv2
# from tqdm import tqdm as show_progress
# import cv2

from ..scene.scene import Scene
from ..logger import logger
# from ..scene.scene import Scene
# from ..logger import logger


# TODO, is this depricated?
class SceneFromVideo(Scene):
def construct(self, file_name,
freeze_last_frame=True,
time_range=None):
cap = cv2.VideoCapture(file_name)
self.shape = (
int(cap.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)),
int(cap.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH))
)
fps = cap.get(cv2.cv.CV_CAP_PROP_FPS)
self.camera.frame_rate = fps
frame_count = int(cap.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT))
if time_range is None:
start_frame = 0
end_frame = frame_count
else:
start_frame, end_frame = [fps * t for t in time_range]
# # TODO, is this depricated?
# class SceneFromVideo(Scene):
# def construct(self, file_name,
# freeze_last_frame=True,
# time_range=None):
# cap = cv2.VideoCapture(file_name)
# self.shape = (
# int(cap.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)),
# int(cap.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH))
# )
# fps = cap.get(cv2.cv.CV_CAP_PROP_FPS)
# self.camera.frame_rate = fps
# frame_count = int(cap.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT))
# if time_range is None:
# start_frame = 0
# end_frame = frame_count
# else:
# start_frame, end_frame = [fps * t for t in time_range]

frame_count = end_frame - start_frame
logger.info("Reading in " + file_name + "...")
for count in show_progress(list(range(start_frame, end_frame + 1))):
returned, frame = cap.read()
if not returned:
break
# b, g, r = cv2.split(frame)
# self.frames.append(cv2.merge([r, g, b]))
self.frames.append(frame)
cap.release()
# frame_count = end_frame - start_frame
# logger.info("Reading in " + file_name + "...")
# for count in show_progress(list(range(start_frame, end_frame + 1))):
# returned, frame = cap.read()
# if not returned:
# break
# # b, g, r = cv2.split(frame)
# # self.frames.append(cv2.merge([r, g, b]))
# self.frames.append(frame)
# cap.release()

if freeze_last_frame and len(self.frames) > 0:
self.original_background = self.background = self.frames[-1]
# if freeze_last_frame and len(self.frames) > 0:
# self.original_background = self.background = self.frames[-1]

def apply_gaussian_blur(self, ksize=(5, 5), sigmaX=5):
self.frames = [
cv2.GaussianBlur(frame, ksize, sigmaX)
for frame in self.frames
]
# def apply_gaussian_blur(self, ksize=(5, 5), sigmaX=5):
# self.frames = [
# cv2.GaussianBlur(frame, ksize, sigmaX)
# for frame in self.frames
# ]

def apply_edge_detection(self, threshold1=50, threshold2=100):
edged_frames = [
cv2.Canny(frame, threshold1, threshold2)
for frame in self.frames
]
for index in range(len(self.frames)):
for i in range(3):
self.frames[index][:, :, i] = edged_frames[index]
# def apply_edge_detection(self, threshold1=50, threshold2=100):
# edged_frames = [
# cv2.Canny(frame, threshold1, threshold2)
# for frame in self.frames
# ]
# for index in range(len(self.frames)):
# for i in range(3):
# self.frames[index][:, :, i] = edged_frames[index]
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ Pillow
progressbar
scipy
tqdm
opencv-python
# opencv-python
pycairo
pydub
pygments
pyreadline; sys_platform == 'win32'
rich
# pytest (for development only)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"pydub",
"pygments",
"pyreadline; sys_platform == 'win32'",
"rich"
"rich",
],
)
2 changes: 2 additions & 0 deletions tests/test_imports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_import():
import manim
Loading