diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..6ad2ff9 --- /dev/null +++ b/.flake8 @@ -0,0 +1,7 @@ +# +# Move to pyproject.toml after: https://gitlab.com/pycqa/flake8/-/issues/428 +# +[flake8] +exclude = .pytest_cache, .tox, dist, htmlcov, local_test +ignore = F405 +max-line-length = 119 diff --git a/.gitignore b/.gitignore index d18d5cc..d4aff27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ .* !.github !.editorconfig +!.flake8 !.gitignore __pycache__ secret.txt /local_test/ -/poetry.lock +/coverage.xml +/htmlcov/ diff --git a/Makefile b/Makefile index 2edd58a..3692cc4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ SHELL := /bin/bash +MAX_LINE_LENGTH := 119 all: help @@ -16,16 +17,38 @@ check-poetry: fi install-poetry: ## install or update poetry + pip3 install -U pip pip3 install -U poetry install: check-poetry ## install project via poetry poetry install -update: install-poetry ## update the sources and installation +update: install-poetry ## update the sources and installation and generate "conf/requirements.txt" + poetry run pip install -U pip poetry update + poetry export -f requirements.txt --output conf/requirements.txt -local-test: check-poetry ## Run local_test.py to run the project locally - poetry run ./local_test.py +lint: ## Run code formatters and linter + poetry run flynt --fail-on-change --line_length=${MAX_LINE_LENGTH} . + poetry run isort --check-only . + poetry run flake8 . + +fix-code-style: ## Fix code formatting + poetry run flynt --line_length=${MAX_LINE_LENGTH} . + poetry run black --verbose --safe --line-length=${MAX_LINE_LENGTH} --skip-string-normalization . + poetry run isort . + +tox-listenvs: check-poetry ## List all tox test environments + poetry run tox --listenvs + +tox: check-poetry ## Run pytest via tox with all environments + poetry run tox + +pytest: install ## Run pytest + poetry run python3 ./run_pytest.py + +local-test: install ## Run local_test.py to run the project locally + poetry run python3 ./local_test.py local-diff-settings: ## Run "manage.py diffsettings" with local test poetry run python3 local_test/opt_yunohost/manage.py diffsettings diff --git a/README.md b/README.md index 8a13efb..4c58880 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ You can edit the file `$final_path/local_settings.py` to enable or disable featu ## SSO authentication -[SSOwat](https://github.com/YunoHost/SSOwat) is fully supported: +[SSOwat](https://github.com/YunoHost/SSOwat) is fully supported via [django_ynh](https://github.com/YunoHost-Apps/django_ynh): * First user (`$YNH_APP_ARG_ADMIN`) will be created as Django's super user * All new users will be created as normal users diff --git a/pyproject.toml b/pyproject.toml index 4d17b07..357acab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,8 +8,20 @@ license = "GPL" [tool.poetry.dependencies] python = ">=3.7,<4.0.0" django-for-runners = "*" +django_ynh = "*" [tool.poetry.dev-dependencies] +bx_py_utils = "*" +tox = "*" +pytest = "*" +pytest-cov = "*" +pytest-django = "*" +coveralls = "*" +isort = "*" +flake8 = "*" +flynt = "*" +black = "*" +pyupgrade = "*" [build-system] requires = ["poetry-core>=1.0.0"]