diff --git a/.coveragerc b/.coveragerc index d66452f..85b5d1b 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,2 +1,2 @@ [run] -source = python_django_blog +source = articles,python_django_blog diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 69bc77f..8e2824c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,31 +1,39 @@ version: 2 updates: + # Экосистема uv покрывает и pyproject.toml, и uv.lock. Отдельный блок pip на + # том же каталоге давал бы вторую пачку PR на те же зависимости. - package-ecosystem: "uv" directory: "/" schedule: interval: "monthly" open-pull-requests-limit: 1 + labels: ["dependencies", "automated"] + commit-message: + prefix: "chore" groups: - all-uv-dependencies: - patterns: - - "*" + uv-all: + patterns: ["*"] - - package-ecosystem: "docker" + - package-ecosystem: "github-actions" directory: "/" schedule: interval: "monthly" open-pull-requests-limit: 1 + labels: ["dependencies", "automated"] + commit-message: + prefix: "chore" groups: - all-docker-dependencies: - patterns: - - "*" + github-actions-all: + patterns: ["*"] - - package-ecosystem: "github-actions" + - package-ecosystem: "docker" directory: "/" schedule: interval: "monthly" open-pull-requests-limit: 1 + labels: ["dependencies", "automated"] + commit-message: + prefix: "chore" groups: - all-github-actions-dependencies: - patterns: - - "*" + docker-all: + patterns: ["*"] diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml new file mode 100644 index 0000000..22c4d6b --- /dev/null +++ b/.github/workflows/pr-title.yml @@ -0,0 +1,24 @@ +name: PR Title + +# Заголовок PR обязан быть conventional commit: при squash-мерже он становится +# сообщением коммита, а по нему release-please определяет, какой разряд версии +# поднять. Проверка отдельных коммитов ветки намеренно не делается, чтобы не +# мешать работе внутри PR. +on: + pull_request_target: + types: + - opened + - edited + - synchronize + - reopened + +permissions: + pull-requests: read + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pyci.yml b/.github/workflows/pyci.yml index 4e90980..e9d424c 100644 --- a/.github/workflows/pyci.yml +++ b/.github/workflows/pyci.yml @@ -14,18 +14,19 @@ jobs: steps: - uses: actions/checkout@v7 - - uses: actions/setup-python@v7 - with: - python-version: '3.13' - - name: Install dependencies - run: | - pip install uv - make setup + # setup-python не нужен: версию питона держит .python-version, и uv сам + # ставит её при первом `uv sync`. Единый источник версии, поэтому раннер + # и образ кита не могут разойтись. + - uses: astral-sh/setup-uv@v10.0.0 + + - name: Setup + run: make setup - - name: Run tests and linter - run: | - make check + - name: Run linter + run: make lint + - name: Run tests + run: make test deploy: needs: build diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..6324d40 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.14 diff --git a/Makefile b/Makefile index 3bcb9c8..f641eaa 100644 --- a/Makefile +++ b/Makefile @@ -38,9 +38,9 @@ lint: test: uv run manage.py test -check: test lint +check: install lint test test-coverage: - uv run coverage run manage.py test python_django_blog + uv run coverage run manage.py test uv run coverage html uv run coverage report diff --git a/python_django_blog/articles/__init__.py b/articles/__init__.py similarity index 100% rename from python_django_blog/articles/__init__.py rename to articles/__init__.py diff --git a/python_django_blog/articles/apps.py b/articles/apps.py similarity index 75% rename from python_django_blog/articles/apps.py rename to articles/apps.py index c6d410b..166ff9c 100644 --- a/python_django_blog/articles/apps.py +++ b/articles/apps.py @@ -3,4 +3,4 @@ class ArticlesConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' - name = 'python_django_blog.articles' + name = 'articles' diff --git a/python_django_blog/articles/forms.py b/articles/forms.py similarity index 73% rename from python_django_blog/articles/forms.py rename to articles/forms.py index 50542b7..c0521f8 100644 --- a/python_django_blog/articles/forms.py +++ b/articles/forms.py @@ -1,5 +1,5 @@ from django.forms import ModelForm -from python_django_blog.articles.models import Article +from articles.models import Article class ArticleForm(ModelForm): diff --git a/python_django_blog/articles/migrations/0001_initial.py b/articles/migrations/0001_initial.py similarity index 100% rename from python_django_blog/articles/migrations/0001_initial.py rename to articles/migrations/0001_initial.py diff --git a/python_django_blog/articles/migrations/__init__.py b/articles/migrations/__init__.py similarity index 100% rename from python_django_blog/articles/migrations/__init__.py rename to articles/migrations/__init__.py diff --git a/python_django_blog/articles/models.py b/articles/models.py similarity index 100% rename from python_django_blog/articles/models.py rename to articles/models.py diff --git a/python_django_blog/templates/articles/create.html b/articles/templates/articles/create.html similarity index 100% rename from python_django_blog/templates/articles/create.html rename to articles/templates/articles/create.html diff --git a/python_django_blog/templates/articles/delete.html b/articles/templates/articles/delete.html similarity index 100% rename from python_django_blog/templates/articles/delete.html rename to articles/templates/articles/delete.html diff --git a/python_django_blog/templates/articles/detail.html b/articles/templates/articles/detail.html similarity index 100% rename from python_django_blog/templates/articles/detail.html rename to articles/templates/articles/detail.html diff --git a/python_django_blog/templates/articles/index.html b/articles/templates/articles/index.html similarity index 100% rename from python_django_blog/templates/articles/index.html rename to articles/templates/articles/index.html diff --git a/python_django_blog/templates/articles/update.html b/articles/templates/articles/update.html similarity index 100% rename from python_django_blog/templates/articles/update.html rename to articles/templates/articles/update.html diff --git a/python_django_blog/articles/tests.py b/articles/tests.py similarity index 98% rename from python_django_blog/articles/tests.py rename to articles/tests.py index 57497d3..9f076f8 100644 --- a/python_django_blog/articles/tests.py +++ b/articles/tests.py @@ -2,7 +2,7 @@ from django.test import TestCase from django.urls import reverse -from python_django_blog.articles.models import Article +from articles.models import Article from python_django_blog.utils import get_test_data diff --git a/python_django_blog/articles/urls.py b/articles/urls.py similarity index 90% rename from python_django_blog/articles/urls.py rename to articles/urls.py index 0e76790..c612c0f 100644 --- a/python_django_blog/articles/urls.py +++ b/articles/urls.py @@ -1,5 +1,5 @@ from django.urls import path -from python_django_blog.articles import views +from articles import views app_name = 'articles' diff --git a/python_django_blog/articles/views.py b/articles/views.py similarity index 86% rename from python_django_blog/articles/views.py rename to articles/views.py index 64815cd..20bd1b1 100644 --- a/python_django_blog/articles/views.py +++ b/articles/views.py @@ -7,8 +7,8 @@ UpdateView, ) -from python_django_blog.articles.forms import ArticleForm -from python_django_blog.articles.models import Article +from articles.forms import ArticleForm +from articles.models import Article class IndexView(ListView): diff --git a/pyproject.toml b/pyproject.toml index 775f67e..9abef95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ description = "A simple Django project that implements a simple blog" authors = [{name="Hexlet Team "}] license = "ISC" readme = "README.md" -requires-python = ">=3.13" +requires-python = ">=3.14" dependencies = [ "dj-database-url>=3.1.2", "django>=6.0.6", diff --git a/python_django_blog/settings.py b/python_django_blog/settings.py index 1f5c90f..a3d2efb 100644 --- a/python_django_blog/settings.py +++ b/python_django_blog/settings.py @@ -45,7 +45,7 @@ 'django.contrib.staticfiles', 'bootstrap4', 'python_django_blog', - 'python_django_blog.articles', + 'articles', ] MIDDLEWARE = [ diff --git a/python_django_blog/urls.py b/python_django_blog/urls.py index d8f15db..18aeb5d 100644 --- a/python_django_blog/urls.py +++ b/python_django_blog/urls.py @@ -20,5 +20,5 @@ urlpatterns = [ path('', views.IndexView.as_view(), name='root'), path('about/', views.AboutView.as_view(), name='about'), - path('articles/', include('python_django_blog.articles.urls')), + path('articles/', include('articles.urls')), ] diff --git a/uv.lock b/uv.lock index dc970cc..a12e445 100644 --- a/uv.lock +++ b/uv.lock @@ -1,6 +1,6 @@ version = 1 revision = 3 -requires-python = ">=3.13" +requires-python = ">=3.14" [[package]] name = "asgiref"