annotate 2.0.8__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.
Files changed (32) hide show
  1. {annotate-2.0.8 → annotate-2.1.0}/CHANGES.rst +33 -30
  2. {annotate-2.0.8 → annotate-2.1.0}/MANIFEST.in +1 -1
  3. {annotate-2.0.8 → annotate-2.1.0}/PKG-INFO +25 -221
  4. {annotate-2.0.8 → annotate-2.1.0}/README.rst +18 -8
  5. {annotate-2.0.8 → annotate-2.1.0}/docs/conf.py +10 -1
  6. {annotate-2.0.8 → annotate-2.1.0}/docs/index.rst +3 -0
  7. annotate-2.1.0/noxfile.py +159 -0
  8. annotate-2.1.0/pyproject.toml +205 -0
  9. annotate-2.1.0/src/annotate/py.typed +1 -0
  10. {annotate-2.0.8 → annotate-2.1.0}/src/annotate.egg-info/PKG-INFO +25 -221
  11. {annotate-2.0.8 → annotate-2.1.0}/src/annotate.egg-info/SOURCES.txt +1 -1
  12. annotate-2.1.0/src/annotate.egg-info/requires.txt +2 -0
  13. annotate-2.0.8/.readthedocs.yml +0 -15
  14. annotate-2.0.8/pyproject.toml +0 -337
  15. annotate-2.0.8/src/annotate/py.typed +0 -0
  16. annotate-2.0.8/src/annotate.egg-info/requires.txt +0 -18
  17. {annotate-2.0.8 → annotate-2.1.0}/LICENSE +0 -0
  18. {annotate-2.0.8 → annotate-2.1.0}/docs/CHANGES.rst +0 -0
  19. {annotate-2.0.8 → annotate-2.1.0}/docs/README.rst +0 -0
  20. {annotate-2.0.8 → annotate-2.1.0}/docs/_static/.keep +0 -0
  21. {annotate-2.0.8 → annotate-2.1.0}/docs/_templates/.keep +0 -0
  22. {annotate-2.0.8 → annotate-2.1.0}/setup.cfg +0 -0
  23. {annotate-2.0.8 → annotate-2.1.0}/src/annotate/__about__.py +0 -0
  24. {annotate-2.0.8 → annotate-2.1.0}/src/annotate/__init__.py +0 -0
  25. {annotate-2.0.8 → annotate-2.1.0}/src/annotate/_annotate.py +0 -0
  26. {annotate-2.0.8 → annotate-2.1.0}/src/annotate.egg-info/dependency_links.txt +0 -0
  27. {annotate-2.0.8 → annotate-2.1.0}/src/annotate.egg-info/top_level.txt +0 -0
  28. {annotate-2.0.8 → annotate-2.1.0}/src/annotate.egg-info/zip-safe +0 -0
  29. {annotate-2.0.8 → annotate-2.1.0}/tests/__init__.py +0 -0
  30. {annotate-2.0.8 → annotate-2.1.0}/tests/__main__.py +0 -0
  31. {annotate-2.0.8 → annotate-2.1.0}/tests/data/.keep +0 -0
  32. {annotate-2.0.8 → annotate-2.1.0}/tests/test_main.py +0 -0
@@ -1,81 +1,84 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- 2.0.8 (2025-11-30)
4
+ 2.1.0 (2026-01-20)
5
5
  ------------------
6
- - Mark the package as typed.
6
+ - Marked the package as typed.
7
7
  - 100% code coverage.
8
- - Add tox's tool.tox.env.cleanup testenv.
9
- - Setup (dependencies) update.
8
+ - Copyright year update.
9
+ - Switched from tox to Nox for project automation.
10
+ - The documentation has been moved from Read the Docs to GitHub Pages.
11
+ - Added the nox's 'cleanup' test environment.
12
+ - Setup update (mainly dependencies) and bug fixes.
10
13
 
11
14
  1.3.0 (2025-09-01)
12
15
  ------------------
13
- - Making the package typed.
14
- - Setup (dependencies) update.
16
+ - Made the package typed.
17
+ - Setup update (mainly dependencies).
15
18
 
16
19
  1.2.4 (2025-07-07)
17
20
  ------------------
18
- - Setup (dependencies) update.
21
+ - Setup update (mainly dependencies).
19
22
 
20
23
  1.2.3 (2025-06-11)
21
24
  ------------------
22
- - Setup (dependencies) update.
25
+ - Setup update (mainly dependencies).
23
26
 
24
27
  1.2.2 (2025-05-15)
25
28
  ------------------
26
- - The distribution is now created using 'build' instead of 'setuptools'.
27
- - Setup (dependencies) update (due to regressions in tox and setuptools).
29
+ - The distribution is now built using 'build' instead of 'setuptools'.
30
+ - Setup update (mainly dependencies) (due to regressions in tox and setuptools).
28
31
 
29
32
  1.2.1 (2025-05-04)
30
33
  ------------------
31
- - Setup (dependencies) update.
34
+ - Setup update (mainly dependencies).
32
35
 
33
36
  1.2.0 (2025-04-28)
34
37
  ------------------
35
- - Add support for Python 3.14
36
- - Drop support for Python 3.9 (due to compatibility issues).
37
- - Update readthedocs's python to version 3.13
38
- - Update tox's base_python to version 3.13
39
- - Setup (dependencies) update.
38
+ - Added support for Python 3.14
39
+ - Dropped support for Python 3.9 (due to compatibility issues).
40
+ - Updated Read the Docs' Python version to 3.13
41
+ - Updated tox's base_python to version 3.13
42
+ - Setup update (mainly dependencies).
40
43
 
41
44
  1.1.5 (2025-02-14)
42
45
  ------------------
43
- - Setup (dependencies) update.
46
+ - Setup update (mainly dependencies).
44
47
 
45
48
  1.1.4 (2025-01-25)
46
49
  ------------------
47
50
  - Copyright year update.
48
- - Setup (dependencies) update.
51
+ - Setup update (mainly dependencies).
49
52
 
50
53
  1.1.3 (2024-12-13)
51
54
  ------------------
52
55
  - Source distribution (\*.tar.gz now) is compliant with PEP-0625.
53
56
  - 100% code linting.
54
57
  - Tox configuration is now in native (toml) format.
55
- - Setup (dependencies) update.
58
+ - Setup update (mainly dependencies).
56
59
 
57
60
  1.1.2 (2024-10-30)
58
61
  ------------------
59
- - Setup (dependencies) update.
62
+ - Setup update (mainly dependencies).
60
63
 
61
64
  1.1.1 (2024-10-09)
62
65
  ------------------
63
- - Setup (dependencies) update.
66
+ - Setup update (mainly dependencies).
64
67
 
65
68
  1.1.0 (2024-09-30)
66
69
  ------------------
67
- - Drop support for Python 3.8
68
- - Setup (dependencies) update.
70
+ - Dropped support for Python 3.8
71
+ - Setup update (mainly dependencies).
69
72
 
70
73
  1.0.20 (2024-08-13)
71
74
  -------------------
72
- - Add support for Python 3.12 and 3.13
73
- - Drop support for Python 3.7
74
- - Setup (dependencies) update.
75
+ - Added support for Python 3.12 and 3.13
76
+ - Dropped support for Python 3.7
77
+ - Setup update (mainly dependencies).
75
78
 
76
79
  1.0.19 (2022-10-18)
77
80
  -------------------
78
- - Tox configuration has been moved to pyproject.toml
81
+ - The tox configuration has been moved to pyproject.toml
79
82
 
80
83
  1.0.18 (2022-08-22)
81
84
  -------------------
@@ -83,12 +86,12 @@ Changelog
83
86
 
84
87
  1.0.17 (2022-07-24)
85
88
  -------------------
86
- - Add support for Python 3.10 and 3.11
89
+ - Added support for Python 3.10 and 3.11
87
90
  - Setup update (currently based mainly on pyproject.toml).
88
91
 
89
92
  1.0.16 (2022-01-10)
90
93
  -------------------
91
- - Drop support for Python 2, 3.5 and 3.6
94
+ - Dropped support for Python 2, 3.5 and 3.6
92
95
  - Copyright year update.
93
96
  - Setup update.
94
97
 
@@ -105,7 +108,7 @@ Changelog
105
108
 
106
109
  1.0.7 (2018-11-08)
107
110
  ------------------
108
- - Drop support for Python 2.6 and 3.0-3.3
111
+ - Dropped support for Python 2.6 and 3.0-3.3
109
112
  - Update required setuptools version.
110
113
 
111
114
  1.0.6 (2018-05-08)
@@ -5,7 +5,7 @@ include README.rst
5
5
  include CHANGES.rst
6
6
  include LICENSE
7
7
  include pyproject.toml
8
- include .readthedocs.yml
8
+ include noxfile.py
9
9
 
10
10
  graft docs
11
11
 
@@ -1,15 +1,17 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: annotate
3
- Version: 2.0.8
3
+ Version: 2.1.0
4
4
  Summary: Decorator to set a function's __annotations__ like Py3.
5
5
  Author-email: Adam Karpierz <adam@karpierz.net>
6
6
  Maintainer-email: Adam Karpierz <adam@karpierz.net>
7
7
  License-Expression: Zlib
8
8
  Project-URL: Homepage, https://pypi.org/project/annotate/
9
- Project-URL: Documentation, https://annotate2.readthedocs.io/
9
+ Project-URL: Documentation, https://karpierz.github.io/annotate/
10
+ Project-URL: History, https://karpierz.github.io/annotate/CHANGES.html
10
11
  Project-URL: Download, https://pypi.org/project/annotate/
11
- Project-URL: Source, https://github.com/karpierz/annotate
12
- Project-URL: Issues, https://github.com/karpierz/annotate/issues
12
+ Project-URL: Repository, https://github.com/karpierz/annotate
13
+ Project-URL: Tracker, https://github.com/karpierz/annotate/issues
14
+ Project-URL: Sponsoring, https://www.paypal.com/donate/?hosted_button_id=FX8L7CJUGLW7S
13
15
  Keywords: annotate,typing,decorator
14
16
  Platform: any
15
17
  Classifier: Development Status :: 5 - Production/Stable
@@ -31,22 +33,8 @@ Classifier: Typing :: Typed
31
33
  Requires-Python: <4.0.0,>=3.10.0
32
34
  Description-Content-Type: text/x-rst; charset=UTF-8
33
35
  License-File: LICENSE
34
- Requires-Dist: setuptools>=80.9.0
35
36
  Requires-Dist: typing-extensions>=4.15.0
36
- Requires-Dist: pkg-about>=2.0.0
37
- Provides-Extra: doc
38
- Requires-Dist: sphinx>=8.1.3; extra == "doc"
39
- Requires-Dist: sphinx-autodoc-typehints>=3.0.1; extra == "doc"
40
- Requires-Dist: sphinx-toolbox>=4.0.0; extra == "doc"
41
- Requires-Dist: sphinx-tabs>=3.4.5; extra == "doc"
42
- Requires-Dist: sphinx-copybutton>=0.5.2; extra == "doc"
43
- Requires-Dist: sphinxcontrib-spelling>=8.0.2; extra == "doc"
44
- Requires-Dist: sphinx-lint>=1.0.2; extra == "doc"
45
- Requires-Dist: restructuredtext-lint>=2.0.2; extra == "doc"
46
- Requires-Dist: nbsphinx>=0.9.8; extra == "doc"
47
- Provides-Extra: test
48
- Requires-Dist: deepdiff>=8.6.1; extra == "test"
49
- Requires-Dist: rich>=14.2.0; extra == "test"
37
+ Requires-Dist: pkg-about>=2.1.0
50
38
  Dynamic: license-file
51
39
 
52
40
  annotate
@@ -74,9 +62,9 @@ Examples
74
62
  from typing import Optional, Tuple, Union, Sequence
75
63
  from annotate import annotate
76
64
 
77
- from .lib import cached
78
- from . import jni
65
+ import jni
79
66
 
67
+ from .lib import cached
80
68
  from .jobjectbase import JObjectBase
81
69
  from .jclass import JClass
82
70
  from .jobject import JObject
@@ -222,10 +210,9 @@ Prerequisites:
222
210
 
223
211
  * https://www.python.org/
224
212
 
225
- + pip and setuptools
213
+ + pip
226
214
 
227
215
  * https://pypi.org/project/pip/
228
- * https://pypi.org/project/setuptools/
229
216
 
230
217
  To install run:
231
218
 
@@ -238,9 +225,9 @@ Development
238
225
 
239
226
  Prerequisites:
240
227
 
241
- + Development is strictly based on *tox*. To install it run::
228
+ + Development is strictly based on *nox*. To install it run::
242
229
 
243
- python -m pip install --upgrade tox
230
+ python -m pip install --upgrade nox
244
231
 
245
232
  Visit `Development page`_.
246
233
 
@@ -277,204 +264,21 @@ Authors
277
264
 
278
265
  * Adam Karpierz <adam@karpierz.net>
279
266
 
267
+ Sponsoring
268
+ ==========
269
+
270
+ | If you would like to sponsor the development of this project, your contribution
271
+ is greatly appreciated.
272
+ | As I am now retired, any support helps me dedicate more time to maintaining and
273
+ improving this work.
274
+
275
+ `Donate`_
276
+
280
277
  .. |package| replace:: annotate
281
278
  .. |package_bold| replace:: **annotate**
282
279
  .. |copyright| replace:: Copyright (c) 2012-2026 Adam Karpierz
283
- .. |respository| replace:: https://github.com/karpierz/annotate.git
280
+ .. |respository| replace:: https://github.com/karpierz/annotate
284
281
  .. _Development page: https://github.com/karpierz/annotate
285
282
  .. _PyPI record: https://pypi.org/project/annotate/
286
- .. _Documentation: https://annotate.readthedocs.io/
287
-
288
- Changelog
289
- =========
290
-
291
- 2.0.8 (2025-11-30)
292
- ------------------
293
- - Mark the package as typed.
294
- - 100% code coverage.
295
- - Add tox's tool.tox.env.cleanup testenv.
296
- - Setup (dependencies) update.
297
-
298
- 1.3.0 (2025-09-01)
299
- ------------------
300
- - Making the package typed.
301
- - Setup (dependencies) update.
302
-
303
- 1.2.4 (2025-07-07)
304
- ------------------
305
- - Setup (dependencies) update.
306
-
307
- 1.2.3 (2025-06-11)
308
- ------------------
309
- - Setup (dependencies) update.
310
-
311
- 1.2.2 (2025-05-15)
312
- ------------------
313
- - The distribution is now created using 'build' instead of 'setuptools'.
314
- - Setup (dependencies) update (due to regressions in tox and setuptools).
315
-
316
- 1.2.1 (2025-05-04)
317
- ------------------
318
- - Setup (dependencies) update.
319
-
320
- 1.2.0 (2025-04-28)
321
- ------------------
322
- - Add support for Python 3.14
323
- - Drop support for Python 3.9 (due to compatibility issues).
324
- - Update readthedocs's python to version 3.13
325
- - Update tox's base_python to version 3.13
326
- - Setup (dependencies) update.
327
-
328
- 1.1.5 (2025-02-14)
329
- ------------------
330
- - Setup (dependencies) update.
331
-
332
- 1.1.4 (2025-01-25)
333
- ------------------
334
- - Copyright year update.
335
- - Setup (dependencies) update.
336
-
337
- 1.1.3 (2024-12-13)
338
- ------------------
339
- - Source distribution (\*.tar.gz now) is compliant with PEP-0625.
340
- - 100% code linting.
341
- - Tox configuration is now in native (toml) format.
342
- - Setup (dependencies) update.
343
-
344
- 1.1.2 (2024-10-30)
345
- ------------------
346
- - Setup (dependencies) update.
347
-
348
- 1.1.1 (2024-10-09)
349
- ------------------
350
- - Setup (dependencies) update.
351
-
352
- 1.1.0 (2024-09-30)
353
- ------------------
354
- - Drop support for Python 3.8
355
- - Setup (dependencies) update.
356
-
357
- 1.0.20 (2024-08-13)
358
- -------------------
359
- - Add support for Python 3.12 and 3.13
360
- - Drop support for Python 3.7
361
- - Setup (dependencies) update.
362
-
363
- 1.0.19 (2022-10-18)
364
- -------------------
365
- - Tox configuration has been moved to pyproject.toml
366
-
367
- 1.0.18 (2022-08-22)
368
- -------------------
369
- - Setup update.
370
-
371
- 1.0.17 (2022-07-24)
372
- -------------------
373
- - Add support for Python 3.10 and 3.11
374
- - Setup update (currently based mainly on pyproject.toml).
375
-
376
- 1.0.16 (2022-01-10)
377
- -------------------
378
- - Drop support for Python 2, 3.5 and 3.6
379
- - Copyright year update.
380
- - Setup update.
381
-
382
- 1.0.15 (2020-10-18)
383
- -------------------
384
- - Setup: fix an improper dependencies versions.
385
- - Setup general update and cleanup.
386
- - Fixed docs setup.
387
-
388
- 1.0.8 (2019-05-21)
389
- ------------------
390
- - Update required setuptools version.
391
- - Setup update and improvements.
392
-
393
- 1.0.7 (2018-11-08)
394
- ------------------
395
- - Drop support for Python 2.6 and 3.0-3.3
396
- - Update required setuptools version.
397
-
398
- 1.0.6 (2018-05-08)
399
- ------------------
400
- - Update required setuptools version.
401
- - Improve and simplify setup and packaging.
402
-
403
- 1.0.5 (2018-02-26)
404
- ------------------
405
- - Improve and simplify setup and packaging.
406
-
407
- 1.0.4 (2018-01-28)
408
- ------------------
409
- - Fix a bug and inconsistencies in tox.ini
410
- - Update of README.rst.
411
-
412
- 1.0.1 (2018-01-24)
413
- ------------------
414
- - Update required Sphinx version.
415
- - Update doc Sphinx configuration files.
416
-
417
- 1.0.0 (2017-11-18)
418
- ------------------
419
- - Setup improvements.
420
- - Other minor improvements.
421
-
422
- 0.7.4 (2017-01-05)
423
- ------------------
424
- - Minor setup improvements.
425
-
426
- 0.7.3 (2016-09-25)
427
- ------------------
428
- - Fix bug in setup.py
429
-
430
- 0.7.1 (2016-09-25)
431
- ------------------
432
- - More PEP8 compliant
433
-
434
- 0.6.7 (2016-09-24)
435
- ------------------
436
- - Minor description suplement
437
-
438
- 0.6.4 (2016-09-23)
439
- ------------------
440
- - Simplify package structure.
441
-
442
- 0.6.3 (2016-06-19)
443
- ------------------
444
- - | Fix incompatibility for older versions of setuptools.
445
- | Add example.
446
-
447
- 0.6.0 (2015-08-17)
448
- ------------------
449
- - Python3 support.
450
-
451
- 0.5.1 (2015-02-27)
452
- ------------------
453
- - | Remove 'returns' as keyword argument for declare return type.
454
- | For now, the type of returned value should be declared by the
455
- | first positional argument.
456
-
457
- 0.3.3 (2014-09-15)
458
- ------------------
459
- - Add wheels.
460
-
461
- 0.3.2 (2014-09-13)
462
- ------------------
463
- - Standarize package.
464
-
465
- 0.3.0 (2014-09-06)
466
- ------------------
467
- - Standarize package.
468
- - Cosmetic changes.
469
-
470
- 0.2.6 (2014-06-10)
471
- ------------------
472
- - Portable setup.py.
473
-
474
- 0.2.5 (2014-06-10)
475
- ------------------
476
- - Cosmetic changes.
477
-
478
- 0.2.3 (2012-10-13)
479
- ------------------
480
- - Initial release.
283
+ .. _Documentation: https://karpierz.github.io/annotate/
284
+ .. _Donate: https://www.paypal.com/donate/?hosted_button_id=FX8L7CJUGLW7S
@@ -23,9 +23,9 @@ Examples
23
23
  from typing import Optional, Tuple, Union, Sequence
24
24
  from annotate import annotate
25
25
 
26
- from .lib import cached
27
- from . import jni
26
+ import jni
28
27
 
28
+ from .lib import cached
29
29
  from .jobjectbase import JObjectBase
30
30
  from .jclass import JClass
31
31
  from .jobject import JObject
@@ -171,10 +171,9 @@ Prerequisites:
171
171
 
172
172
  * https://www.python.org/
173
173
 
174
- + pip and setuptools
174
+ + pip
175
175
 
176
176
  * https://pypi.org/project/pip/
177
- * https://pypi.org/project/setuptools/
178
177
 
179
178
  To install run:
180
179
 
@@ -187,9 +186,9 @@ Development
187
186
 
188
187
  Prerequisites:
189
188
 
190
- + Development is strictly based on *tox*. To install it run::
189
+ + Development is strictly based on *nox*. To install it run::
191
190
 
192
- python -m pip install --upgrade tox
191
+ python -m pip install --upgrade nox
193
192
 
194
193
  Visit `Development page`_.
195
194
 
@@ -226,10 +225,21 @@ Authors
226
225
 
227
226
  * Adam Karpierz <adam@karpierz.net>
228
227
 
228
+ Sponsoring
229
+ ==========
230
+
231
+ | If you would like to sponsor the development of this project, your contribution
232
+ is greatly appreciated.
233
+ | As I am now retired, any support helps me dedicate more time to maintaining and
234
+ improving this work.
235
+
236
+ `Donate`_
237
+
229
238
  .. |package| replace:: annotate
230
239
  .. |package_bold| replace:: **annotate**
231
240
  .. |copyright| replace:: Copyright (c) 2012-2026 Adam Karpierz
232
- .. |respository| replace:: https://github.com/karpierz/annotate.git
241
+ .. |respository| replace:: https://github.com/karpierz/annotate
233
242
  .. _Development page: https://github.com/karpierz/annotate
234
243
  .. _PyPI record: https://pypi.org/project/annotate/
235
- .. _Documentation: https://annotate.readthedocs.io/
244
+ .. _Documentation: https://karpierz.github.io/annotate/
245
+ .. _Donate: https://www.paypal.com/donate/?hosted_button_id=FX8L7CJUGLW7S
@@ -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('/')}(/.*)?"]
@@ -10,6 +10,9 @@ Contents
10
10
  .. toctree::
11
11
  :maxdepth: 2
12
12
 
13
+ .. toctree::
14
+ :titlesonly:
15
+
13
16
  CHANGES.rst
14
17
 
15
18
  Indices and tables
@@ -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 = ["annotate"]
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])