Skip to content

Commit 2ebfc22

Browse files
committed
fix: avoid using unreleased dependency constraints
- use newer ansible_compat which ensures that py314 and ansible-core versions are compatible - removes dependency on unreleased version of ansible-core - add tests for packaging issues related to pre-releases Related: #4800 Related: #4795
1 parent f3de470 commit 2ebfc22

File tree

6 files changed

+82
-49
lines changed

6 files changed

+82
-49
lines changed

.config/requirements-lock.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file was autogenerated by uv via the following command:
22
# uv export --no-dev --no-emit-package ansible-core --no-emit-package resolvelib --no-emit-package ruamel-yaml-clib --no-emit-package tomli --no-emit-package typing-extensions --no-emit-project --no-hashes -o .config/requirements-lock.txt
3-
ansible-compat==25.8.1
3+
ansible-compat==25.8.2
44
# via ansible-lint
55
attrs==25.3.0
66
# via

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ repos:
3333
rev: 0.8.22
3434
hooks:
3535
- id: uv-sync
36+
- id: uv-lock
3637
- id: uv-lock
3738
name: "deps: upgrade via uv sync --upgrade"
3839
alias: deps

pyproject.toml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ classifiers = [
3232
"Topic :: Utilities",
3333
]
3434
dependencies = [
35-
"ansible-compat>=25.8.0", # indirect dependency of cryptography
36-
"ansible-core>=2.16.11", # indirect dependency of ansible-core
37-
"ansible-core>=2.20.0b1 ; python_full_version >= '3.14'", # indirect dependency of ansible-core
38-
"black>=24.3.0", # indirect dependency of ansible-core
35+
"ansible-compat>=25.8.2",
36+
"ansible-core>=2.16.11",
37+
"black>=24.3.0",
3938
"cffi>=1.17.1", # indirect dependency of ruamel-yaml
4039
"cryptography>=38",
4140
"distro>=1.9.0",
@@ -44,14 +43,14 @@ dependencies = [
4443
"jsonschema>=4.10.0",
4544
"packaging>=22.0",
4645
"pathspec>=0.10.3",
47-
"pyyaml>=6.0.2",
48-
"pyyaml>=6.0.3 ; python_full_version < '3.14'", # py314 support
46+
"pyyaml>=6.0.2 ; python_version < '3.14'",
47+
"pyyaml>=6.0.3 ; python_version >= '3.14'", # py314 support
4948
"referencing>=0.36.2",
5049
"ruamel-yaml>=0.18.11",
51-
"ruamel-yaml-clib>=0.2.12 ; python_full_version < '3.14'",
50+
"ruamel-yaml-clib>=0.2.12 ; python_version < '3.14'",
5251
"subprocess-tee>=0.4.1",
53-
"wcmatch>=8.1.2 ; python_full_version < '3.12'",
54-
"wcmatch>=8.5.0 ; python_full_version >= '3.12'",
52+
"wcmatch>=8.1.2 ; python_version < '3.12'",
53+
"wcmatch>=8.5.0 ; python_version >= '3.12'",
5554
"yamllint>=1.34.0",
5655
]
5756
dynamic = ["version"]
@@ -106,7 +105,13 @@ lint = [
106105
"pytest>=7.2.2",
107106
"setuptools>=51.1.1",
108107
]
109-
pkg = ["build>=0.9", "pip>=25.2", "pipx>=1.7.1", "twine>=4.0.1"]
108+
pkg = [
109+
"build>=0.9",
110+
"pip>=25.2",
111+
"pipx>=1.7.1",
112+
"setuptools-scm>=9.2.0",
113+
"twine>=4.0.1",
114+
]
110115
schemas = ["check-jsonschema>=0.26.3"]
111116

112117
[build-system]
@@ -648,7 +653,7 @@ commands = [
648653
],
649654
["pre-commit", "autoupdate"],
650655
["sh", "-c", "cd test/schemas && npm run deps"],
651-
["tox", "e", "lint"],
656+
["tox", "-e", "lint"],
652657
]
653658
commands_pre = []
654659
description = "Bump all test dependencies"
@@ -719,7 +724,8 @@ commands = [
719724
"{tox_root}/dist/",
720725
"{tox_root}",
721726
],
722-
["sh", "-c", "python -m twine check --strict {tox_root}/dist/*"],
727+
["bash", "-c", "python -m twine check --strict {tox_root}/dist/*"],
728+
["bash", "./tools/test-pkg.sh"],
723729
]
724730
commands_pre = []
725731
dependency_groups = ["pkg"]

test/test_main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,13 @@ def test_ro_venv() -> None:
187187
"""Tests behavior when the virtual environment is read-only."""
188188
tox_work_dir = os.environ.get("TOX_WORK_DIR", ".tox")
189189
venv_path = f"{tox_work_dir}/ro"
190+
prerelease_flag = "" if sys.version_info < (3, 14) else "--pre "
190191
commands = [
191192
f"mkdir -p {venv_path}",
192193
f"chmod -R a+w {venv_path}",
193194
f"rm -rf {venv_path}",
194195
f"python -m venv --symlinks {venv_path}",
195-
f"{venv_path}/bin/python -m pip install -q -e .",
196+
f"{venv_path}/bin/python -m pip install {prerelease_flag}-q -e .",
196197
f"chmod -R a-w {venv_path}",
197198
# running with a ro venv and default cwd
198199
f"{venv_path}/bin/ansible-lint --version",

tools/test-pkg.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
set -euxo pipefail
3+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4+
5+
VERSION=$(python -m setuptools_scm)
6+
7+
TEST_DIR=${TOX_WORK_DIR:-.tox}/pkg/smoke
8+
mkdir -p "$TEST_DIR"
9+
rm -rf "${TEST_DIR:?}"/*
10+
11+
pushd "$TEST_DIR" > /dev/null
12+
13+
cat > pyproject.toml <<EOF
14+
[project]
15+
name = "2"
16+
version = "0.1.0"
17+
description = "Add your description here"
18+
readme = "README.md"
19+
requires-python = ">=3.13.7"
20+
dependencies = []
21+
22+
[[tool.uv.index]]
23+
name = "local"
24+
url = "../../../dist"
25+
format = "flat"
26+
EOF
27+
28+
uv add "ansible-lint==$VERSION"
29+
30+
popd > /dev/null

uv.lock

Lines changed: 30 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)