Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[run]
branch = True
source = vi3o

[paths]
source =
src/vi3o
.tox/*/lib/python*/site-packages/vi3o

[report]
show_missing = True
2 changes: 2 additions & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
system
3.7.3
12 changes: 10 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
include build_*.py src/*.h
include LICENSE README.rst requirements.txt
include LICENSE
include README.rst
include requirements.txt

recursive-include src/_cffi_src *.py *.c *.h
recursive-include tests *.py

prune docs/_build
recursive-exclude scripts *
exclude .coveragerc tox.ini requirements.txt
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.pngmath',
'sphinx.ext.imgmath',
'sphinx.ext.viewcode',
]

Expand Down
3 changes: 3 additions & 0 deletions init_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python3 -m venv venv/
venv/bin/pip install tox
source venv/bin/activate
File renamed without changes.
File renamed without changes.
96 changes: 64 additions & 32 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,53 +1,85 @@
from setuptools import setup
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys
import os

# Read the version but avoid importing the __init__.py since
# we might not have all dependencies installed
with open(os.path.join(os.path.dirname(__file__), "vi3o", "version.py")) as fp:
exec(fp.read())
is_PY2 = sys.version_info <= (3, 0, 0)

KEYWORDS = [
"video", "mkv", "mjpg"
]

CLASSIFIERS = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT",
"Natural Language :: English",
"Operating System :: Linux",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Python Modules"
]

requirements=["cffi>=1.0.0", "numpy>=1.7.1,<1.17"]
if sys.version_info <= (3, 3, 0):
requirements.append("pathlib2")
INSTALL_REQUIRES = ["cffi>=1.0.0", "numpy>=1.7.1,<1.17"]
if is_PY2:
INSTALL_REQUIRES.append("pathlib2")

class PyTestCommand(TestCommand):
user_options = []
SETUP_REQUIRES = [
'cffi>=1.0.0'
]

def finalize_options(self):
pass
EXTRAS_REQUIRE = {
"dev": [
"coverage",
"pytest <= 4.6, != 4.6.0",
"pillow < 7",
"sphinx < 1.8",
],
"full": [
"pillow < 7",
"pyglet < 1.5"
]
}

def run_tests(self):
import pytest
errno = pytest.main()
sys.exit(errno)
if is_PY2:
EXTRAS_REQUIRE['dev'].append('mock')


PACKAGES = find_packages(where="src")

CFFI_MODULES = [
"src/_cffi_src/build_mjpg.py:ffi",
"src/_cffi_src/build_mkv.py:ffi"
]

# Read the version but avoid importing the __init__.py since
# we might not have all dependencies installed
with open(os.path.join(os.path.dirname(__file__), "src", "vi3o", "version.py")) as fp:
exec(fp.read())

setup(
name='vi3o',
description='VIdeo and Image IO',
license='MIT',
url='http://vi3o.readthedocs.org',
author='Hakan Ardo',
author_email='hakan@debian.org',
long_description='''
Utility for loading/saving/displaying video and images. It gives random
access to mjpg (in http multipart format) and H264 (in .mkv format) video
frames. For recordings origination from Axis cameras the camera system
time at the time of capture is provided as timestamp for each frame.
''',
version=__version__,
packages=['vi3o'],
keywords=KEYWORDS,
classifiers=CLASSIFIERS,
packages=PACKAGES,
package_dir={"": "src"},
setup_requires=SETUP_REQUIRES,
cffi_modules=CFFI_MODULES,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
zip_safe=False,
url='http://vi3o.readthedocs.org',
author='Hakan Ardo',
author_email='hakan@debian.org',
license='MIT',
setup_requires=["cffi>=1.0.0"],
cffi_modules=["build_mjpg.py:ffi", "build_mkv.py:ffi"],
install_requires=requirements,
extras_require={
"full": [
"pillow < 7",
"pyglet < 1.5"
]
},
cmdclass={'test': PyTestCommand},
tests_require=['pytest <= 4.6, !=4.6.0', 'pillow < 7', "mock"],
)
4 changes: 2 additions & 2 deletions build_mjpg.py → src/_cffi_src/build_mjpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
int mjpg_seek (struct mjpg *m, long offset);

""")
ffi.set_source("vi3o._mjpg", '#include "src/mjpg.h"',
ffi.set_source("vi3o._mjpg", '#include "mjpg.h"',
include_dirs=[mydir],
sources=["src/mjpg.c"],
sources=[os.path.join(mydir, "mjpg.c")],
libraries=["jpeg"], )

if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions build_mkv.py → src/_cffi_src/build_mkv.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
int64_t mkv_estimate_systime_offset(struct mkv *s);

""")
ffi.set_source("vi3o._mkv", '#include "src/decode.h"',
ffi.set_source("vi3o._mkv", '#include "decode.h"',
include_dirs=[mydir],
sources=["src/mkv.c", "src/decode.c"],
sources=[os.path.join(mydir, "mkv.c"), os.path.join(mydir,"decode.c")],
# cflags=["-g"],
libraries=["avcodec", "swscale"])

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/test_cat.py → tests/test_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest
import vi3o
from vi3o import cat
from test.util import _FakeVideo, itertools, mock
from tests.util import _FakeVideo, itertools, mock



Expand Down
2 changes: 1 addition & 1 deletion test/test_image.py → tests/test_image.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from vi3o.image import *
from test.util import TempDir
from tests.util import TempDir
import numpy as np
from py.test import raises
from vi3o.compat import pathlib
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/test_recording.py → tests/test_recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import vi3o.compat as compat
from vi3o import recording

from test.util import _FakeVideo, itertools, mock
from tests.util import _FakeVideo, itertools, mock

# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
42 changes: 42 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[tox]
envlist = py27, py34, py35, py36, py37, docs, format, lint, coverage-report
skip_missing_interpreters = true
minversion = 3.4.0

[testenv]
description = Run test and measure coverage
extras = dev
commands =
coverage run --parallel -m pytest {posargs}

[testenv:lint]
description = Check linting
deps = pylint
# Do not fail builds due to linting yet, we need to fix the current
# issues first
commands =
pylint src/ {posargs} --exit-zero

[testenv:format]
description = Check formatting
basepython = python3.6
deps = black
commands =
black --check src/ tests/ {posargs}

[testenv:docs]
description = Build docs
basepython = python3.6
extras = dev
commands =
sphinx-build -b html -d docs/_build/doctrees docs/ docs/_build/html


[testenv:coverage-report]
depends = py{27,35,37}
deps = coverage
skip_install = true
parallel_show_output = true
commands =
coverage combine
coverage report