Apply manageprojects update

This commit is contained in:
Jens Diemer 2022-12-21 19:19:37 +01:00
parent 376e4f3cac
commit 9013003ef6
10 changed files with 49 additions and 28 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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).

View file

@ -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 <django_example_ynh@jensdiemer.de>"]
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"

View file

@ -11,7 +11,6 @@ import sys
from pathlib import Path
import django
from django_yunohost_integration.local_test import create_local_test

View file

@ -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

View file

@ -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'<h2>YunoHost Django Example Project v{__version__}</h2>',
'<p>Go to <a href="/app_path/admin/">Django Admin</a>.</p>',
'<li><a href="/app_path/admin/">Django Admin</a></li>',
'<p>Log in to see more information</p>',
'<tr><td>User:</td><td>AnonymousUser</td></tr>',
'<tr><td>META:</td><td></td></tr>',
@ -56,7 +57,7 @@ class ExampleProjectTestCase(HtmlAssertionMixin, TestCase):
response,
parts=(
f'<h2>YunoHost Django Example Project v{__version__}</h2>',
'<p>Go to <a href="/app_path/admin/">Django Admin</a>.</p>',
'<li><a href="/app_path/admin/">Django Admin</a></li>',
'<tr><td>User:</td><td>test</td></tr>',
f'<tr><td>Process ID:</td><td>{os.getpid()}</td></tr>',
),

View file

@ -64,6 +64,14 @@
AnonymousUser
</td>
</tr>
<tr>
<td>
Remote Address:
</td>
<td>
127.0.0.1
</td>
</tr>
<tr>
<td>
Process User:
@ -135,7 +143,7 @@
<hr/>
<p>
<a href="https://github.com/jedie/django-example">
github.com/jedie/django-example
github.com/jedie/django_example
</a>
</p>
</div>

View file

@ -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: