From 1d4454ddbeef46e9e36e74cc2fa6b541ed893098 Mon Sep 17 00:00:00 2001 From: Lubos Mjachky Date: Mon, 9 Sep 2024 11:01:56 +0200 Subject: [PATCH] Update the CI template --- .ci/run_container.sh | 67 ++++++++++++++++++-------- .ci/scripts/collect_changes.py | 2 +- .ci/scripts/create_release_branch.sh | 7 ++- .ci/scripts/validate_commit_message.py | 13 ++--- .ci/settings/settings.py | 5 +- .flake8 | 7 --- .github/dependabot.yml | 10 ++-- .github/workflows/build.yml | 2 + .github/workflows/codeql.yml | 18 +------ .github/workflows/collect_changes.yml | 2 + .github/workflows/lint.yml | 2 + .github/workflows/nightly.yml | 2 + .github/workflows/pr.yml | 2 + .github/workflows/pr_checks.yml | 43 +++++++++-------- .github/workflows/publish.yml | 2 + .github/workflows/release.yml | 2 + .github/workflows/release_branch.yml | 14 ++++++ .github/workflows/test.yml | 29 +++++------ .gitignore | 5 +- Makefile | 2 +- lint_requirements.txt | 1 + pulp-glue-ostree/tests/conftest.py | 7 +++ pyproject.toml | 57 ++++++++++++++++------ tests/conftest.py | 3 +- 24 files changed, 191 insertions(+), 113 deletions(-) delete mode 100644 .flake8 create mode 100644 pulp-glue-ostree/tests/conftest.py diff --git a/.ci/run_container.sh b/.ci/run_container.sh index 3730ff0..f92cb48 100755 --- a/.ci/run_container.sh +++ b/.ci/run_container.sh @@ -1,14 +1,5 @@ #!/bin/sh -# This file is shared between some projects please keep all copies in sync -# Known places: -# - https://github.com/pulp/pulp-cli/blob/main/.ci/run_container.sh -# - https://github.com/pulp/pulp-cli-deb/blob/main/.ci/run_container.sh -# - https://github.com/pulp/pulp-cli-gem/blob/main/.ci/run_container.sh -# - https://github.com/pulp/pulp-cli-maven/blob/main/.ci/run_container.sh -# - https://github.com/pulp/pulp-cli-ostree/blob/main/.ci/run_container.sh -# - https://github.com/pulp/squeezer/blob/develop/tests/run_container.sh - set -eu BASEPATH="$(dirname "$(readlink -f "$0")")" @@ -25,6 +16,16 @@ then fi export CONTAINER_RUNTIME +TMPDIR="$(mktemp -d)" + +cleanup () { + "${CONTAINER_RUNTIME}" stop pulp-ephemeral && true + rm -rf "${TMPDIR}" +} + +trap cleanup EXIT +trap cleanup INT + if [ -z "${KEEP_CONTAINER:+x}" ] then RM="yes" @@ -47,12 +48,36 @@ else SELINUX="" fi; -"${CONTAINER_RUNTIME}" run ${RM:+--rm} --env S6_KEEP_ENV=1 ${PULP_API_ROOT:+--env PULP_API_ROOT} --detach --name "pulp-ephemeral" --volume "${BASEPATH}/settings:/etc/pulp${SELINUX:+:Z}" --publish "8080:80" "ghcr.io/pulp/pulp:${IMAGE_TAG}" +mkdir -p "${TMPDIR}/settings/certs" +cp "${BASEPATH}/settings/settings.py" "${TMPDIR}/settings" -# shellcheck disable=SC2064 -trap "${CONTAINER_RUNTIME} stop pulp-ephemeral" EXIT -# shellcheck disable=SC2064 -trap "${CONTAINER_RUNTIME} stop pulp-ephemeral" INT +if [ -z "${PULP_HTTPS:+x}" ] +then + PROTOCOL="http" + PORT="80" + PULP_CONTENT_ORIGIN="http://localhost:8080/" +else + PROTOCOL="https" + PORT="443" + PULP_CONTENT_ORIGIN="https://localhost:8080/" + python3 -m trustme -d "${TMPDIR}/settings/certs" + export PULP_CA_BUNDLE="${TMPDIR}/settings/certs/client.pem" + ln -fs server.pem "${TMPDIR}/settings/certs/pulp_webserver.crt" + ln -fs server.key "${TMPDIR}/settings/certs/pulp_webserver.key" +fi +export PULP_CONTENT_ORIGIN + +"${CONTAINER_RUNTIME}" \ + run ${RM:+--rm} \ + --env S6_KEEP_ENV=1 \ + ${PULP_HTTPS:+--env PULP_HTTPS} \ + ${PULP_API_ROOT:+--env PULP_API_ROOT} \ + --env PULP_CONTENT_ORIGIN \ + --detach \ + --name "pulp-ephemeral" \ + --volume "${TMPDIR}/settings:/etc/pulp${SELINUX:+:Z}" \ + --publish "8080:${PORT}" \ + "ghcr.io/pulp/pulp:${IMAGE_TAG}" echo "Wait for pulp to start." for counter in $(seq 40 -1 0) @@ -67,7 +92,7 @@ do fi sleep 3 - if curl --fail "http://localhost:8080${PULP_API_ROOT:-/pulp/}api/v3/status/" > /dev/null 2>&1 + if curl --insecure --fail "${PROTOCOL}://localhost:8080${PULP_API_ROOT:-/pulp/}api/v3/status/" > /dev/null 2>&1 then echo "SUCCESS." break @@ -75,15 +100,19 @@ do echo "." done -# show pulpcore/plugin versions we're using -curl -s "http://localhost:8080${PULP_API_ROOT:-/pulp/}api/v3/status/" | jq '.versions|map({key: .component, value: .version})|from_entries' - # Set admin password "${CONTAINER_RUNTIME}" exec "pulp-ephemeral" pulpcore-manager reset-admin-password --password password +# Create pulp config +PULP_CLI_CONFIG="${TMPDIR}/settings/certs/cli.toml" +export PULP_CLI_CONFIG +pulp config create --overwrite --location "${PULP_CLI_CONFIG}" --base-url "${PROTOCOL}://localhost:8080" ${PULP_API_ROOT:+--api-root "${PULP_API_ROOT}"} --username "admin" --password "password" +# show pulpcore/plugin versions we're using +pulp --config "${PULP_CLI_CONFIG}" --refresh-api status + if [ -d "${BASEPATH}/container_setup.d/" ] then - run-parts --regex '^[0-9]+-[-_[:alnum:]]*\.sh$' "${BASEPATH}/container_setup.d/" + run-parts --exit-on-error --regex '^[0-9]+-[-_[:alnum:]]*\.sh$' "${BASEPATH}/container_setup.d/" fi PULP_LOGGING="${CONTAINER_RUNTIME}" "$@" diff --git a/.ci/scripts/collect_changes.py b/.ci/scripts/collect_changes.py index c1fd047..e6cb0da 100755 --- a/.ci/scripts/collect_changes.py +++ b/.ci/scripts/collect_changes.py @@ -101,7 +101,7 @@ def main(): for change in main_changes: fp.write(change[1]) - repo.git.commit("-m", "Update Changelog", "-m" "[noissue]", CHANGELOG_FILE) + repo.git.commit("-m", "Update Changelog", CHANGELOG_FILE) if __name__ == "__main__": diff --git a/.ci/scripts/create_release_branch.sh b/.ci/scripts/create_release_branch.sh index 7b01419..2e55c80 100755 --- a/.ci/scripts/create_release_branch.sh +++ b/.ci/scripts/create_release_branch.sh @@ -23,6 +23,11 @@ git branch "${NEW_BRANCH}" # Clean changelog snippets. find CHANGES/ \( -name "*.feature" -o -name "*.bugfix" -o -name "*.removal" -o -name "*.doc" -o -name "*.translation" -o -name "*.devel" -o -name "*.misc" \) -exec git rm -f \{\} + -bump-my-version bump minor --commit --message $'Bump version to {new_version}\n\n[noissue]' --allow-dirty +bump-my-version bump minor --commit --message $'Bump version to {new_version}' --allow-dirty git push origin "${NEW_BRANCH}" + +if [ "${GITHUB_ENV:-}" ] +then + echo "NEW_BRANCH=${NEW_BRANCH}" >> "${GITHUB_ENV}" +fi diff --git a/.ci/scripts/validate_commit_message.py b/.ci/scripts/validate_commit_message.py index 6127f73..16304ef 100644 --- a/.ci/scripts/validate_commit_message.py +++ b/.ci/scripts/validate_commit_message.py @@ -17,12 +17,15 @@ r"DO\s*NOT\s*MERGE", "EXPERIMENT", ] -NO_ISSUE = "[noissue]" CHANGELOG_EXTS = [f".{item['directory']}" for item in PYPROJECT_TOML["tool"]["towncrier"]["type"]] +NOISSUE_MARKER = "[noissue]" sha = sys.argv[1] message = subprocess.check_output(["git", "log", "--format=%B", "-n 1", sha]).decode("utf-8") +if NOISSUE_MARKER in message: + sys.exit("Do not add '[noissue]' in the commit message.") + if any((re.match(pattern, message) for pattern in BLOCKING_REGEX)): sys.exit("This PR is not ready for consumption.") @@ -61,13 +64,5 @@ def check_changelog(issue): if not cherry_pick: check_status(issue) check_changelog(issue) -else: - if NO_ISSUE in message: - print("Commit {sha} has no issues but is tagged {tag}.".format(sha=sha[0:7], tag=NO_ISSUE)) - else: - sys.exit( - "Error: no attached issues found for {sha}. If this was intentional, add " - " '{tag}' to the commit message.".format(sha=sha[0:7], tag=NO_ISSUE) - ) print("Commit message for {sha} passed.".format(sha=sha[0:7])) diff --git a/.ci/settings/settings.py b/.ci/settings/settings.py index 7aa512b..63661c9 100644 --- a/.ci/settings/settings.py +++ b/.ci/settings/settings.py @@ -1,3 +1,4 @@ -CONTENT_ORIGIN = "http://localhost:8080/" ALLOWED_EXPORT_PATHS = ["/tmp"] -TELEMETRY = False +ORPHAN_PROTECTION_TIME = 0 +ANALYTICS = False +ALLOWED_CONTENT_CHECKSUMS = ["sha1", "sha256", "sha512"] diff --git a/.flake8 b/.flake8 deleted file mode 100644 index f96e993..0000000 --- a/.flake8 +++ /dev/null @@ -1,7 +0,0 @@ -[flake8] -exclude = ./docs/*, */migrations/*, ./pulpcore/plugin/docs/* -ignore = W503,Q000,Q003,D100,D104,D106,D200,D202,D205,D400,D401,D402 -# E203: whitespace before ':'; https://github.com/psf/black/issues/279 -# E401: multiple imports on one line -extend-ignore = E203,E401 -max-line-length = 100 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fba8440..fe59d6b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,13 +4,13 @@ updates: directory: "/" schedule: interval: daily - open-pull-requests-limit: 10 commit-message: - prefix: "[noissue]" + prefix: "[PIP] " + open-pull-requests-limit: 10 - package-ecosystem: github-actions directory: "/" schedule: - interval: daily - open-pull-requests-limit: 10 + interval: weekly commit-message: - prefix: "[noissue]" + prefix: "[GHA] " + open-pull-requests-limit: 10 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 194069f..7c5544e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,3 +1,4 @@ +--- name: "Build" on: @@ -34,3 +35,4 @@ jobs: dist/ if-no-files-found: "error" retention-days: 5 +... diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 491b3bb..c447319 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,3 +1,4 @@ +--- name: "CodeQL" on: @@ -18,28 +19,13 @@ jobs: steps: - name: "Checkout repository" uses: "actions/checkout@v4" - - uses: "actions/cache@v4" - with: - path: "~/.cache/pip" - key: "${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/*constraints.lock', '**/setup.py', '**/pyproject.toml') }}" - restore-keys: | - ${{ runner.os }}-pip- - - - name: "Set up Python" - uses: "actions/setup-python@v5" - with: - python-version: "3.11" - - name: "Manually install from sources" - run: | - python -m pip install -e . -e ./pulp-glue-ostree - echo "CODEQL_PYTHON=$(which python)" >> "$GITHUB_ENV" - name: "Initialize CodeQL" uses: "github/codeql-action/init@v3" with: languages: "python" - setup-python-dependencies: false - name: "Perform CodeQL Analysis" uses: "github/codeql-action/analyze@v3" with: category: "/language:python" +... diff --git a/.github/workflows/collect_changes.yml b/.github/workflows/collect_changes.yml index 808249d..b37070a 100644 --- a/.github/workflows/collect_changes.yml +++ b/.github/workflows/collect_changes.yml @@ -1,3 +1,4 @@ +--- name: "Collect changes" on: workflow_call: @@ -30,3 +31,4 @@ jobs: body: "" branch: "update_changes" delete-branch: true +... diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 345e584..a92f212 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,3 +1,4 @@ +--- name: "Lint" on: @@ -35,3 +36,4 @@ jobs: - name: "Lint code" run: | make lint +... diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c4e2cca..cf39225 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,3 +1,4 @@ +--- name: "pulp-cli Nightly" on: @@ -17,3 +18,4 @@ jobs: collect_changes: uses: "./.github/workflows/collect_changes.yml" secrets: "inherit" +... diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index de3ef99..cd9f540 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,3 +1,4 @@ +--- name: "pulp-cli CI" on: @@ -64,3 +65,4 @@ jobs: echo '${{toJson(needs)}}' | jq -r 'to_entries[]|select(.value.result!="success")|.key + ": " + .value.result' echo '${{toJson(needs)}}' | jq -e 'to_entries|map(select(.value.result!="success"))|length == 0' echo "CI says: Looks good!" +... diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index f1f8aa2..ef9c6ff 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -13,43 +13,48 @@ concurrency: cancel-in-progress: true jobs: - single_commit: + apply_labels: runs-on: "ubuntu-latest" - name: "Label multiple commit PR" + name: "Label PR" permissions: pull-requests: "write" steps: - uses: "actions/checkout@v4" with: fetch-depth: 0 - - name: "Commit Count Check" + - uses: "actions/setup-python@v5" + with: + python-version: "3.12" + - name: "Determine PR labels" run: | + pip install GitPython==3.1.42 git fetch origin ${{ github.event.pull_request.head.sha }} - echo "COMMIT_COUNT=$(git log --oneline --no-merges origin/${{ github.base_ref }}..${{ github.event.pull_request.head.sha }} | wc -l)" >> "$GITHUB_ENV" + python .ci/scripts/pr_labels.py "origin/${{ github.base_ref }}" "${{ github.event.pull_request.head.sha }}" >> "$GITHUB_ENV" - uses: "actions/github-script@v7" + name: "Apply PR Labels" with: script: | - const labelName = "multi-commit"; - const { COMMIT_COUNT } = process.env; + const { ADD_LABELS, REMOVE_LABELS } = process.env; - if (COMMIT_COUNT == 1) - { - try { - await github.rest.issues.removeLabel({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - name: labelName, - }); - } catch(err) { + if (REMOVE_LABELS.length) { + for await (const labelName of REMOVE_LABELS.split(",")) { + try { + await github.rest.issues.removeLabel({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + name: labelName, + }); + } catch(err) { + } } } - else - { + if (ADD_LABELS.length) { await github.rest.issues.addLabels({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - labels: [labelName], + labels: ADD_LABELS.split(","), }); } +... diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d22ff28..fc2b4cc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,3 +1,4 @@ +--- name: "pulp-cli Publish" on: @@ -35,3 +36,4 @@ jobs: twine upload dist/* cd .. twine upload dist/* +... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6432d80..aa7b131 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,4 @@ +--- name: "pulp-cli Release" on: @@ -26,3 +27,4 @@ jobs: - name: "Release" run: | .ci/scripts/release.sh +... diff --git a/.github/workflows/release_branch.yml b/.github/workflows/release_branch.yml index 9a2ae6c..04f8dac 100644 --- a/.github/workflows/release_branch.yml +++ b/.github/workflows/release_branch.yml @@ -30,3 +30,17 @@ jobs: body: "" branch: "bump_version" delete-branch: true + - name: "Add Backport Label for new Branch" + uses: "actions/github-script@v7" + with: + script: | + const { NEW_BRANCH } = process.env; + const labelName = "backport-" + NEW_BRANCH; + + await github.rest.issues.createLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: labelName, + color: "C8780A", + }); +... diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d1216a..7fce6fb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,4 @@ +--- name: "Test" on: @@ -51,28 +52,22 @@ jobs: uses: "actions/setup-python@v5" with: python-version: "${{ matrix.python }}" - - name: "Install Test Dependencies" + - name: "Install Python Test Dependencies" run: | if [ "${{matrix.lower_bounds}}" ] then - # ------ DO NOT LET THE TEMPLATE REMOVE THIS ----- - # https://github.com/yaml/pyyaml/issues/601#issuecomment-1834630109 - pip install "cython<3.0.0" wheel - pip install "pyyaml==5.4.1" --no-build-isolation - # ------------------------------------------------ pip install dist/pulp_cli_ostree-*.whl pulp-glue-ostree/dist/pulp_glue_ostree-*.whl -r test_requirements.txt -c lower_bounds_constraints.lock else pip install dist/pulp_cli_ostree-*.whl pulp-glue-ostree/dist/pulp_glue_ostree-*.whl -r test_requirements.txt fi - # ------ DO NOT LET THE TEMPLATE REMOVE THIS ----- - - name: Install the ostree utility - run: sudo apt update && sudo apt-get install -y ostree - # ------------------------------------------------ - - name: Run tests + - name: "Run tests" env: - CONTAINER_RUNTIME: ${{ matrix.container_runtime }} - IMAGE_TAG: ${{ matrix.image_tag }} - FROM_TAG: ${{ matrix.from_tag }} - CONTAINER_FILE: ${{ matrix.container_file }} - PULP_API_ROOT: ${{ matrix.pulp_api_root }} - run: .ci/run_container.sh make test + CONTAINER_RUNTIME: "${{ matrix.container_runtime }}" + IMAGE_TAG: "${{ matrix.image_tag }}" + FROM_TAG: "${{ matrix.from_tag }}" + CONTAINER_FILE: "${{ matrix.container_file }}" + PULP_HTTPS: "${{ matrix.pulp_https }}" + PULP_API_ROOT: "${{ matrix.pulp_api_root }}" + run: | + .ci/run_container.sh make test +... diff --git a/.gitignore b/.gitignore index 4f58a78..234fb5b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ __pycache__/ build/ tests/cli.toml -/.ci/settings/certs +pytest_pulp_cli/GPG-PRIVATE-KEY-fixture-signing +site/ +dist/ +*.po~ diff --git a/Makefile b/Makefile index 8aa9b6f..8812ad8 100644 --- a/Makefile +++ b/Makefile @@ -33,5 +33,5 @@ tests/cli.toml: @echo "In order to configure the tests to talk to your test server, you might need to edit $@ ." test: | tests/cli.toml - pytest -v tests + python3 -m pytest -v tests pulp-glue-ostree/tests .PHONY: build info black lint test diff --git a/lint_requirements.txt b/lint_requirements.txt index 520fc4e..c7566bc 100644 --- a/lint_requirements.txt +++ b/lint_requirements.txt @@ -1,6 +1,7 @@ # Lint requirements black==24.8.0 flake8==7.1.1 +flake8-pyproject==1.2.3 isort==5.13.2 mypy==1.11.2 shellcheck-py==0.10.0.1 diff --git a/pulp-glue-ostree/tests/conftest.py b/pulp-glue-ostree/tests/conftest.py new file mode 100644 index 0000000..1597c93 --- /dev/null +++ b/pulp-glue-ostree/tests/conftest.py @@ -0,0 +1,7 @@ +from pulp_glue.common.context import PulpContext + + +class PulpTestContext(PulpContext): + # TODO check if we can just make the base class ignore echo. + def echo(*args, **kwargs) -> None: + return diff --git a/pyproject.toml b/pyproject.toml index 8313c68..3e8d89d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,80 +35,87 @@ changelog = "https://github.com/pulp/pulp-cli-ostree/blob/main/CHANGES.md" ostree = "pulpcore.cli.ostree" [tool.setuptools.packages.find] +# This section is managed by the cookiecutter templates. where = ["."] include = ["pulpcore.cli.*"] namespaces = true [tool.setuptools.package-data] -"*" = ["py.typed", "locale/*/LC_MESSAGES/*.mo"] +# This section is managed by the cookiecutter templates. +"*" = ["py.typed"] + [tool.pulp_cli_template] # This section is co-managed by the cookiecutter templates. # Changes to existing keys should be preserved. app_label = "ostree" +repository = "https://github.com/pulp/pulp-cli-ostree" glue = true docs = false translations = false main_package = "ostree" +binary_dependencies = "" [tool.towncrier] +# This section is managed by the cookiecutter templates. filename = "CHANGES.md" directory = "CHANGES/" -title_format = "## {version} ({project_date})" +title_format = "## {version} ({project_date}) {{: #{version} }}" template = "CHANGES/.TEMPLATE.md" issue_format = "[#{issue}](https://github.com/pulp/pulp-cli-ostree/issues/{issue})" start_string = "[//]: # (towncrier release notes start)\n" underlines = ["", "", ""] [[tool.towncrier.section]] +# This section is managed by the cookiecutter templates. path = "" name = "" [[tool.towncrier.section]] +# This section is managed by the cookiecutter templates. path = "pulp-glue-ostree" -name = "Pulp GLUE ostree" +name = "Pulp-ostree GLUE" [[tool.towncrier.type]] +# This section is managed by the cookiecutter templates. directory = "feature" name = "Features" showcontent = true [[tool.towncrier.type]] +# This section is managed by the cookiecutter templates. directory = "bugfix" name = "Bugfixes" showcontent = true [[tool.towncrier.type]] -directory = "doc" -name = "Improved Documentation" -showcontent = true - -[[tool.towncrier.type]] +# This section is managed by the cookiecutter templates. directory = "removal" name = "Deprecations and Removals" showcontent = true [[tool.towncrier.type]] -directory = "translation" -name = "Translations" -showcontent = true - -[[tool.towncrier.type]] +# This section is managed by the cookiecutter templates. directory = "devel" name = "Developer Notes" showcontent = true [[tool.towncrier.type]] +# This section is managed by the cookiecutter templates. directory = "misc" name = "Misc" showcontent = false + [tool.black] +# This section is managed by the cookiecutter templates. line-length = 100 [tool.isort] +# This section is managed by the cookiecutter templates. profile = "black" line_length = 100 +skip = ["pulp-glue-ostree"] [tool.pytest.ini_options] markers = [ @@ -118,15 +125,20 @@ markers = [ ] [tool.mypy] +# This section is managed by the cookiecutter templates. strict = true +warn_unused_ignores = false show_error_codes = true -files = "pulpcore/**/*.py" +files = "pulpcore/**/*.py, tests/*.py" namespace_packages = true explicit_package_bases = true [[tool.mypy.overrides]] +# This section is managed by the cookiecutter templates. module = [ "click_shell.*", + "gnupg.*", + "IPython.*", "schema.*", ] ignore_missing_imports = true @@ -143,6 +155,7 @@ serialize = [ ] [tool.bumpversion.parts.release] +# This section is managed by the cookiecutter templates. optional_value = "prod" values = [ "dev", @@ -150,26 +163,42 @@ values = [ ] [[tool.bumpversion.files]] +# This section is managed by the cookiecutter templates. filename = "./pulp-glue-ostree/pulp_glue/ostree/__init__.py" search = "__version__ = \"{current_version}\"" replace = "__version__ = \"{new_version}\"" [[tool.bumpversion.files]] +# This section is managed by the cookiecutter templates. filename = "./pulpcore/cli/ostree/__init__.py" search = "__version__ = \"{current_version}\"" replace = "__version__ = \"{new_version}\"" [[tool.bumpversion.files]] +# This section is managed by the cookiecutter templates. filename = "./pulp-glue-ostree/pyproject.toml" search = "version = \"{current_version}\"" replace = "version = \"{new_version}\"" [[tool.bumpversion.files]] +# This section is managed by the cookiecutter templates. filename = "./pyproject.toml" search = "version = \"{current_version}\"" replace = "version = \"{new_version}\"" [[tool.bumpversion.files]] +# This section is managed by the cookiecutter templates. filename = "./pyproject.toml" search = "\"pulp-glue-ostree=={current_version}\"" replace = "\"pulp-glue-ostree=={new_version}\"" + + +[tool.flake8] +# This section is managed by the cookiecutter templates. +exclude = ["./docs/*"] +ignore = ["W503", "Q000", "Q003", "D100", "D104", "D106", "D200", "D202", "D205", "D400", "D401", "D402"] +# E203: whitespace before ':'; https://github.com/psf/black/issues/279 +# E401: multiple imports on one line +extend-ignore = ["E203", "E401"] +max-line-length = 100 + diff --git a/tests/conftest.py b/tests/conftest.py index 567b982..39b7b42 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,4 @@ +import typing as t from urllib.parse import urljoin import pytest @@ -6,7 +7,7 @@ @pytest.fixture -def pulp_cli_vars(pulp_cli_vars): +def pulp_cli_vars(pulp_cli_vars: t.Dict[str, str]) -> t.Dict[str, str]: PULP_FIXTURES_URL = pulp_cli_vars["PULP_FIXTURES_URL"] result = {} result.update(pulp_cli_vars)