diff --git a/.ci/ansible/Containerfile.j2 b/.ci/ansible/Containerfile.j2 index a446f339..13b5ff05 100644 --- a/.ci/ansible/Containerfile.j2 +++ b/.ci/ansible/Containerfile.j2 @@ -10,9 +10,8 @@ ADD ./{{ item.origin }} {{ item.destination }} {%- endfor %} # This MUST be the ONLY call to pip install in inside the container. -RUN pip3 install --upgrade pip setuptools wheel && \ - rm -rf /root/.cache/pip && \ - pip3 install {{ image.source }} +RUN --mount=type=cache,target=/root/.cache/uv uv pip install --upgrade setuptools wheel && \ + uv pip install {{ image.source }} {%- if image.upperbounds | default(false) -%} {{ " " }}-c ./{{ plugin_name }}/upperbounds_constraints.txt {%- endif -%} @@ -22,8 +21,7 @@ RUN pip3 install --upgrade pip setuptools wheel && \ {%- if image.ci_requirements | default(false) -%} {{ " " }}-r ./{{ plugin_name }}/ci_requirements.txt {%- endif -%} -{{ " " }}-c ./{{ plugin_name }}/.ci/assets/ci_constraints.txt && \ - rm -rf /root/.cache/pip +{{ " " }}-c ./{{ plugin_name }}/.ci/assets/ci_constraints.txt {% if pulp_env is defined and pulp_env %} {% for key, value in pulp_env.items() %} diff --git a/.ci/scripts/check_gettext.sh b/.ci/scripts/check_gettext.sh deleted file mode 100755 index e1b70e7a..00000000 --- a/.ci/scripts/check_gettext.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# WARNING: DO NOT EDIT! -# -# This file was generated by plugin_template, and is managed by it. Please use -# './plugin-template --github pulp_deb' to update this file. -# -# For more info visit https://github.com/pulp/plugin_template - -# make sure this script runs at the repo root -cd "$(dirname "$(realpath -e "$0")")"/../.. - -set -u - -MATCHES="$(grep -n -r --include \*.py "_(f" pulp_deb )" - -if [ $? -ne 1 ]; then - printf "\nERROR: Detected mix of f-strings and gettext:\n" - echo "$MATCHES" - exit 1 -fi diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3e963b27..75c47521 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -44,10 +44,6 @@ jobs: run: | ruff check - - name: "Check for common gettext problems" - run: | - sh .ci/scripts/check_gettext.sh - - name: "Run extra lint checks" run: | [ ! -x .ci/scripts/extra_linting.sh ] || .ci/scripts/extra_linting.sh diff --git a/pulp_deb/app/management/commands/check_dangling_content.py b/pulp_deb/app/management/commands/check_dangling_content.py index e0f5f01d..276a5730 100644 --- a/pulp_deb/app/management/commands/check_dangling_content.py +++ b/pulp_deb/app/management/commands/check_dangling_content.py @@ -1,6 +1,7 @@ from gettext import gettext as _ from django.core.management import BaseCommand + from pulpcore.plugin.models import RepositoryVersion from pulp_deb.app.models.content.content import Package diff --git a/pulp_deb/app/modelresource.py b/pulp_deb/app/modelresource.py index 4febf2b2..b92c0a92 100644 --- a/pulp_deb/app/modelresource.py +++ b/pulp_deb/app/modelresource.py @@ -1,5 +1,6 @@ from import_export import fields from import_export.widgets import ForeignKeyWidget + from pulpcore.plugin.importexport import BaseContentResource from pulpcore.plugin.modelresources import RepositoryResource from pulpcore.plugin.util import get_domain diff --git a/pulp_deb/app/models/content/content.py b/pulp_deb/app/models/content/content.py index 8eb67dd0..acc1d6e4 100644 --- a/pulp_deb/app/models/content/content.py +++ b/pulp_deb/app/models/content/content.py @@ -11,6 +11,7 @@ from django.db import models from django.db.models import JSONField + from pulpcore.plugin.models import Content BOOL_CHOICES = [(True, "yes"), (False, "no")] diff --git a/pulp_deb/app/models/content/metadata.py b/pulp_deb/app/models/content/metadata.py index cdd2fc57..4809a4b1 100644 --- a/pulp_deb/app/models/content/metadata.py +++ b/pulp_deb/app/models/content/metadata.py @@ -6,6 +6,7 @@ """ from django.db import models + from pulpcore.plugin.models import Content from pulp_deb.app.constants import NULL_VALUE diff --git a/pulp_deb/app/models/content/structure_content.py b/pulp_deb/app/models/content/structure_content.py index 4eb6b953..00d81fd2 100644 --- a/pulp_deb/app/models/content/structure_content.py +++ b/pulp_deb/app/models/content/structure_content.py @@ -14,6 +14,7 @@ import os from django.db import models + from pulpcore.plugin.models import Content from pulp_deb.app.models import Package, SourcePackage diff --git a/pulp_deb/app/models/content/verbatim_metadata.py b/pulp_deb/app/models/content/verbatim_metadata.py index fe0f3aae..4b63efa4 100644 --- a/pulp_deb/app/models/content/verbatim_metadata.py +++ b/pulp_deb/app/models/content/verbatim_metadata.py @@ -6,6 +6,7 @@ """ from django.db import models + from pulpcore.plugin.models import Content BOOL_CHOICES = [(True, "yes"), (False, "no")] diff --git a/pulp_deb/app/models/publication.py b/pulp_deb/app/models/publication.py index 3e030d93..f5b04951 100644 --- a/pulp_deb/app/models/publication.py +++ b/pulp_deb/app/models/publication.py @@ -4,6 +4,7 @@ from django.db import models from django.utils import timezone from django_lifecycle import AFTER_CREATE, AFTER_UPDATE, hook + from pulpcore.plugin.models import ( AutoAddObjPermsMixin, BaseModel, diff --git a/pulp_deb/app/models/remote.py b/pulp_deb/app/models/remote.py index b23a2e36..82288c74 100644 --- a/pulp_deb/app/models/remote.py +++ b/pulp_deb/app/models/remote.py @@ -1,4 +1,5 @@ from django.db import models + from pulpcore.plugin.models import AutoAddObjPermsMixin, Remote diff --git a/pulp_deb/app/models/repository.py b/pulp_deb/app/models/repository.py index 60aca8fa..ee40fdd6 100644 --- a/pulp_deb/app/models/repository.py +++ b/pulp_deb/app/models/repository.py @@ -2,6 +2,7 @@ from gettext import gettext as _ from django.db import models + from pulpcore.plugin.models import ( AutoAddObjPermsMixin, BaseModel, diff --git a/pulp_deb/app/models/signing_service.py b/pulp_deb/app/models/signing_service.py index 97561e66..e080489b 100644 --- a/pulp_deb/app/models/signing_service.py +++ b/pulp_deb/app/models/signing_service.py @@ -2,6 +2,7 @@ import tempfile import gnupg + from pulpcore.plugin.models import SigningService diff --git a/pulp_deb/app/serializers/content_serializers.py b/pulp_deb/app/serializers/content_serializers.py index 66f26f6f..358f49c0 100644 --- a/pulp_deb/app/serializers/content_serializers.py +++ b/pulp_deb/app/serializers/content_serializers.py @@ -4,6 +4,15 @@ from debian import deb822, debfile from django.conf import settings +from rest_framework.serializers import ( + CharField, + DictField, + Field, + ListField, + Serializer, + ValidationError, +) + from pulpcore.plugin.models import Artifact, Content, CreatedResource from pulpcore.plugin.serializers import ( ContentChecksumSerializer, @@ -14,14 +23,6 @@ SingleArtifactContentUploadSerializer, SingleContentArtifactField, ) -from rest_framework.serializers import ( - CharField, - DictField, - Field, - ListField, - Serializer, - ValidationError, -) from pulp_deb.app.constants import ( NULL_VALUE, diff --git a/pulp_deb/app/serializers/publication_serializers.py b/pulp_deb/app/serializers/publication_serializers.py index 9b707667..7533b032 100644 --- a/pulp_deb/app/serializers/publication_serializers.py +++ b/pulp_deb/app/serializers/publication_serializers.py @@ -1,3 +1,5 @@ +from rest_framework.serializers import BooleanField, ValidationError + from pulpcore.plugin.models import Publication from pulpcore.plugin.serializers import ( DetailRelatedField, @@ -5,7 +7,6 @@ PublicationSerializer, RelatedField, ) -from rest_framework.serializers import BooleanField, ValidationError from pulp_deb.app.models import ( AptDistribution, diff --git a/pulp_deb/app/serializers/remote_serializers.py b/pulp_deb/app/serializers/remote_serializers.py index dd6cf7f1..1c939de4 100644 --- a/pulp_deb/app/serializers/remote_serializers.py +++ b/pulp_deb/app/serializers/remote_serializers.py @@ -1,6 +1,7 @@ +from rest_framework.serializers import BooleanField, CharField, ChoiceField + from pulpcore.plugin.models import Remote from pulpcore.plugin.serializers import RemoteSerializer -from rest_framework.serializers import BooleanField, CharField, ChoiceField from pulp_deb.app.models import AptRemote diff --git a/pulp_deb/app/serializers/repository_serializers.py b/pulp_deb/app/serializers/repository_serializers.py index df5fa4ae..b6ad4152 100644 --- a/pulp_deb/app/serializers/repository_serializers.py +++ b/pulp_deb/app/serializers/repository_serializers.py @@ -2,6 +2,9 @@ from django.db import transaction from jsonschema import Draft7Validator +from rest_framework import serializers +from rest_framework.exceptions import ValidationError as DRFValidationError + from pulpcore.plugin.models import SigningService from pulpcore.plugin.serializers import ( RelatedField, @@ -10,8 +13,6 @@ validate_unknown_fields, ) from pulpcore.plugin.util import get_url -from rest_framework import serializers -from rest_framework.exceptions import ValidationError as DRFValidationError from pulp_deb.app.models import ( AptReleaseSigningService, @@ -192,7 +193,7 @@ def validate(self, data): err.append(error.message) if err: raise serializers.ValidationError( - _("Provided copy criteria is invalid:'{}'".format(err)) + _("Provided copy criteria is invalid:'{}'").format(err) ) return data diff --git a/pulp_deb/app/tasks/copy.py b/pulp_deb/app/tasks/copy.py index 1b721d12..09c22617 100644 --- a/pulp_deb/app/tasks/copy.py +++ b/pulp_deb/app/tasks/copy.py @@ -3,6 +3,7 @@ from django.db import transaction from django.db.models import Q + from pulpcore.plugin.models import RepositoryVersion from pulp_deb.app.models import ( diff --git a/pulp_deb/app/tasks/publishing.py b/pulp_deb/app/tasks/publishing.py index 72ad74ca..8f206477 100644 --- a/pulp_deb/app/tasks/publishing.py +++ b/pulp_deb/app/tasks/publishing.py @@ -17,6 +17,7 @@ from django.db import transaction from django.db.utils import IntegrityError from django.forms.models import model_to_dict + from pulpcore.plugin.models import ( Artifact, PublishedArtifact, diff --git a/pulp_deb/app/tasks/synchronizing.py b/pulp_deb/app/tasks/synchronizing.py index aa06ccbd..691c0bae 100644 --- a/pulp_deb/app/tasks/synchronizing.py +++ b/pulp_deb/app/tasks/synchronizing.py @@ -17,6 +17,8 @@ from debian import deb822 from django.conf import settings from django.db.utils import IntegrityError +from rest_framework.exceptions import ValidationError + from pulpcore.plugin.exceptions import DigestValidationError from pulpcore.plugin.models import ( Artifact, @@ -36,7 +38,6 @@ ResolveContentFutures, Stage, ) -from rest_framework.exceptions import ValidationError from pulp_deb.app.constants import ( CHECKSUM_TYPE_MAP, diff --git a/pulp_deb/tests/conftest.py b/pulp_deb/tests/conftest.py index 221b2d58..e684193d 100644 --- a/pulp_deb/tests/conftest.py +++ b/pulp_deb/tests/conftest.py @@ -1,6 +1,7 @@ from pathlib import Path import pytest + from pulpcore.client.pulp_deb import ( ApiClient, AptRepositorySyncURL, diff --git a/pulp_deb/tests/functional/api/test_crud_remotes.py b/pulp_deb/tests/functional/api/test_crud_remotes.py index ab386523..0290bf71 100644 --- a/pulp_deb/tests/functional/api/test_crud_remotes.py +++ b/pulp_deb/tests/functional/api/test_crud_remotes.py @@ -4,6 +4,7 @@ from uuid import uuid4 import pytest + from pulpcore.client.pulp_deb.exceptions import ApiException from pulp_deb.tests.functional.constants import DOWNLOAD_POLICIES diff --git a/pulp_deb/tests/functional/api/test_duplicate_packages.py b/pulp_deb/tests/functional/api/test_duplicate_packages.py index 1509f5f0..62d6fcb4 100644 --- a/pulp_deb/tests/functional/api/test_duplicate_packages.py +++ b/pulp_deb/tests/functional/api/test_duplicate_packages.py @@ -12,6 +12,7 @@ from uuid import uuid4 import pytest + from pulpcore.tests.functional.utils import PulpTaskError from pulp_deb.tests.functional.constants import DEB_PACKAGE_RELPATH diff --git a/pulp_deb/tests/functional/api/test_publish.py b/pulp_deb/tests/functional/api/test_publish.py index 28df0602..324261b5 100644 --- a/pulp_deb/tests/functional/api/test_publish.py +++ b/pulp_deb/tests/functional/api/test_publish.py @@ -3,6 +3,7 @@ import pytest from debian import deb822 + from pulpcore.client.pulp_deb.exceptions import ApiException from pulp_deb.tests.functional.constants import ( diff --git a/pulp_deb/tests/functional/api/test_rbac.py b/pulp_deb/tests/functional/api/test_rbac.py index 36549ef5..4a2164f6 100644 --- a/pulp_deb/tests/functional/api/test_rbac.py +++ b/pulp_deb/tests/functional/api/test_rbac.py @@ -1,6 +1,7 @@ """Tests role-based access control.""" import pytest + from pulpcore.client.pulp_deb.exceptions import ApiException from pulp_deb.tests.functional.constants import DEB_PACKAGE_RELPATH diff --git a/pulp_deb/tests/functional/api/test_source_package.py b/pulp_deb/tests/functional/api/test_source_package.py index c0457b19..7c68ca09 100644 --- a/pulp_deb/tests/functional/api/test_source_package.py +++ b/pulp_deb/tests/functional/api/test_source_package.py @@ -5,6 +5,7 @@ from uuid import uuid4 import pytest + from pulpcore.client.pulpcore.exceptions import ApiException from pulp_deb.tests.functional.utils import ( diff --git a/pulp_deb/tests/functional/api/test_sync.py b/pulp_deb/tests/functional/api/test_sync.py index d07905a5..02c317c0 100644 --- a/pulp_deb/tests/functional/api/test_sync.py +++ b/pulp_deb/tests/functional/api/test_sync.py @@ -1,6 +1,7 @@ """Tests that sync deb repositories in optimized mode.""" import pytest + from pulpcore.tests.functional.utils import PulpTaskError from pulp_deb.tests.functional.constants import ( diff --git a/pulp_deb/tests/functional/conftest.py b/pulp_deb/tests/functional/conftest.py index 7c96e19e..60fafcd9 100644 --- a/pulp_deb/tests/functional/conftest.py +++ b/pulp_deb/tests/functional/conftest.py @@ -6,6 +6,7 @@ from uuid import uuid4 import pytest + from pulpcore.client.pulp_deb import ( ContentGenericContentsApi, ContentPackageIndicesApi, diff --git a/pulp_deb/tests/unit/test_models.py b/pulp_deb/tests/unit/test_models.py index d01f8b94..1a7b42a5 100644 --- a/pulp_deb/tests/unit/test_models.py +++ b/pulp_deb/tests/unit/test_models.py @@ -1,5 +1,6 @@ from django.core.files.uploadedfile import SimpleUploadedFile from django.test import TestCase + from pulpcore.plugin.models import Artifact, ContentArtifact from pulp_deb.app.models import Package diff --git a/pulp_deb/tests/unit/test_serializers.py b/pulp_deb/tests/unit/test_serializers.py index b44b3392..535cdce4 100644 --- a/pulp_deb/tests/unit/test_serializers.py +++ b/pulp_deb/tests/unit/test_serializers.py @@ -1,6 +1,7 @@ import unittest from django.test import TestCase + from pulpcore.plugin.models import Artifact from pulp_deb.app.models import GenericContent diff --git a/pyproject.toml b/pyproject.toml index 6cc078e7..120fa3ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -177,3 +177,22 @@ extend-exclude = [ "docs/**", "**/migrations/*.py", ] + +[tool.ruff.lint] +# This section is managed by the plugin template. Do not edit manually. +extend-select = [ + "I", + "INT", + "TID", + "T10", +] + +[tool.ruff.lint.flake8-tidy-imports.banned-api] +# This section is managed by the plugin template. Do not edit manually. +"distutils".msg = "The 'distutils' module has been deprecated since Python 3.9." +"pulpcore.app".msg = "The 'pulpcore' apis must only be consumed via 'pulpcore.plugin'." + +[tool.ruff.lint.isort] +# This section is managed by the plugin template. Do not edit manually. +sections = { second-party = ["pulpcore"] } +section-order = ["future", "standard-library", "third-party", "second-party", "first-party", "local-folder"] diff --git a/template_config.yml b/template_config.yml index ae363a51..f8b4d02d 100644 --- a/template_config.yml +++ b/template_config.yml @@ -7,7 +7,6 @@ --- check_commit_message: true -check_gettext: true check_manifest: true check_stray_pulpcore_imports: true ci_base_image: "ghcr.io/pulp/pulp-ci-centos9"