diff --git a/.flake8 b/.flake8 index 6ad2ff9..5dccc60 100644 --- a/.flake8 +++ b/.flake8 @@ -1,7 +1,7 @@ # -# Move to pyproject.toml after: https://gitlab.com/pycqa/flake8/-/issues/428 +# Move to pyproject.toml after: https://github.com/PyCQA/flake8/issues/234 # [flake8] -exclude = .pytest_cache, .tox, dist, htmlcov, local_test +exclude = .*, dist, htmlcov, local_test ignore = F405 max-line-length = 119 diff --git a/Makefile b/Makefile index 18d735b..2bb81fc 100644 --- a/Makefile +++ b/Makefile @@ -20,9 +20,11 @@ install-poetry: ## install or update poetry curl -sSL https://install.python-poetry.org | python3 - install: check-poetry ## install project via poetry + python3 -m venv .venv poetry install update: check-poetry ## update the sources and installation and generate "conf/requirements.txt" + python3 -m venv .venv poetry self update poetry update -v poetry install diff --git a/conf/settings.py b/conf/settings.py index b7506b6..ce86ca1 100644 --- a/conf/settings.py +++ b/conf/settings.py @@ -15,7 +15,7 @@ from django_yunohost_integration.base_settings import * # noqa:F401,F403 from django_yunohost_integration.secret_key import get_or_create_secret as __get_or_create_secret -# https://github.com/jedie/django-example/ +# https://github.com/jedie/django_example/ from django_example.settings.prod import * # noqa:F401,F403 isort:skip diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 9f5957d..87fd60b 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1,4 +1,8 @@ -[![pytest](https://github.com/YunoHost-Apps/django_example_ynh/actions/workflows/pytest.yml/badge.svg)](https://github.com/YunoHost-Apps/django_example_ynh/actions/workflows/pytest.yml) [![YunoHost apps package linter](https://github.com/YunoHost-Apps/django_example_ynh/actions/workflows/package_linter.yml/badge.svg)](https://github.com/YunoHost-Apps/django_example_ynh/actions/workflows/package_linter.yml) +[![tests](https://github.com/YunoHost-Apps/django_example_ynh/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/YunoHost-Apps/django_example_ynh/actions/workflows/tests.yml) +[![codecov](https://codecov.io/github/jedie/django_example_ynh/branch/main/graph/badge.svg)](https://codecov.io/github/jedie/django_example_ynh) +[![django_example_ynh @ PyPi](https://img.shields.io/pypi/v/django_example_ynh?label=django_example_ynh%20%40%20PyPi)](https://pypi.org/project/django_example_ynh/) +[![Python Versions](https://img.shields.io/pypi/pyversions/django_example_ynh)](https://github.com/YunoHost-Apps/django_example_ynh/blob/main/pyproject.toml) +[![License GPL-3.0](https://img.shields.io/pypi/l/django_example_ynh)](https://github.com/YunoHost-Apps/django_example_ynh/blob/main/LICENSE) Demo [YunoHost Application](https://install-app.yunohost.org/?app=django_example_ynh) to demonstrate the integration of a [Python](https://www.python.org/)/[Django](https://www.djangoproject.com/) project under YunoHost using [django_yunohost_integration](https://github.com/YunoHost-Apps/django_yunohost_integration). diff --git a/pyproject.toml b/pyproject.toml index 53b63fb..374a5bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,19 +1,20 @@ [tool.poetry] name = "django_example_ynh" -version = "0.1.0rc0~ynh1" +version = "0.1.0rc0+ynh1" description = "Demo YunoHost Application to demonstrate the integration of a Django project under YunoHost." authors = ["Jens Diemer "] -license = "GPL-3.0" homepage = "https://github.com/YunoHost-Apps/django_example_ynh" +license = "GPL-3.0" +readme = 'README.md' [tool.poetry.urls] "Bug Tracker" = "https://github.com/YunoHost-Apps/django_example_ynh/issues" [tool.poetry.dependencies] python = ">=3.9,<4.0.0" # Stay with 3.9 until YunoHost used >=Debian 11 (Bullseye) - +# django_example = ">=0.1.0rc0" # https://github.com/jedie/django-example - +# # extras "ynh" will install: gunicorn, psycopg2, django-redis and django-axes # see: https://github.com/YunoHost-Apps/django_yunohost_integration/blob/main/pyproject.toml django_yunohost_integration = {version = ">=0.5.0rc1", extras = ["ynh"]} # https://github.com/YunoHost-Apps/django_yunohost_integration @@ -22,16 +23,21 @@ django_yunohost_integration = {version = ">=0.5.0rc1", extras = ["ynh"]} # http [tool.poetry.dev-dependencies] bx_py_utils = "*" # https://github.com/boxine/bx_py_utils bx_django_utils = "*" # https://github.com/boxine/bx_django_utils -tox = "*" +tox = "*" # https://github.com/tox-dev/tox +coveralls = "*" # http://github.com/TheKevJames/coveralls-python +darker = "*" # https://github.com/akaihola/pytest-darker +isort = "*" # https://github.com/pycqa/isort +flake8 = "*" # https://github.com/pycqa/flake8 +EditorConfig = "*" # https://github.com/editorconfig/editorconfig-core-py +safety = "*" # https://github.com/pyupio/safety +mypy = "*" # https://github.com/python/mypy +tomli = "*" # https://github.com/hukkin/tomli +twine = "*" # https://github.com/pypa/twine +poetry-publish = "*" # https://github.com/jedie/poetry-publish pytest = "*" pytest-cov = "*" pytest-django = "*" pytest-darker = "*" # https://github.com/akaihola/pytest-darker -coveralls = "*" -isort = "*" -flake8 = "*" -EditorConfig = "*" # https://github.com/editorconfig/editorconfig-core-py -safety = "*" # https://github.com/pyupio/safety requests = "*" # https://github.com/psf/requests packaging = "*" # https://github.com/pypa/packagi beautifulsoup4 = "*" # https://pypi.org/project/beautifulsoup4/ @@ -62,7 +68,7 @@ log_level = "INFO" # https://pycqa.github.io/isort/docs/configuration/config_files/#pyprojecttoml-preferred-format atomic=true profile='black' -skip_glob=["*/htmlcov/*","*/migrations/*","*/local_test/*"] +skip_glob=[".*", "*/htmlcov/*","*/migrations/*","*/local_test/*"] known_first_party=['django_example'] line_length=100 lines_after_imports=2 @@ -96,7 +102,7 @@ addopts = """ [tool.coverage.run] -omit = [".*"] +omit = ['.*', '*/tests/*'] [tool.tox] @@ -122,6 +128,7 @@ cookiecutter_template = "https://github.com/jedie/cookiecutter_templates/" cookiecutter_directory = "yunohost_django_package" applied_migrations = [ "4dbd146", # 2022-11-06T17:59:58+01:00 + "baf1ebc", # 2022-11-30T21:19:10+01:00 ] [manageprojects.cookiecutter_context.cookiecutter] @@ -137,6 +144,7 @@ bug_tracker_url = "https://github.com/jedie/django-example/issues" upstream_version = "0.1.0rc0" ynh_version = "1" description = "Demo YunoHost Application to demonstrate the integration of a Django project under YunoHost." +package_description = "Demo YunoHost Application to demonstrate the integration of a Django project under YunoHost." license = "GPL-3.0" _template = "https://github.com/jedie/cookiecutter_templates/" _output_dir = "~/repos_ynh/django_example_ynh" diff --git a/tests/conftest.py b/tests/conftest.py index e7d56d8..75f20f0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,7 +11,6 @@ import sys from pathlib import Path import django - from django_yunohost_integration.local_test import create_local_test diff --git a/tests/test_django_project.py b/tests/test_django_project.py index c4f7862..1416a8f 100644 --- a/tests/test_django_project.py +++ b/tests/test_django_project.py @@ -5,7 +5,6 @@ from django.contrib.auth.models import User from django.test import override_settings from django.test.testcases import TestCase from django.urls.base import reverse - from django_yunohost_integration.test_utils import generate_basic_auth diff --git a/tests/test_example_project.py b/tests/test_example_project.py index 5b361d4..f0ac44e 100644 --- a/tests/test_example_project.py +++ b/tests/test_example_project.py @@ -7,6 +7,7 @@ from bx_django_utils.test_utils.html_assertion import ( from django.conf import settings from django.test.testcases import TestCase from django.urls.base import reverse + from django_example import __version__ @@ -28,7 +29,7 @@ class ExampleProjectTestCase(HtmlAssertionMixin, TestCase): response, parts=( f'

YunoHost Django Example Project v{__version__}

', - '

Go to Django Admin.

', + '
  • Django Admin
  • ', '

    Log in to see more information

    ', 'User:AnonymousUser', 'META:', @@ -56,7 +57,7 @@ class ExampleProjectTestCase(HtmlAssertionMixin, TestCase): response, parts=( f'

    YunoHost Django Example Project v{__version__}

    ', - '

    Go to Django Admin.

    ', + '
  • Django Admin
  • ', 'User:test', f'Process ID:{os.getpid()}', ), diff --git a/tests/test_example_project_urls_1.snapshot.html b/tests/test_example_project_urls_1.snapshot.html index 8ee5cc0..4dd2e82 100644 --- a/tests/test_example_project_urls_1.snapshot.html +++ b/tests/test_example_project_urls_1.snapshot.html @@ -64,6 +64,14 @@ AnonymousUser + + + Remote Address: + + + 127.0.0.1 + + Process User: @@ -135,7 +143,7 @@

    - github.com/jedie/django-example + github.com/jedie/django_example

    diff --git a/tests/test_project_setup.py b/tests/test_project_setup.py index 6dfdd6e..feff773 100644 --- a/tests/test_project_setup.py +++ b/tests/test_project_setup.py @@ -8,10 +8,10 @@ import tomli from bx_django_utils.filename import clean_filename from bx_py_utils.path import assert_is_dir, assert_is_file from django_tools.unittest_utils.project_setup import check_editor_config - -import django_yunohost_integration from django_yunohost_integration.test_utils import assert_project_version +from django_example import __version__ + PACKAGE_ROOT = Path(__file__).parent.parent @@ -25,17 +25,17 @@ def assert_file_contains_string(file_path, string): def test_version(): - upstream_version = django_yunohost_integration.__version__ - assert_project_version( - current_version=upstream_version, - github_project_url='https://github.com/YunoHost-Apps/django_yunohost_integration', + current_version=__version__, + github_project_url='https://github.com/jedie/django-example', ) pyproject_toml_path = Path(PACKAGE_ROOT, 'pyproject.toml') pyproject_toml = tomli.loads(pyproject_toml_path.read_text(encoding='UTF-8')) pyproject_version = pyproject_toml['tool']['poetry']['version'] - assert pyproject_version.startswith(f'{upstream_version}+ynh') + assert pyproject_version.startswith(f'{__version__}+ynh'), ( + f'{pyproject_version!r} does not start with "{__version__}+ynh"' + ) # pyproject.toml needs a PEP 440 conform version and used "+ynh" # the YunoHost syntax is: "~ynh", just "convert this: