diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..ded401f --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,26 @@ +name: Tests + +on: + - push + - pull_request + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + python-version: ['3.10'] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Test with tox + run: tox diff --git a/README.md b/README.md new file mode 100644 index 0000000..da4c776 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Traffic Light Detector + +![Tests](https://github.com/kristoferssolo/Traffic-Light-Detector/actions/workflows/tests.yml/badge.svg) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3bd5311 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +[build-system] +requires = ["setuptools>=42.0", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.pytest.ini_options] +addops = "--cov=detector" +testpaths = ["tests"] + +[tool.mypy] +check_untyped_defs = true +disallow_any_generics = true +ignore_missing_imports = true +mypy_path = "src" +no_implicit_optional = true +no_implicit_reexport = true +show_error_codes = true +strict_equality = true +warn_redundant_casts = true +warn_return_any = true +warn_unreachable = true +warn_unused_configs = true diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..47ad69a --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +opencv-python==4.6.0.66 diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 0000000..dc11eca --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,5 @@ +flake8==6.0.0 +mypy==0.991 +pytest==7.2.0 +pytest-cov==4.0.0 +tox==3.27.1 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..6f43fe8 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,30 @@ +[metadata] +name = detector +desctiption = Reduce traffic congestion effects due to human reaction times at intersections with traffic lights by utilizing a computer system based on direct communication method of changes in the circumscribed route intersection. +author = Kristofers Solo +license = MIT +license_file = LICENSE +platforms = unix, linux, osx, cygwin, win32 +classifiers = + Programming Language :: Python :: 3.10 + +[options] +packages = detector +install_requires = opencv-python>=4.6.0.66 +python_requires = >=3.10 +package_dir = =src +zip_safe = no + +[options.extras_require] +testing = + flake8>=6.0.0 + mypy>=0.991 + pytest>=7.2.0 + pytest-cov>=4.0.0 + tox>=3.27.1 + +[options.package_data] +detector = py.typed + +[flake8] +max-line-length = 160 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..7f1a176 --- /dev/null +++ b/setup.py @@ -0,0 +1,4 @@ +from setuptools import setup + +if __name__ == "__main__": + setup() diff --git a/src/detector/__init__.py b/src/detector/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/detector/py.typed b/src/detector/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..184efe8 --- /dev/null +++ b/tox.ini @@ -0,0 +1,27 @@ +[tox] +minversion = 3.8.0 +envlist = py310, flake8, mypy +isolated_build = true + +[gh-actions] +python = + 3.10: py310, mypy, flake8 + +[testenv] +setenv = + PYTHONPATH = {toxinidir} +deps = + -r{toxinidir}/requirements_dev.txt +commands = + pytest --basetemp={envtmpdir} + +[testenv:flake8] +basepython = python3.10 +deps = flake8 +commands = flake8 src tests + +[testenv:mypy] +basepython = python3.10 +deps = + -r{toxinidir}/requirements_dev.txt +commands = mypy src