diff --git a/.cruft.json b/.cruft.json index 0ace281..e245b3f 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/escaped/cookiecutter-pypackage.git", - "commit": "b58e99ccf10eede92dee5810738871726199ecbb", + "commit": "46edce6ba837a29c6a7b6867ab259ce93391fd13", "context": { "cookiecutter": { "author": "Alexander Frenzel", diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..c9d8b19 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,13 @@ +## Description + +Please include a summary of the proposed changes. + +Fixes #(issue) + +## Checklist + +- [ ] Tests covering the new functionality have been added +- [ ] Code builds clean without any errors or warnings +- [ ] Documentation has been updated +- [ ] Changes have been added to the `CHANGELOG.md` +- [ ] You added yourself to the `CONTRIBUTORS.md` diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f140526..4267624 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,6 +36,7 @@ jobs: draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }} publish: + needs: [release] name: Build and publish Python distributions to PyPI runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e773eb..94412c3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - main jobs: lint: @@ -13,6 +14,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Set up Python uses: actions/setup-python@v2 with: @@ -32,9 +35,11 @@ jobs: max-parallel: 4 matrix: platform: [ubuntu-latest] - python-version: [3.6, 3.7, 3.8] + python-version: [3.6, 3.7, 3.8, 3.9] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: @@ -48,24 +53,19 @@ jobs: run: tox env: PLATFORM: ${{ matrix.platform }} - - name: coveralls - run: coveralls - env: - COVERALLS_PARALLEL: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Coveralls + uses: AndreMiras/coveralls-python-action@develop + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel: true - coveralls: + coveralls_finish: needs: [test] runs-on: ubuntu-latest steps: - - name: Set up Python - uses: actions/setup-python@v2 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install coveralls - - name: coveralls - run: coveralls --finish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Coveralls Finished + uses: AndreMiras/coveralls-python-action@develop + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..fa5e8f6 --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,41 @@ +name: Update project structure +on: + schedule: + - cron: "0 0 * * *" # at the end of every day + +jobs: + autoUpdateProject: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8.5 + + - name: Install dependencies + run: pip install cruft poetry jello + + - name: Update project structure + run: | + cruft update -y + poetry lock --no-update # add new dependencies + poetry run pre-commit run -a + + - name: Get new template version + # extract new cooiecutter template version + run: | + echo "TEMPLATE_COMMIT=$(cat .cruft.json | jello -r "_['commit'][:8]")" >> $GITHUB_ENV + + # behaviour if PR already exists: https://github.com/marketplace/actions/create-pull-request#action-behaviour + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.AUTO_UPDATE_GITHUB_TOKEN }} + commit-message: >- + chore: update project structure to ${{ env.TEMPLATE_COMMIT }} + title: "[Cruft] Auto-Update project structure" + body: "" + branch: chore/cookiecutter-pypackage + delete-branch: true + diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7826233..b32c457 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,13 +7,21 @@ repos: language: system entry: poetry run black types: [python] + + - repo: local + hooks: + - id: autoflake + name: autoflake + language: system + entry: poetry run autoflake --expand-star-imports --remove-all-unused-imports --remove-unused-variables --in-place --recursive test_proj/ video_encoding/ + types: [python] - repo: local hooks: - id: isort name: isort language: system - entry: poetry run isort -profile black + entry: poetry run isort types: [python] - repo: local diff --git a/LICENSE b/LICENSE index c23c96d..b524b15 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) Alexander Frenzel. +Copyright (c) Alexander Frenzel . All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/poetry.lock b/poetry.lock index de49255..40d62ae 100644 --- a/poetry.lock +++ b/poetry.lock @@ -39,6 +39,17 @@ docs = ["sphinx", "sphinx-rtd-theme", "zope.interface"] tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"] +[[package]] +name = "autoflake" +version = "1.4" +description = "Removes unused imports and unused variables" +category = "dev" +optional = false +python-versions = "*" + +[package.dependencies] +pyflakes = ">=1.1.0" + [[package]] name = "black" version = "20.8b1" @@ -163,6 +174,21 @@ mccabe = ">=0.6.0,<0.7.0" pycodestyle = ">=2.6.0a1,<2.7.0" pyflakes = ">=2.2.0,<2.3.0" +[[package]] +name = "flake8-bugbear" +version = "20.11.1" +description = "A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle." +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +attrs = ">=19.2.0" +flake8 = ">=3.0.0" + +[package.extras] +dev = ["coverage", "black", "hypothesis", "hypothesmith"] + [[package]] name = "identify" version = "1.5.6" @@ -384,7 +410,7 @@ py = ">=1.8.2" toml = "*" [package.extras] -checkqa_mypy = ["mypy (0.780)"] +checkqa_mypy = ["mypy (==0.780)"] testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] [[package]] @@ -400,7 +426,7 @@ coverage = ">=4.4" pytest = ">=4.6" [package.extras] -testing = ["fields", "hunter", "process-tests (2.0.2)", "six", "pytest-xdist", "virtualenv"] +testing = ["fields", "hunter", "process-tests (==2.0.2)", "six", "pytest-xdist", "virtualenv"] [[package]] name = "pytest-django" @@ -562,12 +588,12 @@ python-versions = ">=3.6" [package.extras] docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=3.5,<3.7.3 || >3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] +testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] [metadata] lock-version = "1.1" python-versions = ">=3.6.1, <4.0" -content-hash = "5f8f5a12d4a0061355fa6a739f0d3bcefee386dba1b1dfb5c01cfbea6544eadc" +content-hash = "d60e819d39f0b441d816a6ab7390b61f081d44870cff2693c0e2e4a1ccd23712" [metadata.files] appdirs = [ @@ -586,6 +612,9 @@ attrs = [ {file = "attrs-20.2.0-py2.py3-none-any.whl", hash = "sha256:fce7fc47dfc976152e82d53ff92fa0407700c21acd20886a13777a0d20e655dc"}, {file = "attrs-20.2.0.tar.gz", hash = "sha256:26b54ddbbb9ee1d34d5d3668dd37d6cf74990ab23c828c2888dccdceee395594"}, ] +autoflake = [ + {file = "autoflake-1.4.tar.gz", hash = "sha256:61a353012cff6ab94ca062823d1fb2f692c4acda51c76ff83a8d77915fba51ea"}, +] black = [ {file = "black-20.8b1-py3-none-any.whl", hash = "sha256:70b62ef1527c950db59062cda342ea224d772abdf6adc58b86a45421bab20a6b"}, {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, @@ -662,6 +691,10 @@ flake8 = [ {file = "flake8-3.8.4-py2.py3-none-any.whl", hash = "sha256:749dbbd6bfd0cf1318af27bf97a14e28e5ff548ef8e5b1566ccfb25a11e7c839"}, {file = "flake8-3.8.4.tar.gz", hash = "sha256:aadae8761ec651813c24be05c6f7b4680857ef6afaae4651a4eccaef97ce6c3b"}, ] +flake8-bugbear = [ + {file = "flake8-bugbear-20.11.1.tar.gz", hash = "sha256:528020129fea2dea33a466b9d64ab650aa3e5f9ffc788b70ea4bc6cf18283538"}, + {file = "flake8_bugbear-20.11.1-py36.py37.py38-none-any.whl", hash = "sha256:f35b8135ece7a014bc0aee5b5d485334ac30a6da48494998cc1fabf7ec70d703"}, +] identify = [ {file = "identify-1.5.6-py2.py3-none-any.whl", hash = "sha256:3139bf72d81dfd785b0a464e2776bd59bdc725b4cc10e6cf46b56a0db931c82e"}, {file = "identify-1.5.6.tar.gz", hash = "sha256:969d844b7a85d32a5f9ac4e163df6e846d73c87c8b75847494ee8f4bd2186421"}, diff --git a/pyproject.toml b/pyproject.toml index ae15919..fe5ef18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,8 +38,10 @@ django = ">=2.2" pillow = ">=5.0" [tool.poetry.dev-dependencies] +autoflake = "^1.4" black = "^20.8b1" flake8 = "^3.8.3" +flake8-bugbear = "^20.11.1" isort = "^5.5.2" mypy = "^0.782" pre-commit = "^2.7.1" diff --git a/setup.cfg b/setup.cfg index 1a588c6..c169386 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [isort] line_length = 88 -known_project = video_encoding +profile = black [flake8] @@ -17,6 +17,7 @@ max-complexity = 9 [coverage:run] +relative_files = True branch = True include = video_encoding/* omit = diff --git a/tox.ini b/tox.ini index 0b783b3..5b2e1f5 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,7 @@ python = 3.6: py36 3.7: py37 3.8: py38 + 3.9: py39 [tox] skipsdist = True @@ -11,6 +12,7 @@ envlist = py36-{2.2,3.0,3.1} py37-{2.2,3.0,3.1} py38-{2.2,3.0,3.1} + py39-{2.2,3.0,3.1} [testenv] skip_install = True diff --git a/video_encoding/backends/base.py b/video_encoding/backends/base.py index e62ef34..dc1b6e3 100644 --- a/video_encoding/backends/base.py +++ b/video_encoding/backends/base.py @@ -21,7 +21,6 @@ def encode( All encoder specific options are passed in using `params`. """ - pass @abc.abstractmethod def get_media_info( @@ -30,7 +29,6 @@ def get_media_info( """ Return duration, width and height of the video. """ - pass @abc.abstractmethod def get_thumbnail( @@ -42,4 +40,3 @@ def get_thumbnail( If the requested thumbnail is not within the duration of the video an `InvalidTimeError` is thrown. """ - pass