antsibull-nox 0.0.1__py3-none-any.whl → 0.2.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/utils.py ADDED
@@ -0,0 +1,85 @@
1
+ # Author: Felix Fontein <felix@fontein.de>
2
+ # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or
3
+ # https://www.gnu.org/licenses/gpl-3.0.txt)
4
+ # SPDX-License-Identifier: GPL-3.0-or-later
5
+ # SPDX-FileCopyrightText: 2025, Ansible Project
6
+
7
+ """
8
+ General utilities.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import typing as t
14
+ from dataclasses import dataclass
15
+
16
+
17
+ @dataclass(order=True, frozen=True)
18
+ class Version:
19
+ """
20
+ Models a two-part version (major and minor).
21
+ """
22
+
23
+ major: int
24
+ minor: int
25
+
26
+ @classmethod
27
+ def parse(cls, version_string: str) -> Version:
28
+ """
29
+ Given a version string, parses it into a Version object.
30
+ Other components than major and minor version are ignored.
31
+ """
32
+ try:
33
+ major, minor = [int(v) for v in version_string.split(".")[:2]]
34
+ except (AttributeError, ValueError) as exc:
35
+ raise ValueError(
36
+ f"Cannot parse {version_string!r} as version string."
37
+ ) from exc
38
+ return Version(major=major, minor=minor)
39
+
40
+ def __str__(self) -> str:
41
+ return f"{self.major}.{self.minor}"
42
+
43
+ def next_minor_version(self) -> Version:
44
+ """
45
+ Returns the next minor version.
46
+
47
+ The major version stays the same, and the minor version is increased by 1.
48
+ """
49
+ return Version(self.major, self.minor + 1)
50
+
51
+ def previous_minor_version(self) -> Version:
52
+ """
53
+ Returns the previous minor version.
54
+ Raises a ValueError if there is none.
55
+
56
+ The major version stays the same, and the minor version is decreased by 1.
57
+ """
58
+ if self.minor == 0:
59
+ raise ValueError("No previous minor version exists")
60
+ return Version(self.major, self.minor - 1)
61
+
62
+
63
+ def version_range(
64
+ start: Version, end: Version, *, inclusive: bool
65
+ ) -> t.Generator[Version]:
66
+ """
67
+ Enumerate all versions starting at ``start`` until ``end``.
68
+
69
+ Whether ``end`` is included in the range depends on ``inclusive``.
70
+ """
71
+ if start.major != end.major:
72
+ raise ValueError(
73
+ f"Cannot list all versions from {start} to {end}"
74
+ " since they have different major versions"
75
+ )
76
+ version = start
77
+ while (version <= end) if inclusive else (version < end):
78
+ yield version
79
+ version = Version(major=version.major, minor=version.minor + 1)
80
+
81
+
82
+ __all__ = [
83
+ "Version",
84
+ "version_range",
85
+ ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: antsibull-nox
3
- Version: 0.0.1
3
+ Version: 0.2.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/
@@ -22,11 +22,13 @@ Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Programming Language :: Python :: 3.13
23
23
  Classifier: Typing :: Typed
24
24
  Requires-Python: >=3.9.0
25
- Requires-Dist: antsibull-fileutils<2.0.0,>=1.0.0
25
+ Requires-Dist: antsibull-fileutils<2.0.0,>=1.2.0
26
26
  Requires-Dist: nox>=2025.2.9
27
27
  Requires-Dist: packaging
28
+ Requires-Dist: pydantic~=2.0
28
29
  Requires-Dist: pyyaml
29
30
  Requires-Dist: semantic-version
31
+ Requires-Dist: tomli; python_version < '3.11'
30
32
  Provides-Extra: codeqa
31
33
  Requires-Dist: antsibull-changelog; extra == 'codeqa'
32
34
  Requires-Dist: flake8>=3.8.0; extra == 'codeqa'
@@ -67,12 +69,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
67
69
  -->
68
70
 
69
71
  # antsibull-nox -- Antsibull Nox Helper
72
+ [![Documentation](https://img.shields.io/badge/docs-brightgreen.svg)](https://ansible.readthedocs.io/projects/antsibull-nox/)
70
73
  [![Discuss on Matrix at #antsibull:ansible.com](https://img.shields.io/matrix/antsibull:ansible.com.svg?server_fqdn=ansible-accounts.ems.host&label=Discuss%20on%20Matrix%20at%20%23antsibull:ansible.com&logo=matrix)](https://matrix.to/#/#antsibull:ansible.com)
71
74
  [![Nox badge](https://github.com/ansible-community/antsibull-nox/actions/workflows/nox.yml/badge.svg)](https://github.com/ansible-community/antsibull-nox/actions?query=workflow%3A%22nox%22+branch%3Amain)
72
75
  [![Codecov badge](https://img.shields.io/codecov/c/github/ansible-community/antsibull-nox)](https://codecov.io/gh/ansible-community/antsibull-nox)
73
76
  [![REUSE status](https://api.reuse.software/badge/github.com/ansible-community/antsibull-nox)](https://api.reuse.software/info/github.com/ansible-community/antsibull-nox)
74
77
 
75
78
  A [nox](https://nox.thea.codes/en/stable/) helper for Ansible collections.
79
+ Please check out the [documentation](https://ansible.readthedocs.io/projects/antsibull-nox/) for more information.
76
80
 
77
81
  antsibull-nox is covered by the [Ansible Code of Conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html).
78
82
 
@@ -86,6 +90,12 @@ It can be installed with pip:
86
90
 
87
91
  pip install antsibull-nox
88
92
 
93
+ ## Versioning and compatibility
94
+
95
+ From version 1.0.0 on, antsibull-nox sticks to semantic versioning and aims at providing no backwards compatibility breaking changes [**to the documented API**](https://ansible.readthedocs.io/projects/antsibull-nox/reference/) during a major release cycle. We might make exceptions from this in case of security fixes for vulnerabilities that are severe enough.
96
+
97
+ Interfaces and functions that are not [documented in the API reference](https://ansible.readthedocs.io/projects/antsibull-nox/reference/) are exempt from this and might break even in bugfix releases!
98
+
89
99
  ## Development
90
100
 
91
101
  Install and run `nox` to run all tests. That's it for simple contributions!
@@ -139,5 +149,5 @@ General Public License v3 or, at your option, later. See
139
149
  [LICENSES/GPL-3.0-or-later.txt](https://github.com/ansible-community/antsibull-nox/tree/main/LICENSE)
140
150
  for a copy of the license.
141
151
 
142
- The repository follows the [REUSE Specification](https://reuse.software/spec/) for declaring copyright and
143
- licensing information. The only exception are changelog fragments in ``changelog/fragments/``.
152
+ The repository follows the [REUSE Specification](https://reuse.software/spec/)
153
+ for declaring copyright and licensing information.
@@ -0,0 +1,25 @@
1
+ antsibull_nox/__init__.py,sha256=GpVc0V0RONI7CXHDrGoyvTvL7Syl6UDKZWL_N_z6zGg,2145
2
+ antsibull_nox/ansible.py,sha256=_PugP3a6JXijptFwuUki5nq_66VA8e9gVZUpA5HewVg,8891
3
+ antsibull_nox/config.py,sha256=W1u-lL0x5o2XyGo7FiQY766Pr9bP9DAi0LDfO2O7FTQ,9412
4
+ antsibull_nox/data_util.py,sha256=7FVoqESEc-_QdqrQ16K1AHRVHEglNbRCH_mNaYDJ7a4,953
5
+ antsibull_nox/interpret_config.py,sha256=a7Zwm7k0t8rETOehxqpidigegcroJACS-4IsbIujW30,9703
6
+ antsibull_nox/paths.py,sha256=86HOynhCMTVop3ml_77JI06vM9nyK7PHMzLP_4M0V88,6317
7
+ antsibull_nox/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ antsibull_nox/python.py,sha256=0pyGqgwsuyc0BhzoXNZLTLbjaFA4kAYEHrFD6A1o1-o,2113
9
+ antsibull_nox/sessions.py,sha256=fYhSLOqA1YKskaxPAAudlnWGHpV5T0TVzB5APeNc1qI,57251
10
+ antsibull_nox/utils.py,sha256=lgBNuJ67Agl9YpFNWCjr6TBUcbC1LroZrJkv6S5VuxA,2437
11
+ antsibull_nox/collection/__init__.py,sha256=0zsFKqAZYw6Y5wdhddsbMAmx7dKvihS9bh6CstJ5b2A,1484
12
+ antsibull_nox/collection/data.py,sha256=sacVZF517x54B3G6F0hW8fTpEF7zyB8exSQJO9mvhLk,2609
13
+ antsibull_nox/collection/extract.py,sha256=qNVknQRtRrCt10aawuU1Z6NTs16CA1bUEX3WDGBw68g,684
14
+ antsibull_nox/collection/install.py,sha256=DbnXUBzQlzW6TzU_TAszuApix2F2n7w1AcUcPZ4Q4G4,17082
15
+ antsibull_nox/collection/search.py,sha256=cNe6zyR3l-5iSOX5kBRAeHgubkUKFJhwDtN7j0rn7w0,15477
16
+ antsibull_nox/data/action-groups.py,sha256=24l3583jcVRmCm5t8VZuMx68Del0s4iReACsvg4ijnU,6913
17
+ antsibull_nox/data/antsibull_nox_data_util.py,sha256=D4i_sKxjAeZuDV-z9Ibow0YYIqhXo2V_YC0LONLcEXM,2931
18
+ antsibull_nox/data/license-check.py,sha256=uXC2aP2EDxLfAEpAe6nG4pOldp3N6NX6uc-k9jdXDpU,5575
19
+ antsibull_nox/data/license-check.py.license,sha256=iPdFtdkeE3E2nCB-M5KHevbz4d5I-6ymOnKNTc954Dw,218
20
+ antsibull_nox/data/no-unwanted-files.py,sha256=_B3m-XWvWpdzGN-XAP8rLIS_5RMJGntFWL-Jy0WY9Mc,2959
21
+ antsibull_nox/data/plugin-yamllint.py,sha256=ELK1pTLwDFwGfGgwRSGUU0hvOgk4P6oF_4P-y0DQIqc,7368
22
+ antsibull_nox-0.2.0.dist-info/METADATA,sha256=izOXagec2VtPCMSGtQYWmw_68UfA5nfVyx3E0gwIb5g,7671
23
+ antsibull_nox-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
+ antsibull_nox-0.2.0.dist-info/licenses/LICENSES/GPL-3.0-or-later.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
25
+ antsibull_nox-0.2.0.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- antsibull_nox/__init__.py,sha256=UasB8S_Ty0XJP1KxodA8Wqksa1dt6Ghk7_PAD2VRpY8,425
2
- antsibull_nox/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- antsibull_nox/sessions.py,sha256=g3b27aW8l3upzuxT5HRgsBxGb-UAf1NDcL9T8ucQx8s,15638
4
- antsibull_nox-0.0.1.dist-info/METADATA,sha256=qC9hAvaZIeFyNyur2t3H9vJt2iMsRfHpka85pjj-JkU,6830
5
- antsibull_nox-0.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- antsibull_nox-0.0.1.dist-info/licenses/LICENSES/GPL-3.0-or-later.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
7
- antsibull_nox-0.0.1.dist-info/RECORD,,