antsibull-nox 0.6.0__py3-none-any.whl → 0.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
antsibull_nox/__init__.py CHANGED
@@ -17,7 +17,7 @@ from .config import (
17
17
  from .interpret_config import interpret_config
18
18
  from .sessions.ansible_test import add_ansible_test_session
19
19
 
20
- __version__ = "0.6.0"
20
+ __version__ = "0.7.0"
21
21
 
22
22
 
23
23
  def load_antsibull_nox_toml() -> None:
antsibull_nox/ansible.py CHANGED
@@ -87,13 +87,13 @@ _SUPPORTED_CORE_VERSIONS: dict[Version, AnsibleCoreInfo] = {
87
87
  ["3.11", "3.12", "3.13"],
88
88
  ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"],
89
89
  ],
90
+ "2.20": [
91
+ ["3.11", "3.12", "3.13"],
92
+ ["3.9", "3.10", "3.11", "3.12", "3.13"],
93
+ ],
90
94
  # The following might need updates. Look for the "``ansible-core`` support matrix" table in:
91
95
  # https://github.com/ansible/ansible-documentation/blob/devel/docs/docsite/rst/reference_appendices/release_and_maintenance.rst?plain=1
92
96
  # It contains commented-out entries for future ansible-core versions.
93
- "2.20": [
94
- ["3.12", "3.13", "3.14"],
95
- ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"],
96
- ],
97
97
  "2.21": [
98
98
  ["3.12", "3.13", "3.14"],
99
99
  ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"],
@@ -118,8 +118,8 @@ _SUPPORTED_CORE_VERSIONS: dict[Version, AnsibleCoreInfo] = {
118
118
  }
119
119
 
120
120
  _MIN_SUPPORTED_VERSION = Version.parse("2.9")
121
- _CURRENT_DEVEL_VERSION = Version.parse("2.19")
122
- _CURRENT_MILESTONE_VERSION = Version.parse("2.19")
121
+ _CURRENT_DEVEL_VERSION = Version.parse("2.20")
122
+ _CURRENT_MILESTONE_VERSION = Version.parse("2.20")
123
123
 
124
124
 
125
125
  def get_ansible_core_info(
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) 2025, Felix Fontein <felix@fontein.de>
4
+ # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt
5
+ # or https://www.gnu.org/licenses/gpl-3.0.txt)
6
+ # SPDX-License-Identifier: GPL-3.0-or-later
7
+
8
+ """Retrieve the version of one or more packages."""
9
+
10
+ from __future__ import annotations
11
+
12
+ import json
13
+ import sys
14
+ from importlib.metadata import PackageNotFoundError, version
15
+
16
+ from antsibull_nox_data_util import get_list_of_strings, setup # type: ignore
17
+
18
+
19
+ def main() -> int:
20
+ """Main entry point."""
21
+ paths, extra_data = setup()
22
+
23
+ packages = get_list_of_strings(extra_data, "packages", default=[])
24
+
25
+ result: dict[str, str | None] = {}
26
+ for package in packages:
27
+ try:
28
+ result[package] = version(package)
29
+ except PackageNotFoundError:
30
+ result[package] = None
31
+ print(json.dumps(result))
32
+ return 0
33
+
34
+
35
+ if __name__ == "__main__":
36
+ sys.exit(main())
@@ -23,7 +23,9 @@ from .collections import (
23
23
  prepare_collections,
24
24
  )
25
25
  from .utils import (
26
+ get_package_version,
26
27
  install,
28
+ is_new_enough,
27
29
  run_bare_script,
28
30
  )
29
31
 
@@ -93,6 +95,9 @@ def add_docs_check(
93
95
  def execute_antsibull_docs(
94
96
  session: nox.Session, prepared_collections: CollectionSetup
95
97
  ) -> None:
98
+ antsibull_docs_version = get_package_version(session, "antsibull-docs")
99
+ if antsibull_docs_version is not None:
100
+ session.log(f"Detected antsibull-docs version {antsibull_docs_version}")
96
101
  with session.chdir(prepared_collections.current_path):
97
102
  collections_path = f"{prepared_collections.current_place}"
98
103
  command = [
@@ -104,6 +109,8 @@ def add_docs_check(
104
109
  ]
105
110
  if validate_collection_refs:
106
111
  command.extend(["--validate-collection-refs", validate_collection_refs])
112
+ if is_new_enough(antsibull_docs_version, min_version="2.18.0"):
113
+ command.append("--check-extra-docs-refs")
107
114
  session.run(*command, env={"ANSIBLE_COLLECTIONS_PATH": collections_path})
108
115
 
109
116
  def docs_check(session: nox.Session) -> None:
@@ -10,6 +10,7 @@ Utils for creating nox sessions.
10
10
 
11
11
  from __future__ import annotations
12
12
 
13
+ import json
13
14
  import logging
14
15
  import os
15
16
  import sys
@@ -19,6 +20,8 @@ from pathlib import Path
19
20
 
20
21
  import nox
21
22
  from nox.logger import OUTPUT as nox_OUTPUT
23
+ from packaging.version import InvalidVersion
24
+ from packaging.version import parse as parse_version
22
25
 
23
26
  from ..data_util import prepare_data_script
24
27
  from ..paths import (
@@ -151,6 +154,86 @@ def run_bare_script(
151
154
  )
152
155
 
153
156
 
157
+ def get_package_versions(
158
+ session: nox.Session,
159
+ /,
160
+ packages: list[str] | str,
161
+ *,
162
+ use_session_python: bool = True,
163
+ ) -> None | dict[str, str | None]:
164
+ """
165
+ Retrieve the versions of one or more Python packages.
166
+ """
167
+ name = "get-package-versions"
168
+ if isinstance(packages, str):
169
+ packages = [packages]
170
+ if not packages:
171
+ return {}
172
+ data = prepare_data_script(
173
+ session,
174
+ base_name=name,
175
+ paths=[],
176
+ extra_data={
177
+ "packages": packages,
178
+ },
179
+ )
180
+ python = sys.executable
181
+ env = {}
182
+ if use_session_python:
183
+ python = "python"
184
+ env["PYTHONPATH"] = str(find_data_directory())
185
+ result = session.run(
186
+ python,
187
+ find_data_directory() / f"{name}.py",
188
+ "--data",
189
+ data,
190
+ external=True,
191
+ silent=True,
192
+ env=env,
193
+ )
194
+ if result is None:
195
+ return None
196
+ return json.loads(result)
197
+
198
+
199
+ def get_package_version(
200
+ session: nox.Session,
201
+ /,
202
+ package: str,
203
+ *,
204
+ use_session_python: bool = True,
205
+ ) -> str | None:
206
+ """
207
+ Retrieve a Python package's version.
208
+ """
209
+ result = get_package_versions(
210
+ session, package, use_session_python=use_session_python
211
+ )
212
+ return None if result is None else result.get(package)
213
+
214
+
215
+ def is_new_enough(actual_version: str | None, *, min_version: str) -> bool:
216
+ """
217
+ Given a program version, compares it to the min_version.
218
+ If the program version is not given, it is assumed to be "new enough".
219
+ """
220
+ if actual_version is None:
221
+ return True
222
+ try:
223
+ act_v = parse_version(actual_version)
224
+ except InvalidVersion as exc:
225
+ raise ValueError(
226
+ f"Cannot parse actual version {actual_version!r}: {exc}"
227
+ ) from exc
228
+ try:
229
+ min_v = parse_version(min_version)
230
+ except InvalidVersion as exc:
231
+ raise ValueError(
232
+ f"Cannot parse minimum version {min_version!r}: {exc}"
233
+ ) from exc
234
+ return act_v >= min_v
235
+
236
+
154
237
  def compose_description(
155
238
  *,
156
239
  prefix: str | dict[t.Literal["one", "other"], str] | None = None,
@@ -197,8 +280,11 @@ def compose_description(
197
280
  __all__ = [
198
281
  "ci_group",
199
282
  "compose_description",
283
+ "get_package_version",
284
+ "get_package_versions",
200
285
  "get_registered_sessions",
201
286
  "install",
287
+ "is_new_enough",
202
288
  "nox_has_verbosity",
203
289
  "register",
204
290
  "run_bare_script",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: antsibull-nox
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Changelog tool for Ansible-core and Ansible collections
5
5
  Project-URL: Documentation, https://ansible.readthedocs.io/projects/antsibull-nox/
6
6
  Project-URL: Source code, https://github.com/ansible-community/antsibull-nox/
@@ -1,6 +1,6 @@
1
- antsibull_nox/__init__.py,sha256=oWRofJnJ6IoHttvzFvw0tBvebvTuJ1UKb6C_FSUMjTo,845
1
+ antsibull_nox/__init__.py,sha256=ckHydw6Ts2rrrm2iLtHD3zxDxG1JkL6YGHBL8_HrFbY,845
2
2
  antsibull_nox/_pydantic.py,sha256=VTIh-u0TpWvnY6Dhe4ba8nAmR2tYmz4PXNp2_8Sr9pw,3203
3
- antsibull_nox/ansible.py,sha256=2EgaPK9ckS_KYTgpvb5HU9UOb6q5dpP3Az8sr1S7MU4,9346
3
+ antsibull_nox/ansible.py,sha256=bPMwpkhk16ALoOfylFUK_sMKMhAXP5h7qyviDlC9A1Y,9338
4
4
  antsibull_nox/cli.py,sha256=NKeRlWc_0taNRcZcdMv9LHZ5nCz8-DEJxBLPxJ9vFYQ,3358
5
5
  antsibull_nox/config.py,sha256=_wPvRQ_RZq0qBXEU0o6Kxf-SbU3nRZZSo-5bYHdeUts,12240
6
6
  antsibull_nox/data_util.py,sha256=7FVoqESEc-_QdqrQ16K1AHRVHEglNbRCH_mNaYDJ7a4,953
@@ -22,6 +22,7 @@ antsibull_nox/data/action-groups.py,sha256=SoKoBXYoI_zCoFJ6p39_46M9lWzhwFeCQ8kib
22
22
  antsibull_nox/data/antsibull-nox-lint-config.py,sha256=tXkKd9AqgfDs5w7S6OaBIt9HnT0KSbiQIU9tFxtYE2U,657
23
23
  antsibull_nox/data/antsibull_nox_data_util.py,sha256=KBviE-NslEjmow1C5eORxj579RXobihEixClj-lrCgE,3350
24
24
  antsibull_nox/data/file-yamllint.py,sha256=hlS9tULwQSUMkdbYFfGtQGcPSj2scxEay6IalQfjSFE,3625
25
+ antsibull_nox/data/get-package-versions.py,sha256=GRp6cNf-aN_05d8-WOBtp6EcRja4-VFBjcB92xS_pFA,940
25
26
  antsibull_nox/data/license-check.py,sha256=or3GyQC0WWYMxMqL-369krGsHaySH1vX-2fwpRyJGp0,5665
26
27
  antsibull_nox/data/license-check.py.license,sha256=iPdFtdkeE3E2nCB-M5KHevbz4d5I-6ymOnKNTc954Dw,218
27
28
  antsibull_nox/data/no-trailing-whitespace.py,sha256=vPbrTWR-GRIb0SVTY-jV5nTkMJQP8Ta0wD73eBu5N40,1596
@@ -34,13 +35,13 @@ antsibull_nox/sessions/ansible_lint.py,sha256=ik2heGsvpRwYm_4XGwlm53UvWQ_7FHDWaB
34
35
  antsibull_nox/sessions/ansible_test.py,sha256=apHRgq8n2VDCEAce9wN6di9vM9ZNQKvXH4bhifefLvI,21006
35
36
  antsibull_nox/sessions/build_import_check.py,sha256=QgM5531eqo3AD7LPOJUKW3I23peEpb6oFLa6uu9DUv4,3683
36
37
  antsibull_nox/sessions/collections.py,sha256=nhj_W2tbnsVJw6p7NkyP1xvmr3ZUmSJzwVuK0HE3oxw,4681
37
- antsibull_nox/sessions/docs_check.py,sha256=cDZP175g1Syxmula516DDgvMcAi-idSqK4MUPiRqVmw,4205
38
+ antsibull_nox/sessions/docs_check.py,sha256=L9nn6_yshSNFAYSTxjWYegMQzegudaJ-3-tvD69GGW4,4595
38
39
  antsibull_nox/sessions/extra_checks.py,sha256=hKa6x1WaUSaVXvAN1ojM_tXkSTmHfd5A-2eBasyVkss,4910
39
40
  antsibull_nox/sessions/license_check.py,sha256=t5ut4ZluhFfk-qE6kcU8VNdvIGvzND81N7WCsbA4jLc,1824
40
41
  antsibull_nox/sessions/lint.py,sha256=GWXKmrfXIjWRDi3ztDVvbbGLom70-mZncYZm6zjeq-E,28072
41
- antsibull_nox/sessions/utils.py,sha256=rrQdzmjdrLQula8t-BCTKbO-tAmzfOKHNn1pN2B1QVc,5632
42
- antsibull_nox-0.6.0.dist-info/METADATA,sha256=dksNh3BabImd0iN2jm7YIH3UWlzb3pVHROuZDr1_A0g,7896
43
- antsibull_nox-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
44
- antsibull_nox-0.6.0.dist-info/entry_points.txt,sha256=solWA9TCB37UlaGk8sHXxJg-k1HWckfKdncHDBsVSsI,57
45
- antsibull_nox-0.6.0.dist-info/licenses/LICENSES/GPL-3.0-or-later.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
46
- antsibull_nox-0.6.0.dist-info/RECORD,,
42
+ antsibull_nox/sessions/utils.py,sha256=FlZZJvATdca_cFZeMqoEv1Bfdv971VAta1KyA4W3pi0,7840
43
+ antsibull_nox-0.7.0.dist-info/METADATA,sha256=kZd3w0-kMvbuZMpFUL3FHZo9iZ43mLEmm_-q4MubqJ0,7896
44
+ antsibull_nox-0.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
45
+ antsibull_nox-0.7.0.dist-info/entry_points.txt,sha256=solWA9TCB37UlaGk8sHXxJg-k1HWckfKdncHDBsVSsI,57
46
+ antsibull_nox-0.7.0.dist-info/licenses/LICENSES/GPL-3.0-or-later.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
47
+ antsibull_nox-0.7.0.dist-info/RECORD,,