renumerate 2.0.0__tar.gz → 2.1.0__tar.gz
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.
- {renumerate-2.0.0 → renumerate-2.1.0}/CHANGES.rst +41 -37
- {renumerate-2.0.0 → renumerate-2.1.0}/LICENSE +1 -1
- {renumerate-2.0.0 → renumerate-2.1.0}/MANIFEST.in +1 -1
- renumerate-2.1.0/PKG-INFO +173 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/README.rst +18 -8
- {renumerate-2.0.0 → renumerate-2.1.0}/docs/conf.py +10 -1
- {renumerate-2.0.0 → renumerate-2.1.0}/docs/index.rst +3 -0
- renumerate-2.1.0/noxfile.py +159 -0
- renumerate-2.1.0/pyproject.toml +205 -0
- renumerate-2.1.0/src/renumerate/py.typed +1 -0
- renumerate-2.1.0/src/renumerate.egg-info/PKG-INFO +173 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/src/renumerate.egg-info/SOURCES.txt +1 -1
- renumerate-2.1.0/src/renumerate.egg-info/requires.txt +2 -0
- renumerate-2.0.0/.readthedocs.yml +0 -15
- renumerate-2.0.0/PKG-INFO +0 -371
- renumerate-2.0.0/pyproject.toml +0 -316
- renumerate-2.0.0/src/renumerate/py.typed +0 -0
- renumerate-2.0.0/src/renumerate.egg-info/PKG-INFO +0 -371
- renumerate-2.0.0/src/renumerate.egg-info/requires.txt +0 -18
- {renumerate-2.0.0 → renumerate-2.1.0}/docs/CHANGES.rst +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/docs/README.rst +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/docs/_static/.keep +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/docs/_templates/.keep +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/setup.cfg +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/src/renumerate/__about__.py +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/src/renumerate/__init__.py +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/src/renumerate/_renumerate.py +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/src/renumerate.egg-info/dependency_links.txt +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/src/renumerate.egg-info/top_level.txt +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/src/renumerate.egg-info/zip-safe +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/tests/__init__.py +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/tests/__main__.py +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/tests/data/.keep +0 -0
- {renumerate-2.0.0 → renumerate-2.1.0}/tests/test_main.py +0 -0
|
@@ -1,68 +1,72 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
-
2.
|
|
4
|
+
2.1.0 (2026-01-20)
|
|
5
5
|
------------------
|
|
6
|
-
-
|
|
7
|
-
-
|
|
6
|
+
- Marked the package as typed.
|
|
7
|
+
- Copyright year update.
|
|
8
|
+
- Switched from tox to Nox for project automation.
|
|
9
|
+
- The documentation has been moved from Read the Docs to GitHub Pages.
|
|
10
|
+
- Added the nox's 'cleanup' test environment.
|
|
11
|
+
- Setup update (mainly dependencies) and bug fixes.
|
|
8
12
|
|
|
9
13
|
1.5.0 (2025-09-01)
|
|
10
14
|
------------------
|
|
11
|
-
-
|
|
12
|
-
- Setup (dependencies)
|
|
15
|
+
- Made the package typed.
|
|
16
|
+
- Setup update (mainly dependencies).
|
|
13
17
|
|
|
14
18
|
1.3.5 (2025-07-07)
|
|
15
19
|
------------------
|
|
16
|
-
- Setup (dependencies)
|
|
20
|
+
- Setup update (mainly dependencies).
|
|
17
21
|
|
|
18
22
|
1.3.4 (2025-06-11)
|
|
19
23
|
------------------
|
|
20
|
-
- Setup (dependencies)
|
|
24
|
+
- Setup update (mainly dependencies).
|
|
21
25
|
|
|
22
26
|
1.3.3 (2025-05-15)
|
|
23
27
|
------------------
|
|
24
|
-
- The distribution is now
|
|
25
|
-
- Setup (dependencies)
|
|
28
|
+
- The distribution is now built using 'build' instead of 'setuptools'.
|
|
29
|
+
- Setup update (mainly dependencies) (due to regressions in tox and setuptools).
|
|
26
30
|
|
|
27
31
|
1.3.1 (2025-05-04)
|
|
28
32
|
------------------
|
|
29
|
-
- Setup (dependencies)
|
|
33
|
+
- Setup update (mainly dependencies).
|
|
30
34
|
|
|
31
35
|
1.3.0 (2025-04-28)
|
|
32
36
|
------------------
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
- Setup (dependencies)
|
|
37
|
+
- Added support for Python 3.14
|
|
38
|
+
- Dropped support for Python 3.9 (due to compatibility issues).
|
|
39
|
+
- Updated Read the Docs' Python version to 3.13
|
|
40
|
+
- Updated tox's base_python to version 3.13
|
|
41
|
+
- Setup update (mainly dependencies).
|
|
38
42
|
|
|
39
43
|
1.2.11 (2025-03-20)
|
|
40
44
|
-------------------
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- Setup (dependencies)
|
|
45
|
+
- Added support for PyPy 3.11
|
|
46
|
+
- Dropped support for PyPy 3.9
|
|
47
|
+
- Setup update (mainly dependencies).
|
|
44
48
|
|
|
45
49
|
1.2.8 (2025-03-15)
|
|
46
50
|
------------------
|
|
47
|
-
- Setup (dependencies)
|
|
51
|
+
- Setup update (mainly dependencies).
|
|
48
52
|
|
|
49
53
|
1.2.7 (2025-02-14)
|
|
50
54
|
------------------
|
|
51
|
-
- Setup (dependencies)
|
|
55
|
+
- Setup update (mainly dependencies).
|
|
52
56
|
|
|
53
57
|
1.2.6 (2025-01-25)
|
|
54
58
|
------------------
|
|
55
|
-
- Setup (dependencies)
|
|
59
|
+
- Setup update (mainly dependencies).
|
|
56
60
|
|
|
57
61
|
1.2.5 (2025-01-20)
|
|
58
62
|
------------------
|
|
59
63
|
- Copyright year update.
|
|
60
|
-
- Setup (dependencies)
|
|
64
|
+
- Setup update (mainly dependencies).
|
|
61
65
|
|
|
62
66
|
1.2.4 (2024-12-13)
|
|
63
67
|
------------------
|
|
64
68
|
- Source distribution (\*.tar.gz now) is compliant with PEP-0625.
|
|
65
|
-
- Setup (dependencies)
|
|
69
|
+
- Setup update (mainly dependencies).
|
|
66
70
|
|
|
67
71
|
1.2.3 (2024-11-13)
|
|
68
72
|
------------------
|
|
@@ -70,21 +74,21 @@ Changelog
|
|
|
70
74
|
- 100% code linting.
|
|
71
75
|
- 100% code coverage.
|
|
72
76
|
- Tox configuration is now in native (toml) format.
|
|
73
|
-
- Setup (dependencies)
|
|
77
|
+
- Setup update (mainly dependencies).
|
|
74
78
|
|
|
75
79
|
1.2.2 (2024-10-30)
|
|
76
80
|
------------------
|
|
77
|
-
- Setup (dependencies)
|
|
81
|
+
- Setup update (mainly dependencies).
|
|
78
82
|
|
|
79
83
|
1.2.1 (2024-10-09)
|
|
80
84
|
------------------
|
|
81
|
-
-
|
|
82
|
-
- Setup (dependencies)
|
|
85
|
+
- Dropped support for Python 3.8
|
|
86
|
+
- Setup update (mainly dependencies).
|
|
83
87
|
|
|
84
88
|
1.1.14 (2024-08-13)
|
|
85
89
|
-------------------
|
|
86
|
-
-
|
|
87
|
-
- Setup (dependencies)
|
|
90
|
+
- Added support for Python 3.13
|
|
91
|
+
- Setup update (mainly dependencies).
|
|
88
92
|
|
|
89
93
|
1.1.12 (2024-01-26)
|
|
90
94
|
-------------------
|
|
@@ -93,16 +97,16 @@ Changelog
|
|
|
93
97
|
|
|
94
98
|
1.1.10 (2022-10-18)
|
|
95
99
|
-------------------
|
|
96
|
-
-
|
|
100
|
+
- The tox configuration has been moved to pyproject.toml
|
|
97
101
|
|
|
98
102
|
1.1.9 (2022-08-22)
|
|
99
103
|
------------------
|
|
100
|
-
-
|
|
104
|
+
- Added support for Python 3.10 and 3.11
|
|
101
105
|
- Setup update (currently based mainly on pyproject.toml).
|
|
102
106
|
|
|
103
107
|
1.1.7 (2022-01-10)
|
|
104
108
|
------------------
|
|
105
|
-
-
|
|
109
|
+
- Dropped support for Python 3.6.
|
|
106
110
|
- Copyright year update.
|
|
107
111
|
- Setup update.
|
|
108
112
|
|
|
@@ -112,20 +116,20 @@ Changelog
|
|
|
112
116
|
|
|
113
117
|
1.1.4 (2020-10-18)
|
|
114
118
|
------------------
|
|
115
|
-
-
|
|
119
|
+
- Dropped support for Python 3.5.
|
|
116
120
|
- Add unittests.
|
|
117
121
|
- Fixed docs setup.
|
|
118
122
|
|
|
119
123
|
1.0.13 (2020-09-22)
|
|
120
124
|
-------------------
|
|
121
|
-
-
|
|
122
|
-
-
|
|
125
|
+
- Added support for Python 3.8 and 3.9.
|
|
126
|
+
- Dropped support for Python 3.4.
|
|
123
127
|
- Setup: fix an improper dependencies versions.
|
|
124
128
|
- Setup general update and cleanup.
|
|
125
129
|
|
|
126
130
|
1.0.9 (2019-05-22)
|
|
127
131
|
------------------
|
|
128
|
-
-
|
|
132
|
+
- Dropped support for Python 2.
|
|
129
133
|
|
|
130
134
|
1.0.8 (2019-05-21)
|
|
131
135
|
------------------
|
|
@@ -135,7 +139,7 @@ Changelog
|
|
|
135
139
|
|
|
136
140
|
1.0.7 (2018-11-08)
|
|
137
141
|
------------------
|
|
138
|
-
-
|
|
142
|
+
- Dropped support for Python 2.6 and 3.0-3.3.
|
|
139
143
|
- Update required setuptools version.
|
|
140
144
|
|
|
141
145
|
1.0.6 (2018-05-08)
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: renumerate
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: Reverse enumerate.
|
|
5
|
+
Author-email: Adam Karpierz <adam@karpierz.net>
|
|
6
|
+
Maintainer-email: Adam Karpierz <adam@karpierz.net>
|
|
7
|
+
License-Expression: Zlib
|
|
8
|
+
Project-URL: Homepage, https://pypi.org/project/renumerate/
|
|
9
|
+
Project-URL: Documentation, https://karpierz.github.io/renumerate/
|
|
10
|
+
Project-URL: History, https://karpierz.github.io/renumerate/CHANGES.html
|
|
11
|
+
Project-URL: Download, https://pypi.org/project/renumerate/
|
|
12
|
+
Project-URL: Repository, https://github.com/karpierz/renumerate
|
|
13
|
+
Project-URL: Tracker, https://github.com/karpierz/renumerate/issues
|
|
14
|
+
Project-URL: Sponsoring, https://www.paypal.com/donate/?hosted_button_id=FX8L7CJUGLW7S
|
|
15
|
+
Keywords: renumerate,enumerate
|
|
16
|
+
Platform: any
|
|
17
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
18
|
+
Classifier: Intended Audience :: Developers
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Natural Language :: Polish
|
|
21
|
+
Classifier: Programming Language :: Python
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
28
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
29
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
30
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
31
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
32
|
+
Classifier: Typing :: Typed
|
|
33
|
+
Requires-Python: <4.0.0,>=3.10.0
|
|
34
|
+
Description-Content-Type: text/x-rst; charset=UTF-8
|
|
35
|
+
License-File: LICENSE
|
|
36
|
+
Requires-Dist: typing-extensions>=4.15.0
|
|
37
|
+
Requires-Dist: pkg-about>=2.1.0
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
renumerate
|
|
41
|
+
==========
|
|
42
|
+
|
|
43
|
+
Reverse enumerate.
|
|
44
|
+
|
|
45
|
+
Overview
|
|
46
|
+
========
|
|
47
|
+
|
|
48
|
+
**renumerate(sequence, start=len(sequence)-1, end=0)**
|
|
49
|
+
|
|
50
|
+
| Return an enumerate_ object.
|
|
51
|
+
| *sequence* must be an object that has a __reversed__() method or supports the
|
|
52
|
+
sequence protocol (the __len__() method and the __getitem__() method with
|
|
53
|
+
integer arguments starting at 0).
|
|
54
|
+
| The __next__() method of the iterator returned by renumerate() returns a tuple
|
|
55
|
+
containing a count (from *start* which defaults to len(*sequence*) - 1 or ends at
|
|
56
|
+
*end* which defaults to 0 - but not both) and the values obtained from reverse
|
|
57
|
+
iterating over *sequence*.
|
|
58
|
+
|
|
59
|
+
`PyPI record`_.
|
|
60
|
+
|
|
61
|
+
`Documentation`_.
|
|
62
|
+
|
|
63
|
+
Usage
|
|
64
|
+
-----
|
|
65
|
+
|
|
66
|
+
.. code:: python
|
|
67
|
+
|
|
68
|
+
>>> from renumerate import renumerate
|
|
69
|
+
>>> seasons = ['Spring', 'Summer', 'Fall', 'Winter']
|
|
70
|
+
>>> list(renumerate(seasons))
|
|
71
|
+
[(3, 'Winter'), (2, 'Fall'), (1, 'Summer'), (0, 'Spring')]
|
|
72
|
+
>>> list(renumerate(seasons, start=4))
|
|
73
|
+
[(4, 'Winter'), (3, 'Fall'), (2, 'Summer'), (1, 'Spring')]
|
|
74
|
+
>>> list(renumerate(seasons, end=2))
|
|
75
|
+
[(5, 'Winter'), (4, 'Fall'), (3, 'Summer'), (2, 'Spring')]
|
|
76
|
+
|
|
77
|
+
Equivalent to:
|
|
78
|
+
|
|
79
|
+
.. code:: python
|
|
80
|
+
|
|
81
|
+
def renumerate(sequence, start=None, end=None):
|
|
82
|
+
if start is not None and end is not None:
|
|
83
|
+
raise TypeError("renumerate() only accepts start argument or end argument"
|
|
84
|
+
" - not both.")
|
|
85
|
+
if start is None: start = len(sequence) - 1
|
|
86
|
+
if end is None: end = 0
|
|
87
|
+
n = start + end
|
|
88
|
+
for elem in reversed(sequence):
|
|
89
|
+
yield n, elem
|
|
90
|
+
n -= 1
|
|
91
|
+
|
|
92
|
+
Installation
|
|
93
|
+
============
|
|
94
|
+
|
|
95
|
+
Prerequisites:
|
|
96
|
+
|
|
97
|
+
+ Python 3.10 or higher
|
|
98
|
+
|
|
99
|
+
* https://www.python.org/
|
|
100
|
+
|
|
101
|
+
+ pip
|
|
102
|
+
|
|
103
|
+
* https://pypi.org/project/pip/
|
|
104
|
+
|
|
105
|
+
To install run:
|
|
106
|
+
|
|
107
|
+
.. parsed-literal::
|
|
108
|
+
|
|
109
|
+
python -m pip install --upgrade |package|
|
|
110
|
+
|
|
111
|
+
Development
|
|
112
|
+
===========
|
|
113
|
+
|
|
114
|
+
Prerequisites:
|
|
115
|
+
|
|
116
|
+
+ Development is strictly based on *nox*. To install it run::
|
|
117
|
+
|
|
118
|
+
python -m pip install --upgrade nox
|
|
119
|
+
|
|
120
|
+
Visit `Development page`_.
|
|
121
|
+
|
|
122
|
+
Installation from sources:
|
|
123
|
+
|
|
124
|
+
clone the sources:
|
|
125
|
+
|
|
126
|
+
.. parsed-literal::
|
|
127
|
+
|
|
128
|
+
git clone |respository| |package|
|
|
129
|
+
|
|
130
|
+
and run:
|
|
131
|
+
|
|
132
|
+
.. parsed-literal::
|
|
133
|
+
|
|
134
|
+
python -m pip install ./|package|
|
|
135
|
+
|
|
136
|
+
or on development mode:
|
|
137
|
+
|
|
138
|
+
.. parsed-literal::
|
|
139
|
+
|
|
140
|
+
python -m pip install --editable ./|package|
|
|
141
|
+
|
|
142
|
+
License
|
|
143
|
+
=======
|
|
144
|
+
|
|
145
|
+
| |copyright|
|
|
146
|
+
| Licensed under the zlib/libpng License
|
|
147
|
+
| https://opensource.org/license/zlib
|
|
148
|
+
| Please refer to the accompanying LICENSE file.
|
|
149
|
+
|
|
150
|
+
Authors
|
|
151
|
+
=======
|
|
152
|
+
|
|
153
|
+
* Adam Karpierz <adam@karpierz.net>
|
|
154
|
+
|
|
155
|
+
Sponsoring
|
|
156
|
+
==========
|
|
157
|
+
|
|
158
|
+
| If you would like to sponsor the development of this project, your contribution
|
|
159
|
+
is greatly appreciated.
|
|
160
|
+
| As I am now retired, any support helps me dedicate more time to maintaining and
|
|
161
|
+
improving this work.
|
|
162
|
+
|
|
163
|
+
`Donate`_
|
|
164
|
+
|
|
165
|
+
.. |package| replace:: renumerate
|
|
166
|
+
.. |package_bold| replace:: **renumerate**
|
|
167
|
+
.. |copyright| replace:: Copyright (c) 2016-2026 Adam Karpierz
|
|
168
|
+
.. |respository| replace:: https://github.com/karpierz/renumerate
|
|
169
|
+
.. _Development page: https://github.com/karpierz/renumerate
|
|
170
|
+
.. _PyPI record: https://pypi.org/project/renumerate/
|
|
171
|
+
.. _Documentation: https://karpierz.github.io/renumerate/
|
|
172
|
+
.. _Donate: https://www.paypal.com/donate/?hosted_button_id=FX8L7CJUGLW7S
|
|
173
|
+
.. _enumerate: https://docs.python.org/library/functions.html#enumerate
|
|
@@ -6,7 +6,7 @@ Reverse enumerate.
|
|
|
6
6
|
Overview
|
|
7
7
|
========
|
|
8
8
|
|
|
9
|
-
**renumerate(sequence, start=len(sequence)-1, end=0)
|
|
9
|
+
**renumerate(sequence, start=len(sequence)-1, end=0)**
|
|
10
10
|
|
|
11
11
|
| Return an enumerate_ object.
|
|
12
12
|
| *sequence* must be an object that has a __reversed__() method or supports the
|
|
@@ -59,10 +59,9 @@ Prerequisites:
|
|
|
59
59
|
|
|
60
60
|
* https://www.python.org/
|
|
61
61
|
|
|
62
|
-
+ pip
|
|
62
|
+
+ pip
|
|
63
63
|
|
|
64
64
|
* https://pypi.org/project/pip/
|
|
65
|
-
* https://pypi.org/project/setuptools/
|
|
66
65
|
|
|
67
66
|
To install run:
|
|
68
67
|
|
|
@@ -75,9 +74,9 @@ Development
|
|
|
75
74
|
|
|
76
75
|
Prerequisites:
|
|
77
76
|
|
|
78
|
-
+ Development is strictly based on *
|
|
77
|
+
+ Development is strictly based on *nox*. To install it run::
|
|
79
78
|
|
|
80
|
-
python -m pip install --upgrade
|
|
79
|
+
python -m pip install --upgrade nox
|
|
81
80
|
|
|
82
81
|
Visit `Development page`_.
|
|
83
82
|
|
|
@@ -114,11 +113,22 @@ Authors
|
|
|
114
113
|
|
|
115
114
|
* Adam Karpierz <adam@karpierz.net>
|
|
116
115
|
|
|
116
|
+
Sponsoring
|
|
117
|
+
==========
|
|
118
|
+
|
|
119
|
+
| If you would like to sponsor the development of this project, your contribution
|
|
120
|
+
is greatly appreciated.
|
|
121
|
+
| As I am now retired, any support helps me dedicate more time to maintaining and
|
|
122
|
+
improving this work.
|
|
123
|
+
|
|
124
|
+
`Donate`_
|
|
125
|
+
|
|
117
126
|
.. |package| replace:: renumerate
|
|
118
127
|
.. |package_bold| replace:: **renumerate**
|
|
119
|
-
.. |copyright| replace:: Copyright (c) 2016-
|
|
120
|
-
.. |respository| replace:: https://github.com/karpierz/renumerate
|
|
128
|
+
.. |copyright| replace:: Copyright (c) 2016-2026 Adam Karpierz
|
|
129
|
+
.. |respository| replace:: https://github.com/karpierz/renumerate
|
|
121
130
|
.. _Development page: https://github.com/karpierz/renumerate
|
|
122
131
|
.. _PyPI record: https://pypi.org/project/renumerate/
|
|
123
|
-
.. _Documentation: https://
|
|
132
|
+
.. _Documentation: https://karpierz.github.io/renumerate/
|
|
133
|
+
.. _Donate: https://www.paypal.com/donate/?hosted_button_id=FX8L7CJUGLW7S
|
|
124
134
|
.. _enumerate: https://docs.python.org/library/functions.html#enumerate
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
# list see the documentation:
|
|
5
5
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
6
6
|
|
|
7
|
+
import os
|
|
8
|
+
|
|
7
9
|
from sphinx import application
|
|
8
10
|
|
|
9
|
-
about = __import__("pkg_about").about_from_setup()
|
|
11
|
+
about = __import__("pkg_about").about_from_setup(1)
|
|
10
12
|
|
|
11
13
|
def setup(app: application.Sphinx) -> None:
|
|
12
14
|
pass
|
|
@@ -115,3 +117,10 @@ apidoc_output_dir = 'api'
|
|
|
115
117
|
|
|
116
118
|
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
|
117
119
|
todo_include_todos = False
|
|
120
|
+
|
|
121
|
+
# -- Options for linkcheck extension -----------------------------------------
|
|
122
|
+
|
|
123
|
+
linkcheck_ignore = []
|
|
124
|
+
doc_url = about.__urls__.get("Documentation")
|
|
125
|
+
if doc_url is not None and os.getenv("PKG_INITIAL_BUILD") == "1":
|
|
126
|
+
linkcheck_ignore += [rf"{doc_url.rstrip('/')}(/.*)?"]
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Copyright (c) 2025 Adam Karpierz
|
|
2
|
+
# SPDX-License-Identifier: Zlib
|
|
3
|
+
|
|
4
|
+
# /// script
|
|
5
|
+
# dependencies = ["nox>=2025.11.12", "packaging>=26.0.0"]
|
|
6
|
+
# ///
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any
|
|
11
|
+
import sys
|
|
12
|
+
import os
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from functools import partial
|
|
15
|
+
import shutil
|
|
16
|
+
import subprocess
|
|
17
|
+
import warnings
|
|
18
|
+
|
|
19
|
+
import nox
|
|
20
|
+
import nox_ext
|
|
21
|
+
import packaging.version
|
|
22
|
+
from rich.pretty import pprint
|
|
23
|
+
from rich import print
|
|
24
|
+
|
|
25
|
+
here = Path(__file__).resolve().parent
|
|
26
|
+
env = os.environ
|
|
27
|
+
|
|
28
|
+
# Configuration
|
|
29
|
+
|
|
30
|
+
PKG = nox.get_package_data(here)
|
|
31
|
+
|
|
32
|
+
PYPROJECT = nox.project.load_toml("pyproject.toml")
|
|
33
|
+
PY_VERSIONS = nox.project.python_versions(PYPROJECT)
|
|
34
|
+
PY_DEFAULT = "3.13"
|
|
35
|
+
|
|
36
|
+
PKG_TOP_LEVELS = ["renumerate"]
|
|
37
|
+
|
|
38
|
+
# Prevent Python from writing bytecode
|
|
39
|
+
env["PYTHONDONTWRITEBYTECODE"] = "1"
|
|
40
|
+
# env["PKG_INITIAL_BUILD"] = "1"
|
|
41
|
+
|
|
42
|
+
# Helpers & Utils
|
|
43
|
+
|
|
44
|
+
copytree = shutil.copytree
|
|
45
|
+
rmtree = partial(shutil.rmtree, ignore_errors=True)
|
|
46
|
+
|
|
47
|
+
# Sessions
|
|
48
|
+
|
|
49
|
+
@nox.session(python=[PY_DEFAULT], default=False,
|
|
50
|
+
tags=["prepare"], requires=["cleanup"])
|
|
51
|
+
def prepare(session: nox.Session) -> None:
|
|
52
|
+
"""Preparing the repository"""
|
|
53
|
+
cmd = here/".aprep.cmd"
|
|
54
|
+
if cmd.is_file(): subprocess.run([cmd])
|
|
55
|
+
|
|
56
|
+
@nox.session(python=[PY_DEFAULT], default=False,
|
|
57
|
+
tags=["cleanup"])
|
|
58
|
+
def cleanup(session: nox.Session) -> None:
|
|
59
|
+
"""Cleaning the repository"""
|
|
60
|
+
#no_package = true
|
|
61
|
+
cmd = here/".clean.cmd"
|
|
62
|
+
if cmd.is_file(): subprocess.run([cmd], stderr=subprocess.DEVNULL)
|
|
63
|
+
rmtree(here/"build")
|
|
64
|
+
rmtree(here/"dist"),
|
|
65
|
+
for item in here.glob("src/*.egg-info"): rmtree(item)
|
|
66
|
+
for item in here.glob("**/__pycache__"): rmtree(item)
|
|
67
|
+
for item in here.glob("**/.mypy_cache"): rmtree(item)
|
|
68
|
+
rmtree(here/".tox")
|
|
69
|
+
rmtree(here/".nox")
|
|
70
|
+
|
|
71
|
+
@nox.session(python=[*PY_VERSIONS, "pypy3.10", "pypy3.11"])
|
|
72
|
+
def tests(session: nox.Session) -> None:
|
|
73
|
+
"""Running tests"""
|
|
74
|
+
session.install(".", "--group=test")
|
|
75
|
+
session.py("--version")
|
|
76
|
+
session.py("-m", "tests", *session.posargs)
|
|
77
|
+
|
|
78
|
+
@nox.session(python=[PY_DEFAULT],
|
|
79
|
+
tags=["coverage"])
|
|
80
|
+
def coverage(session: nox.Session) -> None:
|
|
81
|
+
"""Running code coverage analysis"""
|
|
82
|
+
session.install(".", "--group=coverage")
|
|
83
|
+
session.py("-m", "coverage", "erase")
|
|
84
|
+
session.py("-m", "coverage", "run", "-m", "tests", *session.posargs, success_codes=range(0, 256))
|
|
85
|
+
session.py("-m", "coverage", "html", success_codes=range(0, 256))
|
|
86
|
+
session.py("-m", "coverage", "report")
|
|
87
|
+
|
|
88
|
+
@nox.session(python=[PY_DEFAULT],
|
|
89
|
+
tags=["docs"])
|
|
90
|
+
def docs(session: nox.Session) -> None:
|
|
91
|
+
"""Building documentation and running doc tests"""
|
|
92
|
+
session.install(".", "--group=docs")
|
|
93
|
+
html_path = here/"build/docs/html"
|
|
94
|
+
session.py("-m", "sphinxlint", "-i", "#arch", "-i", ".nox", "-i", ".tox",
|
|
95
|
+
"-i", "build", "-i", "dist", "-i", ".mypy_cache")
|
|
96
|
+
#session.run("python","-m", "sphinx.apidoc", "-f", *[session.site_packages/f"{item}/"
|
|
97
|
+
# for item in PKG_TOP_LEVELS])
|
|
98
|
+
session.py("-m", "sphinx.cmd.build", "-W", "-a", "-b", "html", "-E", here/"docs", here/"build/docs/html")
|
|
99
|
+
session.py("-m", "sphinx.cmd.build", "-W", "-a", "-b", "doctest", here/"docs", here/"build/docs/html")
|
|
100
|
+
session.py("-m", "sphinx.cmd.build", "-W", "-a", "-b", "linkcheck", here/"docs", here/"build/docs/html")
|
|
101
|
+
|
|
102
|
+
@nox.session(python=[PY_DEFAULT], default=False,
|
|
103
|
+
tags=["build"], requires=[f"{tests.name}-{item}" for item in tests.python] + ["docs"])
|
|
104
|
+
def build(session: nox.Session) -> None:
|
|
105
|
+
"""Building the package"""
|
|
106
|
+
session.install("--group=build")
|
|
107
|
+
session.py("-m", "check_manifest", "-v")
|
|
108
|
+
session.py("-m", "build")
|
|
109
|
+
# Verify distribution files
|
|
110
|
+
session.py("-m", "twine", "check", "dist/*")
|
|
111
|
+
|
|
112
|
+
@nox.session(python=[PY_DEFAULT], default=False,
|
|
113
|
+
tags=["publish"], requires=["build"])
|
|
114
|
+
def publish(session: nox.Session) -> None:
|
|
115
|
+
"""Publishing the package and documentation"""
|
|
116
|
+
session.install("--group=publish")
|
|
117
|
+
# Publish on PyPI
|
|
118
|
+
session.py("-m", "twine", "upload", "dist/*")
|
|
119
|
+
# Publish documentation on GitHub Pages
|
|
120
|
+
# checkout gh-pages worktree
|
|
121
|
+
env_dir = Path(session.virtualenv.location)
|
|
122
|
+
gh_pages_dir = env_dir/"gh-pages"
|
|
123
|
+
rmtree(gh_pages_dir)
|
|
124
|
+
session.run("git", "worktree", "prune")
|
|
125
|
+
#session.run("git", "worktree", "add", gh_pages_dir, "gh-pages")
|
|
126
|
+
session.run("git", "worktree", "add", "-B", "gh-pages", gh_pages_dir)
|
|
127
|
+
# clean old docs
|
|
128
|
+
(gh_pages_dir/".nojekyll").touch()
|
|
129
|
+
for fpath in gh_pages_dir.iterdir():
|
|
130
|
+
if fpath.name not in (".git",".nojekyll"):
|
|
131
|
+
if fpath.is_dir():
|
|
132
|
+
rmtree(fpath)
|
|
133
|
+
else:
|
|
134
|
+
fpath.unlink(missing_ok=True)
|
|
135
|
+
# copy new docs
|
|
136
|
+
copytree(here/"build/docs/html", gh_pages_dir, dirs_exist_ok=True)
|
|
137
|
+
# commit + push
|
|
138
|
+
session.run("git", "-C", gh_pages_dir, "add", ".")
|
|
139
|
+
session.run("git", "-C", gh_pages_dir, "commit", "-m", "Update documentation")
|
|
140
|
+
session.run("git", "-C", gh_pages_dir, "push", "--force", "origin", "gh-pages")
|
|
141
|
+
# remove worktree
|
|
142
|
+
session.run("git", "worktree", "remove", "--force", gh_pages_dir)
|
|
143
|
+
rmtree(gh_pages_dir)
|
|
144
|
+
session.run("git", "worktree", "prune")
|
|
145
|
+
|
|
146
|
+
@nox.session(python=[PY_DEFAULT],
|
|
147
|
+
tags=["typing"])
|
|
148
|
+
def typing(session: nox.Session) -> None:
|
|
149
|
+
"""Static type checking"""
|
|
150
|
+
session.install(".", "--group=typing")
|
|
151
|
+
session.py("-m", "mypy")
|
|
152
|
+
|
|
153
|
+
@nox.session(python=[PY_DEFAULT],
|
|
154
|
+
tags=["lint"])
|
|
155
|
+
def lint(session: nox.Session) -> None:
|
|
156
|
+
"""Checking code style and quality"""
|
|
157
|
+
session.install(".", "--group=lint")
|
|
158
|
+
session.py("-m", "flake8", *[session.site_packages/f"{item}/"
|
|
159
|
+
for item in PKG_TOP_LEVELS])
|