Skip to content

Commit 41d0e29

Browse files
committed
Use uv
1 parent 6a889a1 commit 41d0e29

File tree

163 files changed

+1593
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+1593
-89
lines changed

.ci/container_setup.d/10-install-signing-service.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ pulp --config "${PULP_CLI_CONFIG}" debug has-plugin --name "deb" && HAS_DEB=true
66
pulp --config "${PULP_CLI_CONFIG}" debug has-plugin --name "ansible" && HAS_ANSIBLE=true || HAS_ANSIBLE=""
77
if [ "$HAS_DEB" ] || [ "$HAS_ANSIBLE" ]
88
then
9-
if [ ! -f pytest_pulp_cli/GPG-PRIVATE-KEY-fixture-signing ]
9+
if [ ! -f src/pytest_pulp_cli/GPG-PRIVATE-KEY-fixture-signing ]
1010
then
11-
curl -L https://github.com/pulp/pulp-fixtures/raw/master/common/GPG-PRIVATE-KEY-fixture-signing > pytest_pulp_cli/GPG-PRIVATE-KEY-fixture-signing
11+
curl -L https://github.com/pulp/pulp-fixtures/raw/master/common/GPG-PRIVATE-KEY-fixture-signing > src/pytest_pulp_cli/GPG-PRIVATE-KEY-fixture-signing
1212
fi
1313
echo "Setup the signing services"
1414
if "${CONTAINER_RUNTIME}" exec "pulp-ephemeral" id pulp
@@ -20,7 +20,7 @@ then
2020
"${CONTAINER_RUNTIME}" exec "pulp-ephemeral" mkdir -p /var/lib/pulp/scripts/
2121
# Setup key on the Pulp container
2222
echo "0C1A894EBB86AFAE218424CADDEF3019C2D4A8CF:6:" | "${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" su "${PULP_USER}" -c "gpg --import-ownertrust"
23-
"${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" su "${PULP_USER}" -c "gpg --import" < pytest_pulp_cli/GPG-PRIVATE-KEY-fixture-signing
23+
"${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" su "${PULP_USER}" -c "gpg --import" < src/pytest_pulp_cli/GPG-PRIVATE-KEY-fixture-signing
2424
if [ "$HAS_DEB" ]
2525
then
2626
echo "Setup deb release signing service"

.ci/scripts/validate_commit_message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# /// script
22
# requires-python = ">=3.11"
33
# dependencies = [
4-
# "gitpython>=3.1.46,<3.2.0",
4+
# "pygithub>=2.8.1,<3.0.0",
55
# ]
66
# ///
77

.github/workflows/build.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,14 @@ jobs:
99
runs-on: "ubuntu-latest"
1010
steps:
1111
- uses: "actions/checkout@v5"
12-
- uses: "actions/cache@v4"
13-
with:
14-
path: "~/.cache/pip"
15-
key: "${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/*constraints.lock', '**/setup.py', '**/pyproject.toml') }}"
16-
restore-keys: |
17-
${{ runner.os }}-pip-
18-
1912
- name: "Set up Python"
2013
uses: "actions/setup-python@v6"
2114
with:
2215
python-version: "3.14"
23-
- name: "Install python dependencies"
24-
run: |
25-
pip install build setuptools wheel
16+
- name: "Install uv"
17+
uses: "astral-sh/setup-uv@v7"
18+
with:
19+
enable-cache: true
2620
- name: "Build wheels"
2721
run: |
2822
make build
@@ -31,7 +25,7 @@ jobs:
3125
with:
3226
name: "pulp_cli_packages"
3327
path: |
34-
pulp-glue/dist/
28+
README.md
3529
dist/
3630
if-no-files-found: "error"
3731
retention-days: 5

.github/workflows/lint.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,15 @@ jobs:
1515
- "3.14"
1616
steps:
1717
- uses: "actions/checkout@v5"
18-
- uses: "actions/cache@v4"
19-
with:
20-
path: "~/.cache/pip"
21-
key: "${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/*constraints.lock', '**/setup.py', '**/pyproject.toml') }}"
22-
restore-keys: |
23-
${{ runner.os }}-pip-
24-
25-
- name: "Download wheels"
26-
uses: "actions/download-artifact@v5"
27-
with:
28-
name: "pulp_cli_packages"
2918
- name: "Set up Python"
3019
uses: "actions/setup-python@v6"
3120
with:
3221
python-version: "${{ matrix.python }}"
33-
- name: "Install python dependencies"
34-
run: |
35-
pip install dist/pulp_cli-*.whl pulp-glue/dist/pulp_glue-*.whl -r lint_requirements.txt
22+
- name: "Install uv"
23+
uses: "astral-sh/setup-uv@v7"
24+
with:
25+
enable-cache: true
3626
- name: "Lint code"
3727
run: |
38-
make lint
28+
make uv-lint
3929
...

.github/workflows/pr.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ concurrency:
99
cancel-in-progress: true
1010

1111
jobs:
12-
build:
13-
uses: "./.github/workflows/build.yml"
1412
lint:
15-
needs:
16-
- "build"
1713
uses: "./.github/workflows/lint.yml"
18-
test:
14+
build:
1915
needs:
2016
- "lint"
17+
uses: "./.github/workflows/build.yml"
18+
test:
19+
needs:
20+
- "build"
2121
uses: "./.github/workflows/test.yml"
2222
docs:
2323
needs:
@@ -40,17 +40,18 @@ jobs:
4040
uses: "actions/setup-python@v6"
4141
with:
4242
python-version: "3.x"
43-
- name: "Install python dependencies"
44-
run: |
45-
pip install toml pygithub
43+
- name: "Install uv"
44+
uses: "astral-sh/setup-uv@v7"
45+
with:
46+
enable-cache: true
4647
- name: "Check commit message"
4748
env:
4849
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
4950
GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}"
5051
run: |
5152
for SHA in $(curl -H "Authorization: token $GITHUB_TOKEN" "$GITHUB_CONTEXT" | jq -r '.[].sha')
5253
do
53-
python .ci/scripts/validate_commit_message.py "$SHA"
54+
uv run -q .ci/scripts/validate_commit_message.py "$SHA"
5455
VALUE=$?
5556
if [ "$VALUE" -gt 0 ]; then
5657
exit "$VALUE"

.github/workflows/pr_checks.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,24 @@ jobs:
1919
permissions:
2020
pull-requests: "write"
2121
steps:
22-
- uses: "actions/checkout@v5"
22+
- name: "Fetch Repository"
23+
uses: "actions/checkout@v5"
2324
with:
2425
fetch-depth: 0
25-
- uses: "actions/setup-python@v6"
26+
- name: "Set up Python"
27+
uses: "actions/setup-python@v6"
2628
with:
2729
python-version: "3.x"
30+
- name: "Install uv"
31+
uses: "astral-sh/setup-uv@v7"
32+
with:
33+
enable-cache: true
2834
- name: "Determine PR labels"
2935
run: |
30-
pip install GitPython==3.1.42
3136
git fetch origin ${{ github.event.pull_request.head.sha }}
32-
python .ci/scripts/pr_labels.py "origin/${{ github.base_ref }}" "${{ github.event.pull_request.head.sha }}" >> "$GITHUB_ENV"
33-
- uses: "actions/github-script@v8"
34-
name: "Apply PR Labels"
37+
uv run -q .ci/scripts/pr_labels.py "origin/${{ github.base_ref }}" "${{ github.event.pull_request.head.sha }}" >> "$GITHUB_ENV"
38+
- name: "Apply PR Labels"
39+
uses: "actions/github-script@v8"
3540
with:
3641
script: |
3742
const { ADD_LABELS, REMOVE_LABELS } = process.env;

.github/workflows/test.yml

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ jobs:
1515
runs-on: "ubuntu-latest"
1616
steps:
1717
- uses: "actions/checkout@v5"
18-
- uses: "actions/cache@v4"
19-
with:
20-
path: "~/.cache/pip"
21-
key: "${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/*constraints.lock', '**/setup.py', '**/pyproject.toml') }}"
22-
restore-keys: |
23-
${{ runner.os }}-pip-
24-
2518
- name: "Download wheels"
2619
uses: "actions/download-artifact@v5"
2720
with:
@@ -30,12 +23,13 @@ jobs:
3023
uses: "actions/setup-python@v6"
3124
with:
3225
python-version: "3.14"
33-
- name: "Install Python Test Dependencies"
34-
run: |
35-
pip install dist/pulp_cli-*.whl pulp-glue/dist/pulp_glue-*.whl -r test_requirements.txt
26+
- name: "Install uv"
27+
uses: "astral-sh/setup-uv@v7"
28+
with:
29+
enable-cache: true
3630
- name: "Run tests"
3731
run: |
38-
make unittest
32+
uv run --isolated --with dist/pulp_glue*.whl --with dist/pulp_cli*.whl --only-group test make unittest
3933
test:
4034
runs-on: "ubuntu-24.04"
4135
needs:
@@ -74,13 +68,6 @@ jobs:
7468
python: "3.13"
7569
steps:
7670
- uses: "actions/checkout@v5"
77-
- uses: "actions/cache@v4"
78-
with:
79-
path: "~/.cache/pip"
80-
key: "${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/*constraints.lock', '**/setup.py', '**/pyproject.toml') }}"
81-
restore-keys: |
82-
${{ runner.os }}-pip-
83-
8471
- name: "Download wheels"
8572
uses: "actions/download-artifact@v5"
8673
with:
@@ -90,18 +77,10 @@ jobs:
9077
with:
9178
python-version: "${{ matrix.python }}"
9279
allow-prereleases: true
93-
- name: "Install Python Test Dependencies"
94-
run: |
95-
if [ "${{matrix.lower_bounds}}" ]
96-
then
97-
pip install dist/pulp_cli-*.whl pulp-glue/dist/pulp_glue-*.whl -r test_requirements.txt -c lower_bounds_constraints.lock
98-
elif [ "${{matrix.upper_bounds}}" ]
99-
then
100-
.ci/scripts/calc_constraints.py pyproject.toml pulp-glue/pyproject.toml --upper > upper_bounds_constraints.lock
101-
pip install dist/pulp_cli-*.whl pulp-glue/dist/pulp_glue-*.whl -r test_requirements.txt -c upper_bounds_constraints.lock
102-
else
103-
pip install dist/pulp_cli-*.whl pulp-glue/dist/pulp_glue-*.whl -r test_requirements.txt
104-
fi
80+
- name: "Install uv"
81+
uses: "astral-sh/setup-uv@v7"
82+
with:
83+
enable-cache: true
10584
- name: "Run tests"
10685
env:
10786
CONTAINER_RUNTIME: "${{ matrix.container_runtime }}"
@@ -115,5 +94,15 @@ jobs:
11594
PULP_ENABLED_PLUGINS: "${{ matrix.pulp_enabled_plugins }}"
11695
OAS_VERSION: "${{ matrix.oas_version }}"
11796
run: |
118-
.ci/run_container.sh make livetest
97+
if [ "${{matrix.lower_bounds}}" ]
98+
then
99+
RESOLUTION=("--resolution" "lowest-direct")
100+
elif [ "${{matrix.upper_bounds}}" ]
101+
then
102+
RESOLUTION=("--resolution" "highest")
103+
else
104+
RESOLUTION=()
105+
fi
106+
107+
uv run "${RESOLUTION[@]}" --isolated --with dist/pulp_glue*.whl --with dist/pulp_cli*.whl --only-group test .ci/run_container.sh make livetest
119108
...

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
__pycache__/
33
build/
44
tests/cli.toml
5-
pytest_pulp_cli/GPG-PRIVATE-KEY-fixture-signing
5+
GPG-PRIVATE-KEY-fixture-signing
66
site/
77
dist/
88
*.po~

Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,33 @@ info:
1212

1313
.PHONY: build
1414
build:
15-
cd pulp-glue; pyproject-build -n
16-
pyproject-build -n
15+
uv build --all
1716

1817
.PHONY: format
1918
format:
2019
ruff format
2120
ruff check --fix
2221

22+
.PHONY: uv-format
23+
uv-format:
24+
uv lock
25+
uv run --isolated --group lint $(MAKE) format
26+
2327
.PHONY: lint
2428
lint:
2529
find tests .ci -name '*.sh' -print0 | xargs -0 shellcheck -x
2630
ruff format --check --diff
2731
ruff check --diff
2832
.ci/scripts/check_click_for_mypy.py
29-
MYPYPATH=pulp-glue mypy
33+
mypy
3034
cd pulp-glue; mypy
3135
@echo "🙊 Code 🙈 LGTM 🙉 !"
3236

37+
.PHONY: uv-lint
38+
uv-lint:
39+
uv lock --check
40+
uv run --isolated --group lint $(MAKE) lint
41+
3342
tests/cli.toml:
3443
cp $@.example $@
3544
@echo "In order to configure the tests to talk to your test server, you might need to edit $@ ."

pulp-glue/pyproject.toml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["setuptools<81"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["uv_build>=0.9.21,<0.10.0"]
3+
build-backend = "uv_build"
44

55
[project]
66
name = "pulp-glue"
@@ -25,7 +25,8 @@ classifiers = [
2525
dependencies = [
2626
"multidict>=6.0.5,<6.8",
2727
"packaging>=20.0,<=25.0", # CalVer
28-
"requests>=2.24.0,<2.33",
28+
"requests>=2.24.0,<2.33;python_version<'3.12'",
29+
"requests>=2.25.1,<2.33;python_version>='3.12'",
2930
"tomli>=2.0.0,<2.1;python_version<'3.11'",
3031
]
3132

@@ -34,9 +35,14 @@ documentation = "https://pulpproject.org/pulp-glue/docs/dev/"
3435
repository = "https://github.com/pulp/pulp-cli"
3536
changelog = "https://pulpproject.org/pulp-cli/changes/"
3637

38+
[tool.uv.build-backend]
39+
package-name = ["pulp_glue"]
40+
namespace = true
41+
source-exclude = ["*.pot", "*.po", "**/*\\~"]
42+
3743
[tool.setuptools.packages.find]
3844
# This section is managed by the cookiecutter templates.
39-
where = ["."]
45+
where = ["src"]
4046
include = ["pulp_glue.*"]
4147
namespaces = true
4248

@@ -47,10 +53,11 @@ namespaces = true
4753

4854
[tool.mypy]
4955
# This section is managed by the cookiecutter templates.
56+
mypy_path = ["src"]
5057
strict = true
5158
warn_unused_ignores = false
5259
show_error_codes = true
53-
files = "pulp_glue/**/*.py, tests/**/*.py"
60+
files = "src/**/*.py, tests/**/*.py"
5461
namespace_packages = true
5562
explicit_package_bases = true
5663

0 commit comments

Comments
 (0)