From 6e0356d30b5caa86bd9a5ae5534a38d54e418a3a Mon Sep 17 00:00:00 2001 From: Vladimir Iglovikov Date: Sun, 19 Jul 2020 14:12:28 -0700 Subject: [PATCH] setup --- .deepsource.toml | 17 +++++++++++++ .github/FUNDING.yml | 12 ++++++++++ .github/workflows/ci.yml | 52 ++++++++++++++++++++++++++++++++++++++++ .gitignore | 28 +++------------------- .pre-commit-config.yaml | 43 +++++++++++++++++++++++++++++++++ pyproject.toml | 25 +++++++++++++++++++ setup.cfg | 7 ++++++ 7 files changed, 159 insertions(+), 25 deletions(-) create mode 100644 .deepsource.toml create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml create mode 100644 setup.cfg diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 0000000..6a6724e --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,17 @@ +version = 1 + +test_patterns = [ + 'tests/**' +] + +exclude_patterns = [ + +] + +[[analyzers]] +name = 'python' +enabled = true +runtime_version = '3.x.x' + + [analyzers.meta] + max_line_length = 119 diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..6ccd91f --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: ternaus +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8f11c6c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1.1.1 + with: + python-version: ${{ matrix.python-version }} + - name: Cache pip + uses: actions/cache@v1 + with: + path: ~/.cache/pip # This path is specific to Ubuntu + # Look to see if there is a cache hit for the corresponding requirements file + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + # You can test your matrix by printing the current Python version + - name: Display Python version + run: python -c "import sys; print(sys.version)" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install Cython + pip install -r requirements.txt + pip install pycocotools + pip install black flake8 mypy pytest hypothesis + - name: Run black + run: + black --check . + - name: Run flake8 + run: flake8 + - name: Run Mypy + run: mypy retinaface +# - name: tests +# run: | +# pip install .[tests] +# pytest diff --git a/.gitignore b/.gitignore index b6e4761..f4d4f6e 100644 --- a/.gitignore +++ b/.gitignore @@ -20,8 +20,6 @@ parts/ sdist/ var/ wheels/ -pip-wheel-metadata/ -share/python-wheels/ *.egg-info/ .installed.cfg *.egg @@ -40,14 +38,12 @@ pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ -.nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover -*.py,cover .hypothesis/ .pytest_cache/ @@ -59,7 +55,6 @@ coverage.xml *.log local_settings.py db.sqlite3 -db.sqlite3-journal # Flask stuff: instance/ @@ -77,26 +72,11 @@ target/ # Jupyter Notebook .ipynb_checkpoints -# IPython -profile_default/ -ipython_config.py - # pyenv .python-version -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff +# celery beat schedule file celerybeat-schedule -celerybeat.pid # SageMath parsed files *.sage.py @@ -122,8 +102,6 @@ venv.bak/ # mypy .mypy_cache/ -.dmypy.json -dmypy.json -# Pyre type checker -.pyre/ +# ide +.idea/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a0d4138 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,43 @@ +exclude: _pb2\.py$ +repos: +- repo: https://github.com/psf/black + rev: 19.10b0 + hooks: + - id: black +- repo: https://github.com/asottile/yesqa + rev: v1.1.0 + hooks: + - id: yesqa + additional_dependencies: + - flake8-bugbear==20.1.4 + - flake8-builtins==1.5.2 + - flake8-comprehensions==3.2.2 + - flake8-tidy-imports==4.1.0 + - flake8==3.7.9 +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-docstring-first + - id: check-json + - id: check-merge-conflict + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: trailing-whitespace + - id: flake8 + - id: requirements-txt-fixer +- repo: https://github.com/asottile/pyupgrade + rev: v1.13.0 + hooks: + - id: pyupgrade + args: ['--py36-plus'] +- repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.5.1 + hooks: + - id: python-check-mock-methods + - id: python-use-type-annotations +- repo: https://github.com/pre-commit/mirrors-mypy + rev: 9feadeb + hooks: + - id: mypy + args: [--ignore-missing-imports, --warn-no-return, --warn-redundant-casts, --disallow-incomplete-defs] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..06d00f2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +# Example configuration for Black. + +# NOTE: you have to use single-quoted strings in TOML for regular expressions. +# It's the equivalent of r-strings in Python. Multiline strings are treated as +# verbose regular expressions by Black. Use [ ] to denote a significant space +# character. + +[tool.black] +line-length = 119 +target-version = ['py36', 'py37', 'py38'] +include = '\.pyi?$' +exclude = ''' +/( + \.eggs + | \.git + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | _build + | buck-out + | build + | dist +)/ +''' diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..1776e6d --- /dev/null +++ b/setup.cfg @@ -0,0 +1,7 @@ +[flake8] +max-line-length = 119 +exclude =.git,__pycache__,docs/source/conf.py,build,dist +ignore = I101,I201,F401,F403,S001,D100,D101,D102,D103,D104,D105,D106,D107,D200,D205,D400,W504,E203,D202,D401 + +[mypy] +ignore_missing_imports = True