From 029557a363bda64564ddfcaa4e4b1106e0df2a7c Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Fri, 14 May 2021 05:30:12 +0300 Subject: [PATCH] Big update --- .envrc | 7 +-- .github/workflows/build.yml | 7 +-- .github/workflows/check-requirements.yml | 43 +++++++++++++++ .gitignore | 3 +- .pre-commit-config.yaml | 38 ++++++------- Makefile | 27 +++++----- Pipfile | 69 ------------------------ README.rst | 5 +- setup.cfg | 66 +++++++++++++---------- tests/settings.py | 18 ------- 10 files changed, 120 insertions(+), 163 deletions(-) create mode 100644 .github/workflows/check-requirements.yml delete mode 100644 Pipfile diff --git a/.envrc b/.envrc index 5f19d2a..87c3d92 100644 --- a/.envrc +++ b/.envrc @@ -3,9 +3,4 @@ dotenv - -if [ ! -n "$VIRTUAL_ENV" ]; then - if [ -f "Pipfile" ] ; then - pipenv shell - fi -fi +layout python diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e85b76..98609a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,7 @@ on: pull_request: branches: - "*" + workflow_dispatch: env: DEFAULT_PYTHON_VERSION: "3.9" jobs: @@ -40,7 +41,6 @@ jobs: ${{ runner.os }}-pip- - name: Install dependencies run: | - pip install pipenv pip install .[test] - name: Run ${{ matrix.toxenv }} run: tox -e ${{ matrix.toxenv }} @@ -78,7 +78,6 @@ jobs: key: .coverage-${{ github.run_id }}-${{ github.run_number }} - name: Install dependencies run: | - pip install pipenv pip install .[test] - name: Run tests env: @@ -100,9 +99,8 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.toxenv }}-${{ hashFiles('setup.py', 'setup.cfg', 'tox.ini') }} + key: ${{ runner.os }}-pip-${{ hashFiles('setup.py', 'setup.cfg', 'tox.ini') }} restore-keys: | - ${{ runner.os }}-pip-${{ matrix.toxenv }}- ${{ runner.os }}-pip- - name: Temporarily save coverage statistics uses: actions/cache@v2 @@ -111,7 +109,6 @@ jobs: key: .coverage-${{ github.run_id }}-${{ github.run_number }} - name: Install dependencies run: | - pip install pipenv pip install .[test] - name: Upload coverage report to Coveralls env: diff --git a/.github/workflows/check-requirements.yml b/.github/workflows/check-requirements.yml new file mode 100644 index 0000000..272d5d5 --- /dev/null +++ b/.github/workflows/check-requirements.yml @@ -0,0 +1,43 @@ +# django-po2xls +# .github/workflows/check-requirements.yml + + +name: check-requirements +on: + push: + branches: + - "*" + tags: + - "*" + pull_request: + branches: + - "*" + schedule: + - cron: "0 3 * * *" + workflow_dispatch: +env: + DEFAULT_PYTHON_VERSION: "3.9" +jobs: + check-requirements: + name: check-requirements + runs-on: ubuntu-latest + steps: + - name: Git clone + uses: actions/checkout@v2 + - name: Set up Python ${{ env.DEFAULT_PYTHON_VERSION }} + uses: actions/setup-python@v2 + with: + python-version: ${{ env.DEFAULT_PYTHON_VERSION }} + - name: Pip cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('setup.py', 'setup.cfg', 'tox.ini') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install dependencies + run: | + pip install .[test] + - name: Check outdated requirements + continue-on-error: true + run: pip-outdated diff --git a/.gitignore b/.gitignore index 2c52996..ac4ce0f 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ __pycache__/* .DS_Store *.save .mypy_cache/* +.pytest_cache/* # IDE's @@ -47,4 +48,4 @@ static/* .env .coverage htmlcov -Pipfile.lock +.direnv diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dc447b7..059a149 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,97 +10,97 @@ repos: stages: [commit] language: system pass_filenames: false - entry: pipenv run seed-isort-config + entry: seed-isort-config types: [python] - id: removestar name: removestar stages: [commit] language: system - entry: pipenv run removestar -i po2xls tests + entry: removestar -i po2xls tests types: [python] - id: isort name: isort stages: [commit] language: system - entry: pipenv run isort + entry: isort types: [python] - id: black name: black stages: [commit] language: system - entry: pipenv run black po2xls tests + entry: black po2xls tests types: [python] - id: yesqa name: yesqa stages: [commit] language: system pass_filenames: false - entry: pipenv run yesqa + entry: yesqa types: [python] - id: flake8 name: flake8 stages: [commit] language: system - entry: pipenv run flake8 + entry: flake8 types: [python] - id: interrogate name: interrogate stages: [commit] language: system - entry: pipenv run interrogate po2xls tests -I -M + entry: interrogate po2xls tests -I -M types: [python] - id: pylint name: pylint stages: [commit] language: system - entry: pipenv run pylint po2xls tests + entry: pylint po2xls tests types: [python] - id: bandit name: bandit stages: [commit] language: system - entry: pipenv run bandit -r po2xls tests --ini=setup.cfg + entry: bandit -r po2xls tests --ini=setup.cfg types: [python] pass_filenames: false - id: dodgy name: dodgy stages: [commit] language: system - entry: pipenv run dodgy + entry: dodgy types: [python] pass_filenames: false - id: darglint name: darglint stages: [commit] language: system - entry: pipenv run darglint + entry: darglint types: [python] - id: polint name: polint stages: [commit] language: system - entry: pipenv run polint --ignore=location,unsorted --show-msg + entry: polint --ignore=location,unsorted --show-msg types: [pofile] pass_filenames: true - id: dennis name: dennis stages: [commit] language: system - entry: pipenv run dennis-cmd lint + entry: dennis-cmd lint types: [pofile] pass_filenames: true - id: curlylint name: curlylint stages: [commit] language: system - entry: pipenv run curlylint + entry: curlylint types: [html,xml] pass_filenames: true - id: mypy name: mypy stages: [commit] language: system - entry: bash -c 'PYTHONPATH="$PYTHONPATH:$PWD" pipenv run mypy' + entry: bash -c 'PYTHONPATH="$PYTHONPATH:$PWD" mypy' types: [python] pass_filenames: false - id: check-manifest @@ -108,24 +108,24 @@ repos: stages: [commit] language: system pass_filenames: false - entry: pipenv run check-manifest + entry: check-manifest - id: pyroma name: pyroma stages: [commit] language: system pass_filenames: false - entry: pipenv run pyroma -d . + entry: pyroma -d . types: [python] - id: check-wheel-contents name: check-wheel-contents stages: [commit] language: system pass_filenames: false - entry: bash -c 'make build -B && pipenv run check-wheel-contents dist' + entry: bash -c 'make build -B && check-wheel-contents dist' types: [python] - id: dotenv-linter name: dotenv-linter - entry: pipenv run dotenv-linter + entry: dotenv-linter language: system stages: [commit] types: [text] diff --git a/Makefile b/Makefile index f725890..4a04f6f 100644 --- a/Makefile +++ b/Makefile @@ -4,18 +4,17 @@ .ONESHELL: PHONY: pipenv-install tox test makemessages compilemessages bumpversion build sign check check-build check-upload upload clean coveralls release help -TEST_PYPI_URL=https://test.pypi.org/legacy/ -NAME=po2xls -EXTENSIONS=py,html,txt,xml -TRASH_DIRS=build dist *.egg-info .tox .mypy_cache __pycache__ htmlcov -TRASH_FILES=.coverage Pipfile.lock -BUILD_TYPES=bdist_wheel sdist -VERSION=`python -c "import configparser; config = configparser.ConfigParser(); config.read('setup.cfg'); print(config['metadata']['version']);"` +TEST_PYPI_URL ?= https://test.pypi.org/legacy/ +NAME ?= po2xls +EXTENSIONS ?= py,html,txt,xml +TRASH_DIRS ?= build dist *.egg-info .tox .mypy_cache __pycache__ htmlcov +TRASH_FILES ?= .coverage Pipfile.lock +BUILD_TYPES ?= bdist_wheel sdist +VERSION ?= `python -c "import configparser; config = configparser.ConfigParser(); config.read('setup.cfg'); print(config['metadata']['version']);"` -pipenv-install: - pipenv install;\ - pipenv install --dev;\ +install: + pip install .[test];\ tox: @@ -23,7 +22,7 @@ tox: test: - bash -c 'PYTHONPATH="$${PYTHONPATH}:$${PWD}" django-admin test $(TESTS) --settings=tests.settings';\ + bash -c 'PYTHONPATH="$${PYTHONPATH}:$${PWD}" py.test --cov=$(NAME) --modules-durations=0 --functions-durations=0 --instafail $(TESTS)';\ makemessages: @@ -71,7 +70,7 @@ clean: find -iname $${file} -print0 | xargs -0 rm -rf;\ done;\ for dir in $(TRASH_DIRS); do\ - find -type d -name $${dir} -print0 | xargs -0 rm -rf;\ + find -type d -name $${dir} ! -path "*/.direnv/*" -print0 | xargs -0 rm -rf;\ done;\ @@ -98,8 +97,8 @@ release: help: @echo " help:" @echo " Show this help." - @echo " pipenv-install:" - @echo " Install all requirements." + @echo " install:" + @echo " Install requirements." @echo " tox:" @echo " Run tox." @echo " test:" diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 64dcb05..0000000 --- a/Pipfile +++ /dev/null @@ -1,69 +0,0 @@ -# django-po2xls -# Pipfile - - -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - - -[dev-packages] -attrs = "==20.3.0" -bandit = "==1.7.0" -black = "==20.8b1" -check-manifest = "==0.46" -check-wheel-contents = "==0.2.0" -coverage = "==5.5" -coveralls = "==3.0.1" -curlylint = "==0.12.2" -darglint = "==1.7.0" -dennis = "==0.9" -django-nose = "==1.4.7" -django-stubs = "==1.7.0" -dodgy = "==0.2.1" -dotenv-linter = "==0.2.0" -flake8-annotations-complexity = "==0.0.6" -flake8-annotations-coverage = "==0.0.5" -flake8-bugbear = "==21.3.2" -flake8-comprehensions = "==3.3.1" -flake8-docstrings = "==1.5.0" -flake8-fixme = "==1.1.1" -flake8 = "==3.9.0" -importlib-metadata = "==3.7.3" -interrogate = "==1.3.2" -isort = "==5.7.0" -mypy = "==0.812" -nose-exclude = "==0.5.0" -nose-timer = "==1.0.1" -pep8-naming = "==0.11.1" -polint = "==0.4" -pre-commit-hooks = "==3.4.0" -pre-commit = "==2.11.1" -pygments = "==2.8.1" -pylint-django = "==2.4.2" -pylint = "==2.7.2" -pyroma = "==3.1" -readme_renderer = "==29.0" -rednose = "==1.3.0" -removestar = "==1.2.2" -seed-isort-config = "==2.2.0" -tabulate = "==0.8.9" -tox-gh-actions = "==2.4.0" -tox-pyenv = "==1.1.0" -tox = "==3.23.0" -twine = "==3.4.0" -xlrd = "==2.0.1" -yesqa = "==1.2.2" - - -[packages] -django-appconf = ">=1.0.3" -django-rosetta = ">=0.9.3" -django = ">=2.2<=3.2" -polib = ">=1.1.0" -xlwt = ">=1.3.0" - - -[requires] -python_version = "3.9.2" diff --git a/README.rst b/README.rst index df2b198..70b242e 100644 --- a/README.rst +++ b/README.rst @@ -4,7 +4,7 @@ A django-po2xls documentation ============================= -|GitHub|_ |Coveralls|_ |Requires|_ |pypi-license|_ |pypi-version|_ |pypi-python-version|_ |pypi-django-version|_ |pypi-format|_ |pypi-wheel|_ |pypi-status|_ +|GitHub|_ |Coveralls|_ |pypi-license|_ |pypi-version|_ |pypi-python-version|_ |pypi-django-version|_ |pypi-format|_ |pypi-wheel|_ |pypi-status|_ *django-po2xls is a Django management command to convert project translation .po files to .xls* @@ -52,8 +52,6 @@ For other authors list see AUTHORS file. :alt: GitHub .. |Coveralls| image:: https://coveralls.io/repos/github/vint21h/django-po2xls/badge.svg?branch=master :alt: Coveralls -.. |Requires| image:: https://requires.io/github/vint21h/django-po2xls/requirements.svg?branch=master - :alt: Requires .. |pypi-license| image:: https://img.shields.io/pypi/l/django-po2xls :alt: License .. |pypi-version| image:: https://img.shields.io/pypi/v/django-po2xls @@ -70,7 +68,6 @@ For other authors list see AUTHORS file. :alt: Package status .. _GitHub: https://github.com/vint21h/django-po2xls/actions/ .. _Coveralls: https://coveralls.io/github/vint21h/django-po2xls?branch=master -.. _Requires: https://requires.io/github/vint21h/django-po2xls/requirements/?branch=master .. _pypi-license: https://pypi.org/project/django-po2xls/ .. _pypi-version: https://pypi.org/project/django-po2xls/ .. _pypi-django-version: https://pypi.org/project/django-po2xls/ diff --git a/setup.cfg b/setup.cfg index 0237a5b..2f18f82 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,6 +18,7 @@ classifiers = Framework :: Django :: 2.2 Framework :: Django :: 3.0 Framework :: Django :: 3.1 + Framework :: Django :: 3.2 License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Operating System :: Unix Programming Language :: Python :: 3.6 @@ -38,58 +39,63 @@ test_suite = tests install_requires = django-appconf>=1.0.3 django-rosetta>=0.9.3 - django>=2.2<=3.2 + django>=2.2<=3.3 polib>=1.1.0 xlwt>=1.3.0 [options.extras_require] test = - attrs==20.3.0 + attrs==21.2.0 bandit==1.7.0 - black==20.8b1 + black==21.5b1 + bpython==0.21 check-manifest==0.46 - check-wheel-contents==0.2.0 + check-wheel-contents==0.3.0 coverage==5.5 coveralls==3.0.1 - curlylint==0.12.2 - darglint==1.7.0 + curlylint==0.13.0 + darglint==1.8.0 dennis==0.9 - django-nose==1.4.7 - django-stubs==1.7.0 + django-stubs==1.8.0 dodgy==0.2.1 dotenv-linter==0.2.0 flake8-annotations-complexity==0.0.6 flake8-annotations-coverage==0.0.5 - flake8-bugbear==21.3.2 - flake8-comprehensions==3.3.1 - flake8-docstrings==1.5.0 + flake8-bugbear==21.4.3 + flake8-comprehensions==3.5.0 + flake8-docstrings==1.6.0 flake8-fixme==1.1.1 - flake8==3.9.0 - importlib-metadata==3.7.3 + flake8==3.9.2 + importlib-metadata==4.0.1 interrogate==1.3.2 - isort==5.7.0 + isort==5.8.0 mypy==0.812 - nose-exclude==0.5.0 - nose-timer==1.0.1 pep8-naming==0.11.1 + pip-outdated==0.4.0 polint==0.4 pre-commit-hooks==3.4.0 - pre-commit==2.11.1 - pygments==2.8.1 - pylint-django==2.4.2 - pylint==2.7.2 + pre-commit==2.12.1 + pygments==2.9.0 + pylint-django==2.4.4 + pylint==2.8.2 pyroma==3.1 + pytest-cov==2.11.1 + pytest-django==4.2.0 + pytest-extra-durations==0.1.3 + pytest-instafail==0.4.2 + pytest-sugar==0.9.4 + pytest==6.2.4 readme_renderer==29.0 - rednose==1.3.0 removestar==1.2.2 seed-isort-config==2.2.0 tabulate==0.8.9 - tox-gh-actions==2.4.0 + tox-gh-actions==2.5.0 tox-pyenv==1.1.0 - tox==3.23.0 - twine==3.4.0 + tox==3.23.1 + twine==3.4.1 + wheel==0.36.2 xlrd==2.0.1 - yesqa==1.2.2 + yesqa==1.2.3 [options.packages.find] exclude = @@ -146,8 +152,6 @@ ignore = AUTHORS COPYING Makefile - Pipfile - Pipfile.lock README.rst tests tests.* @@ -210,6 +214,7 @@ envlist = {py36,py37,py38,py39}-2.2.x {py36,py37,py38,py39}-3.0.x {py36,py37,py38,py39}-3.1.x + {py36,py37,py38,py39}-3.2.x check check-build @@ -221,6 +226,7 @@ deps = 2.2.x: Django>=2.2,<3.0 3.0.x: Django>=3.0,<3.1 3.1.x: Django>=3.1,<3.2 + 3.2.x: Django>=3.2,<3.3 commands= pip install .[test] make test @@ -387,3 +393,9 @@ analyse-fallback-blocks = no [pylint.EXCEPTIONS] overgeneral-exceptions = Exception + + +[tool:pytest] +DJANGO_SETTINGS_MODULE = tests.settings +python_files = tests.py test_*.py *_tests.py +python_classes = diff --git a/tests/settings.py b/tests/settings.py index 95c803a..901587d 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -43,28 +43,10 @@ DEFAULT_LANGUAGE = "en" # type: str LOCALE_PATHS = ["po2xls/locale"] # type: List[str] -# add testing related apps INSTALLED_APPS = [ - "django_nose", "po2xls", ] # type: List[str] -# add nose test runner -TEST_RUNNER = "django_nose.NoseTestSuiteRunner" # type: str - -# configure nose test runner -NOSE_ARGS = [ - "--rednose", - "--force-color", - "--with-timer", - "--with-doctest", - "--with-coverage", - "--cover-inclusive", - "--cover-erase", - "--cover-package=po2xls", - "--logging-clear-handlers", -] # type: List[str] - # configure urls ROOT_URLCONF = "po2xls.urls" # type: str