diff --git a/.ci/scripts/check_gettext.sh b/.ci/scripts/check_gettext.sh index c76864e..5d03d3e 100755 --- a/.ci/scripts/check_gettext.sh +++ b/.ci/scripts/check_gettext.sh @@ -10,9 +10,9 @@ # make sure this script runs at the repo root cd "$(dirname "$(realpath -e "$0")")"/../.. -set -uv +set -u -MATCHES=$(grep -n -r --include \*.py "_(f") +MATCHES="$(grep -n -r --include \*.py "_(f" pulp_gem )" if [ $? -ne 1 ]; then printf "\nERROR: Detected mix of f-strings and gettext:\n" diff --git a/.ci/scripts/check_pulpcore_imports.sh b/.ci/scripts/check_pulpcore_imports.sh index 4ef5fe9..fc52064 100755 --- a/.ci/scripts/check_pulpcore_imports.sh +++ b/.ci/scripts/check_pulpcore_imports.sh @@ -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_gem | grep -v "tests\|plugin")" if [ $? -ne 1 ]; then printf "\nERROR: Detected bad imports from pulpcore:\n" diff --git a/.ci/scripts/check_release.py b/.ci/scripts/check_release.py index 6e07999..1bb1f06 100755 --- a/.ci/scripts/check_release.py +++ b/.ci/scripts/check_release.py @@ -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}, " diff --git a/.ci/scripts/check_requirements.py b/.ci/scripts/check_requirements.py index c68a1d4..f38660a 100755 --- a/.ci/scripts/check_requirements.py +++ b/.ci/scripts/check_requirements.py @@ -9,10 +9,10 @@ import warnings 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), diff --git a/.ci/scripts/collect_changes.py b/.ci/scripts/collect_changes.py index c319dab..c9aeb93 100755 --- a/.ci/scripts/collect_changes.py +++ b/.ci/scripts/collect_changes.py @@ -25,6 +25,7 @@ from git import GitCommandError, Repo from packaging.version import parse as parse_version + PYPI_PROJECT = "pulp_gem" # Read Towncrier settings diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 978712f..0000000 --- a/.flake8 +++ /dev/null @@ -1,34 +0,0 @@ -# WARNING: DO NOT EDIT! -# -# This file was generated by plugin_template, and is managed by it. Please use -# './plugin-template --github pulp_gem' to update this file. -# -# For more info visit https://github.com/pulp/plugin_template -[flake8] -exclude = ./docs/*,*/migrations/* -per-file-ignores = */__init__.py: F401 - -ignore = E203,W503,Q000,Q003,D100,D104,D106,D200,D205,D400,D401,D402,F824 -max-line-length = 100 - -# Flake8 builtin codes -# -------------------- -# E203: no whitespace around ':'. disabled until https://github.com/PyCQA/pycodestyle/issues/373 is fixed -# W503: This enforces operators before line breaks which is not pep8 or black compatible. -# F824: 'nonlocal' is unused: name is never assigned in scope - -# Flake8-quotes extension codes -# ----------------------------- -# Q000: double or single quotes only, default is double (don't want to enforce this) -# Q003: Change outer quotes to avoid escaping inner quotes - -# Flake8-docstring extension codes -# -------------------------------- -# D100: missing docstring in public module -# D104: missing docstring in public package -# D106: missing docstring in public nested class (complains about "class Meta:" and documenting those is silly) -# D200: one-line docstring should fit on one line with quotes -# D205: 1 blank line required between summary line and description -# D400: First line should end with a period -# D401: first line should be imperative (nitpicky) -# D402: first line should not be the function’s “signature” (false positives) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f011d2c..e44c10e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,16 +36,13 @@ jobs: run: | yamllint -s -d '{extends: relaxed, rules: {line-length: disable}}' .github/workflows - # run black separately from flake8 to get a diff - - name: "Run black" + - name: "Check formating" run: | - black --version - black --check --diff . + ruff format --check --diff - # Lint code. - - name: "Run flake8" + - name: "Lint code" run: | - flake8 + ruff check --diff - name: "Check for common gettext problems" run: | diff --git a/.github/workflows/scripts/stage-changelog-for-default-branch.py b/.github/workflows/scripts/stage-changelog-for-default-branch.py index 93d416b..a66697a 100755 --- a/.github/workflows/scripts/stage-changelog-for-default-branch.py +++ b/.github/workflows/scripts/stage-changelog-for-default-branch.py @@ -12,13 +12,16 @@ from git import Repo from git.exc import GitCommandError -helper = textwrap.dedent("""\ + +helper = textwrap.dedent( + """\ Stage the changelog for a release on main branch. Example: $ python .github/workflows/scripts/stage-changelog-for-default-branch.py 3.4.0 - """) + """ +) parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=helper) diff --git a/dev_requirements.txt b/dev_requirements.txt deleted file mode 100644 index bd260db..0000000 --- a/dev_requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -black -bump2version -check-manifest -flake8 -flake8-docstrings -flake8-tuple -flake8-quotes -# pin pydocstyle until https://gitlab.com/pycqa/flake8-docstrings/issues/36 is resolved -pydocstyle<4 -requests diff --git a/lint_requirements.txt b/lint_requirements.txt index 6377fc2..94124c8 100644 --- a/lint_requirements.txt +++ b/lint_requirements.txt @@ -5,10 +5,8 @@ # # For more info visit https://github.com/pulp/plugin_template -black~=26.3 # Pin style to the year. https://black.readthedocs.io/en/stable/faq.html#how-stable-is-black-s-style bump-my-version check-manifest -flake8 -flake8-black packaging +ruff yamllint diff --git a/pyproject.toml b/pyproject.toml index 98bf2af..22424b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,6 +92,8 @@ replace = "version = \"{new_version}\"" filename = "./pyproject.toml" search = "version = \"{current_version}\"" replace = "version = \"{new_version}\"" + + [tool.towncrier] package = "pulp_gem" filename = "CHANGES.md" @@ -135,3 +137,11 @@ ignore = [ "AGENTS.md", "CLAUDE.md", ] + +[tool.ruff] +# This section is managed by the plugin template. Do not edit manually. +line-length = 100 +extend-exclude = [ + "docs/**", + "**/migrations/*.py", +] diff --git a/template_config.yml b/template_config.yml index 732fff1..ef7dc8a 100644 --- a/template_config.yml +++ b/template_config.yml @@ -6,7 +6,6 @@ # After editing this file please always reapply the plugin template before committing any changes. --- -black: true check_commit_message: true check_gettext: true check_manifest: true @@ -23,10 +22,9 @@ deploy_to_pypi: true disabled_redis_runners: [] docker_fixtures: false extra_files: [] -flake8: true -flake8_ignore: [] github_org: "pulp" latest_release_branch: "0.6" +lint_ignore: [] lint_requirements: true os_required_packages: [] parallel_test_workers: 8 @@ -93,7 +91,6 @@ pulp_settings_s3: - "sha512" api_root: "/rerouted/djnd/" domain_enabled: true -pydocstyle: true release_email: "pulp-infra@redhat.com" release_user: "pulpbot" stalebot: true