Skip to content

Commit e94cd63

Browse files
authored
Add ci for py39 (#44)
* add ci for 39 * add gh actions * black
1 parent 6dd9bc2 commit e94cd63

File tree

4 files changed

+104
-28
lines changed

4 files changed

+104
-28
lines changed

.github/workflows/ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
10+
jobs:
11+
build:
12+
name: ${{ matrix.name }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
include:
17+
- name: Lint
18+
os: ubuntu-latest
19+
pyversion: '3.7'
20+
dolint: 1
21+
- name: Linux py34
22+
os: ubuntu-latest
23+
pyversion: '3.6'
24+
tests: 1
25+
- name: Linux py36
26+
os: ubuntu-latest
27+
pyversion: '3.6'
28+
tests: 1
29+
- name: Linux py37
30+
os: ubuntu-latest
31+
pyversion: '3.7'
32+
tests: 1
33+
- name: Linux py38
34+
os: ubuntu-latest
35+
pyversion: '3.8'
36+
tests: 1
37+
- name: Linux py39
38+
os: ubuntu-latest
39+
pyversion: '3.9'
40+
tests: 1
41+
- name: Linux pypy3
42+
os: ubuntu-latest
43+
pyversion: 'pypy3'
44+
tests: 1
45+
- name: Windows py38
46+
os: windows-latest
47+
pyversion: '3.8'
48+
tests: 1
49+
- name: MacOS py38
50+
os: macos-latest
51+
pyversion: '3.8'
52+
tests: 1
53+
54+
steps:
55+
56+
- uses: actions/checkout@v2
57+
- name: Set up Python ${{ matrix.pyversion }}
58+
uses: actions/setup-python@v2
59+
with:
60+
python-version: ${{ matrix.pyversion }}
61+
62+
- name: Install dependencies (lint and docs)
63+
if: matrix.dolint == 1
64+
run: |
65+
python -m pip install --upgrade pip
66+
pip install invoke black flake8
67+
- name: Install dependencies (unit tests)
68+
if: matrix.tests == 1
69+
run: |
70+
python -m pip install --upgrade pip
71+
pip install psutil
72+
pip install invoke pytest pytest-cov
73+
invoke get-ffmpeg-binary;
74+
75+
- name: Lint
76+
if: matrix.dolint == 1
77+
run: |
78+
invoke lint
79+
invoke checkformat
80+
- name: Test with pytest
81+
if: matrix.tests == 1
82+
run: |
83+
python -c "import sys; print(sys.version, '\n', sys.prefix)";
84+
python -c 'import imageio_ffmpeg; print(imageio_ffmpeg.get_ffmpeg_version())'
85+
invoke test

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ matrix:
4040
python: "3.7"
4141
env: TEST_UNIT=1
4242
- os: linux
43-
python: "3.8-dev"
43+
python: "3.8"
44+
env: TEST_UNIT=1
45+
- os: linux
46+
python: "3.9"
4447
env: TEST_UNIT=1
4548

4649

imageio_ffmpeg/_parsing.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
class LogCatcher(threading.Thread):
9-
""" Thread to keep reading from stderr so that the buffer does not
9+
"""Thread to keep reading from stderr so that the buffer does not
1010
fill up and stalls the ffmpeg process. On stderr a message is send
1111
on every few frames with some meta information. We only keep the
1212
last ones.
@@ -27,12 +27,11 @@ def stop_me(self):
2727

2828
@property
2929
def header(self):
30-
""" Get header text. Empty string if the header is not yet parsed.
31-
"""
30+
"""Get header text. Empty string if the header is not yet parsed."""
3231
return self._header
3332

3433
def get_text(self, timeout=0):
35-
""" Get the whole text written to stderr so far. To preserve
34+
"""Get the whole text written to stderr so far. To preserve
3635
memory, only the last 50 to 100 frames are kept.
3736
3837
If a timeout is given, wait for this thread to finish. When
@@ -93,15 +92,14 @@ def get_output_video_line(lines):
9392

9493

9594
def limit_lines(lines, N=32):
96-
""" When number of lines > 2*N, reduce to N.
97-
"""
95+
"""When number of lines > 2*N, reduce to N."""
9896
if len(lines) > 2 * N:
9997
lines = [b"... showing only last few lines ..."] + lines[-N:]
10098
return lines
10199

102100

103101
def cvsecs(*args):
104-
""" converts a time to second. Either cvsecs(min, secs) or
102+
"""converts a time to second. Either cvsecs(min, secs) or
105103
cvsecs(hours, mins, secs).
106104
"""
107105
if len(args) == 1:

tasks.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525

2626
@task
2727
def test(ctx, cover=False):
28-
"""Perform unit tests. Use --cover to open a webbrowser to show coverage.
29-
"""
28+
"""Perform unit tests. Use --cover to open a webbrowser to show coverage."""
3029
cmd = [sys.executable, "-m", "pytest", "tests", "-v"]
3130
cmd += ["--cov=" + LIBNAME, "--cov-report=term", "--cov-report=html"]
3231
ret_code = subprocess.call(cmd, cwd=ROOT_DIR)
@@ -40,8 +39,7 @@ def test(ctx, cover=False):
4039

4140
@task
4241
def lint(ctx):
43-
""" Validate the code style (e.g. undefined names)
44-
"""
42+
"""Validate the code style (e.g. undefined names)"""
4543
try:
4644
importlib.import_module("flake8")
4745
except ImportError:
@@ -61,24 +59,21 @@ def lint(ctx):
6159

6260
@task
6361
def checkformat(ctx):
64-
""" Check whether the code adheres to the style rules. Use autoformat to fix.
65-
"""
62+
"""Check whether the code adheres to the style rules. Use autoformat to fix."""
6663
print("Checking format with black (also see invoke autoformat):")
6764
black_wrapper(False)
6865

6966

7067
@task
7168
def autoformat(ctx):
72-
""" Automatically format the code (using black).
73-
"""
69+
"""Automatically format the code (using black)."""
7470
print("Auto-formatting with black:")
7571
black_wrapper(True)
7672

7773

7874
@task
7975
def clean(ctx):
80-
""" Clean the repo of temp files etc.
81-
"""
76+
"""Clean the repo of temp files etc."""
8277
for root, dirs, files in os.walk(ROOT_DIR):
8378
for dname in dirs:
8479
if dname in (
@@ -104,8 +99,7 @@ def clean(ctx):
10499

105100
@task
106101
def get_ffmpeg_binary(ctx):
107-
""" Download/copy ffmpeg binary for local development.
108-
"""
102+
"""Download/copy ffmpeg binary for local development."""
109103
# Get ffmpeg fname
110104
sys.path.insert(0, os.path.join(ROOT_DIR, "imageio_ffmpeg"))
111105
try:
@@ -139,8 +133,7 @@ def get_ffmpeg_binary(ctx):
139133

140134
@task
141135
def build(ctx):
142-
""" Build packages for different platforms. Dont release yet.
143-
"""
136+
"""Build packages for different platforms. Dont release yet."""
144137

145138
# Get version and more
146139
sys.path.insert(0, os.path.join(ROOT_DIR, "imageio_ffmpeg"))
@@ -213,8 +206,7 @@ def build(ctx):
213206

214207
@task
215208
def release(ctx):
216-
""" Release the packages to Pypi!
217-
"""
209+
"""Release the packages to Pypi!"""
218210
dist_dir = os.path.join(ROOT_DIR, "dist")
219211
if not os.path.isdir(dist_dir):
220212
sys.exit("Dist directory does not exist. Build first?")
@@ -239,8 +231,7 @@ def release(ctx):
239231

240232
@task
241233
def update_readme(ctx):
242-
"""Update readme to include the latest API docs.
243-
"""
234+
"""Update readme to include the latest API docs."""
244235
text = open(os.path.join(ROOT_DIR, "README.md"), "rb").read().decode()
245236
text = text.split("\n## API\n")[0] + "\n## API\n\n"
246237

@@ -267,8 +258,7 @@ def update_readme(ctx):
267258

268259

269260
def black_wrapper(writeback):
270-
""" Helper function to invoke black programatically.
271-
"""
261+
"""Helper function to invoke black programatically."""
272262

273263
check = [] if writeback else ["--check"]
274264
exclude = "|".join(["cangivefilenameshere"])

0 commit comments

Comments
 (0)