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
8 changes: 7 additions & 1 deletion .ci/gen_certs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "trustme>=1.2.1,<1.3.0",
# ]
# ///

import argparse
import os
import sys
Expand All @@ -6,7 +13,6 @@


def main() -> None:

parser = argparse.ArgumentParser(prog="gen_certs")
parser.add_argument(
"-d",
Expand Down
7 changes: 7 additions & 0 deletions .ci/scripts/calc_constraints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/python3
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "packaging>=25.0,<25.1",
# "tomli>=2.3.0,<2.4.0;python_version<'3.11'",
# ]
# ///

import argparse
import fileinput
Expand Down
9 changes: 8 additions & 1 deletion .ci/scripts/check_cli_dependencies.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/bin/env python3
import tomllib
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "packaging>=25.0,<25.1",
# ]
# ///

import typing as t
from pathlib import Path

import tomllib
from packaging.requirements import Requirement

GLUE_DIR = "pulp-glue-ostree"
Expand Down
6 changes: 6 additions & 0 deletions .ci/scripts/check_click_for_mypy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/env python3
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "packaging>=25.0,<25.1",
# ]
# ///

from importlib import metadata

Expand Down
9 changes: 8 additions & 1 deletion .ci/scripts/collect_changes.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#!/bin/env python3
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "gitpython>=3.1.46,<3.2.0",
# "packaging>=25.0,<25.1",
# ]
# ///

import itertools
import os
import re
import tomllib

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

Expand Down
8 changes: 7 additions & 1 deletion .ci/scripts/pr_labels.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/bin/env python3
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "gitpython>=3.1.46,<3.2.0",
# ]
# ///

# This script is running with elevated privileges from the main branch against pull requests.

import re
import sys
import tomllib
from pathlib import Path

import tomllib
from git import Repo


Expand Down
9 changes: 8 additions & 1 deletion .ci/scripts/validate_commit_message.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "gitpython>=3.1.46,<3.2.0",
# ]
# ///

import os
import re
import subprocess
import sys
import tomllib
from pathlib import Path

import tomllib
from github import Github

with open("pyproject.toml", "rb") as fp:
Expand Down
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,28 @@
GLUE_PLUGINS=$(notdir $(wildcard pulp-glue-ostree/pulp_glue/*))
CLI_PLUGINS=$(notdir $(wildcard pulpcore/cli/*))

.PHONY: info
info:
@echo Pulp glue
@echo plugins: $(GLUE_PLUGINS)
@echo Pulp CLI
@echo plugins: $(CLI_PLUGINS)

.PHONY: build
build:
cd pulp-glue-ostree; pyproject-build -n
pyproject-build -n

black: format

.PHONY: format
format:
isort .
cd pulp-glue-ostree; isort .
black .
ruff format
ruff check --fix

.PHONY: lint
lint:
find tests .ci -name '*.sh' -print0 | xargs -0 shellcheck -x
isort -c --diff .
cd pulp-glue-ostree; isort -c --diff .
black --diff --check .
flake8
ruff format --check --diff
ruff check --diff
.ci/scripts/check_cli_dependencies.py
.ci/scripts/check_click_for_mypy.py
MYPYPATH=pulp-glue-ostree mypy
Expand All @@ -35,15 +34,18 @@ tests/cli.toml:
cp [email protected] $@
@echo "In order to configure the tests to talk to your test server, you might need to edit $@ ."

.PHONY: test
test: | tests/cli.toml
python3 -m pytest -v tests pulp-glue-ostree/tests

.PHONY: livetest
livetest: | tests/cli.toml
python3 -m pytest -v tests pulp-glue-ostree/tests -m live

.PHONY: unittest
unittest:
python3 -m pytest -v tests pulp-glue-ostree/tests -m "not live"

.PHONY: unittest_glue
unittest_glue:
python3 -m pytest -v pulp-glue-ostree/tests -m "not live"
.PHONY: build info black lint test
5 changes: 1 addition & 4 deletions lint_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Lint requirements
black==25.12.0
flake8==7.3.0
flake8-pyproject==1.2.4
isort==7.0.0
ruff==0.14.11
mypy==1.19.1
shellcheck-py==0.11.0.1

Expand Down
25 changes: 17 additions & 8 deletions pulp-glue-ostree/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,38 @@ repository = "https://github.com/pulp/pulp-cli-ostree"
changelog = "https://github.com/pulp/pulp-cli-ostree/blob/main/CHANGES.md"

[tool.setuptools.packages.find]
# This section is managed by the cookiecutter templates.
where = ["."]
include = ["pulp_glue.*"]
namespaces = true

[tool.setuptools.package-data]
"*" = ["py.typed", "locale/*/LC_MESSAGES/*.mo"]
# This section is managed by the cookiecutter templates.
"*" = ["py.typed"]

[tool.black]
line-length = 100

[tool.isort]
profile = "black"
line_length = 100

[tool.mypy]
# This section is managed by the cookiecutter templates.
strict = true
warn_unused_ignores = false
show_error_codes = true
files = "pulp_glue/**/*.py"
files = "pulp_glue/**/*.py, tests/**/*.py"
namespace_packages = true
explicit_package_bases = true

[[tool.mypy.overrides]]
# This section is managed by the cookiecutter templates.
module = [
"schema.*",
]
ignore_missing_imports = true


[tool.ruff]
# This section is managed by the cookiecutter templates.
line-length = 100

[tool.ruff.lint]
# This section is managed by the cookiecutter templates.
extend-select = ["I"]

7 changes: 0 additions & 7 deletions pulp-glue-ostree/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
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
2 changes: 1 addition & 1 deletion pulpcore/cli/ostree/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def update(
else:
distribution_ctx.update(body={"repository": ""}, non_blocking=True)

body["repository_version"] = f'{distribution["repository"]}versions/{version}/'
body["repository_version"] = f"{distribution['repository']}versions/{version}/"
elif distribution["repository_version"]:
repository_href = distribution["repository_version"].partition("versions")[0]
body["repository_version"] = f"{repository_href}versions/{version}/"
Expand Down
24 changes: 7 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,6 @@ name = "Misc"
showcontent = true


[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
extend_skip = ["pulp-glue-ostree"]

[tool.pytest.ini_options]
markers = [
"script: tests provided as shell scripts",
Expand Down Expand Up @@ -194,12 +184,12 @@ search = "\"pulp-glue-ostree=={current_version}\""
replace = "\"pulp-glue-ostree=={new_version}\""


[tool.flake8]
[tool.ruff]
# This section is managed by the cookiecutter templates.
line-length = 100
extend-exclude = ["cookiecutter"]

[tool.ruff.lint]
# 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
extend-select = ["I"]

Loading