Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ci/ansible/filter/repr.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import absolute_import, division, print_function

from packaging.version import parse as parse_version

__metaclass__ = type
Expand Down
5 changes: 3 additions & 2 deletions .ci/scripts/calc_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

import argparse
import fileinput
import urllib.request
import sys
import urllib.request

import yaml
from packaging.requirements import Requirement
from packaging.version import Version
import yaml

try:
import tomllib
Expand Down
21 changes: 0 additions & 21 deletions .ci/scripts/check_gettext.sh

This file was deleted.

4 changes: 2 additions & 2 deletions .ci/scripts/check_pulpcore_imports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
# make sure this script runs at the repo root
cd "$(dirname "$(realpath -e "$0")")"/../..

set -uv
set -u

# check for imports not from pulpcore.plugin. exclude tests
MATCHES=$(grep -n -r --include \*.py "from pulpcore.*import" . | grep -v "tests\|plugin")
MATCHES="$(grep -n -r --include \*.py "from pulpcore.*import" pulp_python | grep -v "tests\|plugin")"

if [ $? -ne 1 ]; then
printf "\nERROR: Detected bad imports from pulpcore:\n"
Expand Down
12 changes: 6 additions & 6 deletions .ci/scripts/check_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
# ///

import argparse
import re
import os
import re
import sys
import tomllib
import typing as t
from pathlib import Path

import tomllib
import yaml
from packaging.version import Version
from git import Repo
from packaging.version import Version

RELEASE_BRANCH_REGEX = r"^([0-9]+)\.([0-9]+)$"
Y_CHANGELOG_EXTS = [".feature"]
Expand Down Expand Up @@ -157,9 +157,9 @@ def main(options: argparse.Namespace, template_config: dict[str, t.Any]) -> int:

if reasons:
curr_version = Version(last_tag)
assert curr_version.base_version.startswith(
branch
), "Current-version has to belong to the current branch!"
assert curr_version.base_version.startswith(branch), (
"Current-version has to belong to the current branch!"
)
next_version = Version(f"{branch}.{curr_version.micro + 1}")
print(
f"A Z-release is needed for {branch}, "
Expand Down
5 changes: 2 additions & 3 deletions .ci/scripts/check_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
#
# For more info visit https://github.com/pulp/plugin_template

import tomllib
import warnings
from packaging.requirements import Requirement

import tomllib
from packaging.requirements import Requirement

CHECK_MATRIX = [
("pyproject.toml", True, True, True),
("requirements.txt", True, True, True),
("dev_requirements.txt", False, True, False),
("ci_requirements.txt", False, True, True),
("doc_requirements.txt", False, True, False),
("lint_requirements.txt", False, True, True),
Expand Down
3 changes: 1 addition & 2 deletions .ci/scripts/collect_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
import json
import os
import re
import tomllib
import urllib.request
from pathlib import Path

import tomllib
from git import GitCommandError, Repo
from packaging.version import parse as parse_version


PYPI_PROJECT = "pulp_python"

# Read Towncrier settings
Expand Down
2 changes: 1 addition & 1 deletion .ci/scripts/pr_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import re
import sys
import tomllib
from pathlib import Path

import tomllib
from git import Repo


Expand Down
2 changes: 2 additions & 0 deletions .ci/scripts/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
But some pulp paths start with curly brackets e.g. {artifact_href}
This script modifies drf-spectacular schema validation to accept slashes and curly brackets.
"""

import json

from drf_spectacular.validation import JSON_SCHEMA_SPEC_PATH

with open(JSON_SCHEMA_SPEC_PATH) as fh:
Expand Down
7 changes: 4 additions & 3 deletions .ci/scripts/skip_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
*: Error
"""

import sys
import argparse
import os
import re
import git
import sys
import textwrap
import argparse

import git

DOC_PATTERNS = [
r"^docs/",
Expand Down
1 change: 1 addition & 0 deletions .ci/scripts/update_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# For more info visit https://github.com/pulp/plugin_template

import os

from github import Github

g = Github(os.environ.get("GITHUB_TOKEN"))
Expand Down
4 changes: 2 additions & 2 deletions .ci/scripts/validate_commit_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import re
import subprocess
import sys
import tomllib
import yaml
from pathlib import Path

import tomllib
import yaml
from github import Github


Expand Down
34 changes: 0 additions & 34 deletions .flake8

This file was deleted.

9 changes: 4 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,13 @@ jobs:
run: |
yamllint -s -d '{extends: relaxed, rules: {line-length: disable}}' .github/workflows

# Lint code.
- name: "Run flake8"
- name: "Check formating"
run: |
flake8
ruff format --check --diff

- name: "Check for common gettext problems"
- name: "Lint code"
run: |
sh .ci/scripts/check_gettext.sh
ruff check

- name: "Run extra lint checks"
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from git import Repo
from git.exc import GitCommandError


helper = textwrap.dedent(
"""\
Stage the changelog for a release on main branch.
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/scripts/update_backport_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
#
# For more info visit https://github.com/pulp/plugin_template

import os
import random

import requests
import yaml
import random
import os


def random_color():
Expand Down
9 changes: 0 additions & 9 deletions dev_requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion lint_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

bump-my-version
check-manifest
flake8
packaging
ruff
yamllint
2 changes: 1 addition & 1 deletion pulp_python/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
default_app_config = 'pulp_python.app.PulpPythonPluginAppConfig'
default_app_config = "pulp_python.app.PulpPythonPluginAppConfig"
6 changes: 4 additions & 2 deletions pulp_python/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from gettext import gettext as _

from django.db.models.signals import post_migrate

from pulpcore.plugin import PulpPluginAppConfig
from gettext import gettext as _


class PulpPythonPluginAppConfig(PulpPluginAppConfig):
Expand All @@ -26,7 +28,7 @@ def ready(self):

# TODO: Remove this when https://github.com/pulp/pulpcore/issues/5500 is resolved
def _populate_pypi_access_policies(sender, apps, verbosity, **kwargs):
from pulp_python.app.pypi.views import PyPIView, SimpleView, UploadView, MetadataView
from pulp_python.app.pypi.views import MetadataView, PyPIView, SimpleView, UploadView

try:
AccessPolicy = apps.get_model("core", "AccessPolicy")
Expand Down
2 changes: 1 addition & 1 deletion pulp_python/app/fields.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from drf_spectacular.utils import extend_schema_field
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import extend_schema_field
from rest_framework import serializers


Expand Down
1 change: 0 additions & 1 deletion pulp_python/app/global_access_conditions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.conf import settings


# Access Condition methods that can be used with PyPI access policies


Expand Down
1 change: 1 addition & 0 deletions pulp_python/app/modelresource.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pulpcore.plugin.importexport import BaseContentResource
from pulpcore.plugin.modelresources import RepositoryResource
from pulpcore.plugin.util import get_domain

from pulp_python.app.models import (
PythonPackageContent,
PythonRepository,
Expand Down
15 changes: 8 additions & 7 deletions pulp_python/app/models.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
from logging import getLogger
from pathlib import PurePath

from aiohttp.web import json_response
from django.conf import settings
from django.contrib.postgres.fields import ArrayField
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.conf import settings

from pulpcore.plugin.models import (
AutoAddObjPermsMixin,
Content,
Publication,
Distribution,
Publication,
Remote,
Repository,
)
from pulpcore.plugin.repo_version_utils import remove_duplicates, validate_repo_version
from pulpcore.plugin.responses import ArtifactResponse
from pulpcore.plugin.util import get_domain, get_domain_pk

from pathlib import PurePath
from .utils import (
PYPI_LAST_SERIAL,
PYPI_SERIAL_CONSTANT,
canonicalize_name,
get_project_metadata_from_artifact,
parse_project_metadata,
python_content_to_json,
PYPI_LAST_SERIAL,
PYPI_SERIAL_CONSTANT,
)
from pulpcore.plugin.repo_version_utils import remove_duplicates, validate_repo_version
from pulpcore.plugin.util import get_domain_pk, get_domain

log = getLogger(__name__)

Expand Down
Loading