let3 2.4.2__tar.gz → 2.4.3__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.
- {let3-2.4.2 → let3-2.4.3}/CHANGES.rst +2 -2
- {let3-2.4.2/src/let3.egg-info → let3-2.4.3}/PKG-INFO +20 -20
- {let3-2.4.2 → let3-2.4.3}/README.rst +19 -19
- {let3-2.4.2 → let3-2.4.3}/docs/conf.py +18 -1
- let3-2.4.3/noxfile.py +94 -0
- {let3-2.4.2 → let3-2.4.3}/pyproject.toml +7 -6
- {let3-2.4.2 → let3-2.4.3/src/let3.egg-info}/PKG-INFO +20 -20
- let3-2.4.2/noxfile.py +0 -157
- {let3-2.4.2 → let3-2.4.3}/LICENSE +0 -0
- {let3-2.4.2 → let3-2.4.3}/MANIFEST.in +0 -0
- {let3-2.4.2 → let3-2.4.3}/docs/CHANGES.rst +0 -0
- {let3-2.4.2 → let3-2.4.3}/docs/README.rst +0 -0
- {let3-2.4.2 → let3-2.4.3}/docs/_static/.keep +0 -0
- {let3-2.4.2 → let3-2.4.3}/docs/_templates/.keep +0 -0
- {let3-2.4.2 → let3-2.4.3}/docs/index.rst +0 -0
- {let3-2.4.2 → let3-2.4.3}/setup.cfg +0 -0
- {let3-2.4.2 → let3-2.4.3}/src/let/__about__.py +0 -0
- {let3-2.4.2 → let3-2.4.3}/src/let/__init__.py +0 -0
- {let3-2.4.2 → let3-2.4.3}/src/let/_let.py +0 -0
- {let3-2.4.2 → let3-2.4.3}/src/let/py.typed +0 -0
- {let3-2.4.2 → let3-2.4.3}/src/let3.egg-info/SOURCES.txt +0 -0
- {let3-2.4.2 → let3-2.4.3}/src/let3.egg-info/dependency_links.txt +0 -0
- {let3-2.4.2 → let3-2.4.3}/src/let3.egg-info/requires.txt +0 -0
- {let3-2.4.2 → let3-2.4.3}/src/let3.egg-info/top_level.txt +0 -0
- {let3-2.4.2 → let3-2.4.3}/src/let3.egg-info/zip-safe +0 -0
- {let3-2.4.2 → let3-2.4.3}/tests/__init__.py +0 -0
- {let3-2.4.2 → let3-2.4.3}/tests/__main__.py +0 -0
- {let3-2.4.2 → let3-2.4.3}/tests/data/.keep +0 -0
- {let3-2.4.2 → let3-2.4.3}/tests/test_main.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
-
2.4.
|
|
4
|
+
2.4.3 (2026-06-01)
|
|
5
5
|
------------------
|
|
6
6
|
- Added support for GraalPy 3.12
|
|
7
7
|
- Full support for Python 3.15
|
|
8
8
|
- Dropped support for Python 3.10 (due to compatibility issues).
|
|
9
9
|
- Fix for nox 'lint' session.
|
|
10
|
-
- Setup
|
|
10
|
+
- Setup updates, fixes and improvements.
|
|
11
11
|
|
|
12
12
|
2.3.0 (2026-03-30)
|
|
13
13
|
------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: let3
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.3
|
|
4
4
|
Summary: Assign variables wherever, whenever you want.
|
|
5
5
|
Author-email: Adam Karpierz <adam@karpierz.net>, Taylor Marks <taylor@marksfam.com>
|
|
6
6
|
Maintainer-email: Adam Karpierz <adam@karpierz.net>
|
|
@@ -60,12 +60,12 @@ Quick Start
|
|
|
60
60
|
-----------
|
|
61
61
|
Once you've installed, you can really quickly verified that it works with just this:
|
|
62
62
|
|
|
63
|
-
.. code
|
|
63
|
+
.. code:: python
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
>>> from let import let
|
|
66
|
+
>>> if let(count = len("Hello World!")):
|
|
67
|
+
... print(count)
|
|
68
|
+
12
|
|
69
69
|
|
|
70
70
|
Documentation
|
|
71
71
|
-------------
|
|
@@ -76,17 +76,17 @@ both assign the value, and check whether a condition is met.
|
|
|
76
76
|
This ability doesn't exist in Python, because of the thought that when people
|
|
77
77
|
write something like:
|
|
78
78
|
|
|
79
|
-
.. code
|
|
79
|
+
.. code:: python
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
if row = db.fetch_results():
|
|
82
|
+
...
|
|
83
83
|
|
|
84
84
|
They may have actually meant:
|
|
85
85
|
|
|
86
|
-
.. code
|
|
86
|
+
.. code:: python
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
if row == db.fetch_results():
|
|
89
|
+
...
|
|
90
90
|
|
|
91
91
|
Personally, I have never made this mistake. It seems far more like a theoretical
|
|
92
92
|
mistake that could plausibly happen than one that actually happens and warrants
|
|
@@ -95,17 +95,17 @@ removing features, as was chosen in Python.
|
|
|
95
95
|
Anyways, the let function in this module gives you something very close to that
|
|
96
96
|
ability in other languages. A few examples:
|
|
97
97
|
|
|
98
|
-
.. code
|
|
98
|
+
.. code:: python
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
if let(name = longInstanceName.longAttributeName):
|
|
101
|
+
...
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
# Yes, db.fetch_results() should just return a generator. No, it doesn't.
|
|
104
|
+
while let(results = db.fetch_results()):
|
|
105
|
+
...
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
if let(count = len(nameValuePair)) != 1:
|
|
108
|
+
raise Exception(f"Bad amount: {count}")
|
|
109
109
|
|
|
110
110
|
Installation
|
|
111
111
|
============
|
|
@@ -21,12 +21,12 @@ Quick Start
|
|
|
21
21
|
-----------
|
|
22
22
|
Once you've installed, you can really quickly verified that it works with just this:
|
|
23
23
|
|
|
24
|
-
.. code
|
|
24
|
+
.. code:: python
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
>>> from let import let
|
|
27
|
+
>>> if let(count = len("Hello World!")):
|
|
28
|
+
... print(count)
|
|
29
|
+
12
|
|
30
30
|
|
|
31
31
|
Documentation
|
|
32
32
|
-------------
|
|
@@ -37,17 +37,17 @@ both assign the value, and check whether a condition is met.
|
|
|
37
37
|
This ability doesn't exist in Python, because of the thought that when people
|
|
38
38
|
write something like:
|
|
39
39
|
|
|
40
|
-
.. code
|
|
40
|
+
.. code:: python
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
if row = db.fetch_results():
|
|
43
|
+
...
|
|
44
44
|
|
|
45
45
|
They may have actually meant:
|
|
46
46
|
|
|
47
|
-
.. code
|
|
47
|
+
.. code:: python
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
if row == db.fetch_results():
|
|
50
|
+
...
|
|
51
51
|
|
|
52
52
|
Personally, I have never made this mistake. It seems far more like a theoretical
|
|
53
53
|
mistake that could plausibly happen than one that actually happens and warrants
|
|
@@ -56,17 +56,17 @@ removing features, as was chosen in Python.
|
|
|
56
56
|
Anyways, the let function in this module gives you something very close to that
|
|
57
57
|
ability in other languages. A few examples:
|
|
58
58
|
|
|
59
|
-
.. code
|
|
59
|
+
.. code:: python
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
if let(name = longInstanceName.longAttributeName):
|
|
62
|
+
...
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
# Yes, db.fetch_results() should just return a generator. No, it doesn't.
|
|
65
|
+
while let(results = db.fetch_results()):
|
|
66
|
+
...
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
if let(count = len(nameValuePair)) != 1:
|
|
69
|
+
raise Exception(f"Bad amount: {count}")
|
|
70
70
|
|
|
71
71
|
Installation
|
|
72
72
|
============
|
|
@@ -44,22 +44,29 @@ needs_sphinx = '8.1.3'
|
|
|
44
44
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
|
45
45
|
# ones.
|
|
46
46
|
extensions = [
|
|
47
|
+
'myst_parser',
|
|
47
48
|
'sphinx.ext.autodoc',
|
|
48
49
|
'sphinx.ext.autosummary',
|
|
49
50
|
'sphinx.ext.doctest',
|
|
50
51
|
'sphinx.ext.intersphinx',
|
|
51
52
|
#'sphinx.ext.todo',
|
|
52
53
|
#'sphinx.ext.coverage',
|
|
54
|
+
'sphinx.ext.viewcode',
|
|
53
55
|
'sphinx.ext.ifconfig',
|
|
54
56
|
'sphinx.ext.napoleon',
|
|
55
57
|
'sphinx_autodoc_typehints',
|
|
56
|
-
#'sphinx_toolbox',
|
|
57
58
|
'sphinx_tabs.tabs',
|
|
59
|
+
'sphinx-prompt',
|
|
58
60
|
'sphinx_copybutton',
|
|
59
61
|
'sphinxcontrib.spelling',
|
|
60
62
|
'nbsphinx',
|
|
61
63
|
]
|
|
62
64
|
|
|
65
|
+
source_suffix = {
|
|
66
|
+
'.rst': 'restructuredtext',
|
|
67
|
+
'.md': 'markdown',
|
|
68
|
+
}
|
|
69
|
+
|
|
63
70
|
# Needed for e.g. linkcheck builder
|
|
64
71
|
tls_verify = False
|
|
65
72
|
|
|
@@ -97,6 +104,16 @@ html_static_path = ['_static']
|
|
|
97
104
|
|
|
98
105
|
# -- Extension configuration -------------------------------------------------
|
|
99
106
|
|
|
107
|
+
# -- Options for MyST extension ----------------------------------------------
|
|
108
|
+
|
|
109
|
+
myst_enable_extensions = [
|
|
110
|
+
'colon_fence', # ```{note} ... ```
|
|
111
|
+
'deflist', # definitions list
|
|
112
|
+
'fieldlist', # fields as in reST
|
|
113
|
+
'html_admonition', # :::note
|
|
114
|
+
'html_image', # 
|
|
115
|
+
]
|
|
116
|
+
|
|
100
117
|
# -- Options for autodoc extension -------------------------------------------
|
|
101
118
|
|
|
102
119
|
autoclass_content = 'both'
|
let3-2.4.3/noxfile.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Copyright (c) 2026 Adam Karpierz
|
|
2
|
+
# SPDX-License-Identifier: Zlib
|
|
3
|
+
|
|
4
|
+
# /// script
|
|
5
|
+
# dependencies = ["nox>=2026.4.10", "nox_ext", "nox_lib"]
|
|
6
|
+
# ///
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any
|
|
11
|
+
import sys
|
|
12
|
+
import os
|
|
13
|
+
import shutil
|
|
14
|
+
import subprocess
|
|
15
|
+
import warnings
|
|
16
|
+
|
|
17
|
+
import nox
|
|
18
|
+
import nox_ext
|
|
19
|
+
import nox_lib
|
|
20
|
+
from nox_ext import print, pprint
|
|
21
|
+
from nox_lib.util import Path, copytree, rmtree
|
|
22
|
+
|
|
23
|
+
env = os.environ
|
|
24
|
+
|
|
25
|
+
# Configuration
|
|
26
|
+
|
|
27
|
+
PKG = nox.get_package_data()
|
|
28
|
+
|
|
29
|
+
PYPROJECT = nox.project.load_toml("pyproject.toml")
|
|
30
|
+
PY_VERSIONS = nox.project.python_versions(PYPROJECT)
|
|
31
|
+
PY_DEFAULT = "3.13"
|
|
32
|
+
|
|
33
|
+
# Prevent Python from writing bytecode
|
|
34
|
+
env["PYTHONDONTWRITEBYTECODE"] = "1"
|
|
35
|
+
# env["PKG_INITIAL_BUILD"] = "1"
|
|
36
|
+
|
|
37
|
+
# Sessions
|
|
38
|
+
|
|
39
|
+
@nox.session(python=[PY_DEFAULT], default=False,
|
|
40
|
+
requires=["cleanup"])
|
|
41
|
+
def prepare(session: nox.Session) -> None:
|
|
42
|
+
"""Preparing the repository"""
|
|
43
|
+
nox_lib.prepare.prep_cmd(session)
|
|
44
|
+
|
|
45
|
+
@nox.session(python=[PY_DEFAULT], default=False)
|
|
46
|
+
def cleanup(session: nox.Session) -> None:
|
|
47
|
+
"""Cleaning the repository"""
|
|
48
|
+
nox_lib.cleanup.clean_cmd(session)
|
|
49
|
+
nox_lib.cleanup.cleanup(session)
|
|
50
|
+
|
|
51
|
+
@nox.session(python=[*PY_VERSIONS, "pypy3.11", "graalpy3.12"])
|
|
52
|
+
def tests(session: nox.Session) -> None:
|
|
53
|
+
"""Running tests"""
|
|
54
|
+
session.install(".", "--group=test")
|
|
55
|
+
nox_lib.tests.unittests(session)
|
|
56
|
+
|
|
57
|
+
@nox.session(python=[PY_DEFAULT])
|
|
58
|
+
def coverage(session: nox.Session) -> None:
|
|
59
|
+
"""Running code coverage analysis"""
|
|
60
|
+
session.install(".", "--group=coverage")
|
|
61
|
+
nox_lib.coverage.coverage(session)
|
|
62
|
+
|
|
63
|
+
@nox.session(python=[PY_DEFAULT])
|
|
64
|
+
def docs(session: nox.Session) -> None:
|
|
65
|
+
"""Building documentation and running doc tests"""
|
|
66
|
+
session.install(".", "--group=docs")
|
|
67
|
+
nox_lib.docs.sphinx(session)
|
|
68
|
+
|
|
69
|
+
@nox.session(python=[PY_DEFAULT], default=False,
|
|
70
|
+
requires=["tests", "docs"])
|
|
71
|
+
def build(session: nox.Session) -> None:
|
|
72
|
+
"""Building the package"""
|
|
73
|
+
session.install("--group=build")
|
|
74
|
+
nox_lib.build.build(session)
|
|
75
|
+
|
|
76
|
+
@nox.session(python=[PY_DEFAULT], default=False,
|
|
77
|
+
requires=["build"])
|
|
78
|
+
def publish(session: nox.Session) -> None:
|
|
79
|
+
"""Publishing the package and documentation"""
|
|
80
|
+
session.install("--group=publish")
|
|
81
|
+
nox_lib.publish.on_pypi(session)
|
|
82
|
+
nox_lib.publish.docs_on_gh_pages(session)
|
|
83
|
+
|
|
84
|
+
@nox.session(python=[PY_DEFAULT])
|
|
85
|
+
def typing(session: nox.Session) -> None:
|
|
86
|
+
"""Static type checking"""
|
|
87
|
+
session.install(".", "--group=typing")
|
|
88
|
+
nox_lib.typing.mypy(session)
|
|
89
|
+
|
|
90
|
+
@nox.session(python=[PY_DEFAULT])
|
|
91
|
+
def lint(session: nox.Session) -> None:
|
|
92
|
+
"""Checking code style and quality"""
|
|
93
|
+
session.install(".", "--group=lint")
|
|
94
|
+
nox_lib.lint.flake8(session)
|
|
@@ -7,7 +7,7 @@ requires = [ "setuptools>=81.0.0", "packaging>=26.2.0" ]
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "let3"
|
|
10
|
-
version = "2.4.
|
|
10
|
+
version = "2.4.3"
|
|
11
11
|
description = "Assign variables wherever, whenever you want."
|
|
12
12
|
keywords = [ "let", "let3", "assign", "assignment", "var", "variable",
|
|
13
13
|
"conditional", "if", "while"]
|
|
@@ -59,7 +59,7 @@ dependencies = [
|
|
|
59
59
|
|
|
60
60
|
[dependency-groups]
|
|
61
61
|
base = [
|
|
62
|
-
"pip>=26.1.
|
|
62
|
+
"pip>=26.1.2; platform_python_implementation!='GraalVM'",
|
|
63
63
|
"pip>=24.3.1; platform_python_implementation=='GraalVM'",
|
|
64
64
|
"setuptools>=81.0.0",
|
|
65
65
|
]
|
|
@@ -71,18 +71,19 @@ test = [
|
|
|
71
71
|
]
|
|
72
72
|
coverage = [
|
|
73
73
|
{ include-group = "test" },
|
|
74
|
-
"coverage>=7.14.
|
|
74
|
+
"coverage>=7.14.1",
|
|
75
75
|
"covdefaults>=2.3.0",
|
|
76
|
-
"diff-cover>=10.
|
|
76
|
+
"diff-cover>=10.3.0",
|
|
77
77
|
]
|
|
78
78
|
docs = [
|
|
79
79
|
{ include-group = "base" },
|
|
80
80
|
"sphinx>=9.0.4",
|
|
81
81
|
"pygments_ansi_color>=0.3.0", # fix sphinx load error
|
|
82
82
|
"roman_numerals>=4.1.0", # -||-
|
|
83
|
+
"myst-parser>=5.1.0",
|
|
83
84
|
"sphinx-autodoc-typehints>=3.6.1",
|
|
84
|
-
"sphinx-
|
|
85
|
-
"sphinx-
|
|
85
|
+
"sphinx-tabs>=3.5.0",
|
|
86
|
+
"sphinx-prompt>=1.10.2",
|
|
86
87
|
"sphinx-copybutton>=0.5.2",
|
|
87
88
|
"sphinxcontrib-spelling>=8.0.2",
|
|
88
89
|
"sphinx-lint>=1.0.2",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: let3
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.3
|
|
4
4
|
Summary: Assign variables wherever, whenever you want.
|
|
5
5
|
Author-email: Adam Karpierz <adam@karpierz.net>, Taylor Marks <taylor@marksfam.com>
|
|
6
6
|
Maintainer-email: Adam Karpierz <adam@karpierz.net>
|
|
@@ -60,12 +60,12 @@ Quick Start
|
|
|
60
60
|
-----------
|
|
61
61
|
Once you've installed, you can really quickly verified that it works with just this:
|
|
62
62
|
|
|
63
|
-
.. code
|
|
63
|
+
.. code:: python
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
>>> from let import let
|
|
66
|
+
>>> if let(count = len("Hello World!")):
|
|
67
|
+
... print(count)
|
|
68
|
+
12
|
|
69
69
|
|
|
70
70
|
Documentation
|
|
71
71
|
-------------
|
|
@@ -76,17 +76,17 @@ both assign the value, and check whether a condition is met.
|
|
|
76
76
|
This ability doesn't exist in Python, because of the thought that when people
|
|
77
77
|
write something like:
|
|
78
78
|
|
|
79
|
-
.. code
|
|
79
|
+
.. code:: python
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
if row = db.fetch_results():
|
|
82
|
+
...
|
|
83
83
|
|
|
84
84
|
They may have actually meant:
|
|
85
85
|
|
|
86
|
-
.. code
|
|
86
|
+
.. code:: python
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
if row == db.fetch_results():
|
|
89
|
+
...
|
|
90
90
|
|
|
91
91
|
Personally, I have never made this mistake. It seems far more like a theoretical
|
|
92
92
|
mistake that could plausibly happen than one that actually happens and warrants
|
|
@@ -95,17 +95,17 @@ removing features, as was chosen in Python.
|
|
|
95
95
|
Anyways, the let function in this module gives you something very close to that
|
|
96
96
|
ability in other languages. A few examples:
|
|
97
97
|
|
|
98
|
-
.. code
|
|
98
|
+
.. code:: python
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
if let(name = longInstanceName.longAttributeName):
|
|
101
|
+
...
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
# Yes, db.fetch_results() should just return a generator. No, it doesn't.
|
|
104
|
+
while let(results = db.fetch_results()):
|
|
105
|
+
...
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
if let(count = len(nameValuePair)) != 1:
|
|
108
|
+
raise Exception(f"Bad amount: {count}")
|
|
109
109
|
|
|
110
110
|
Installation
|
|
111
111
|
============
|
let3-2.4.2/noxfile.py
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2026 Adam Karpierz
|
|
2
|
-
# SPDX-License-Identifier: Zlib
|
|
3
|
-
|
|
4
|
-
# /// script
|
|
5
|
-
# dependencies = ["nox>=2026.4.10", "nox_ext", "nox_lib"]
|
|
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
|
-
from nox_ext import print, pprint
|
|
22
|
-
|
|
23
|
-
here = Path(__file__).resolve().parent
|
|
24
|
-
env = os.environ
|
|
25
|
-
|
|
26
|
-
# Configuration
|
|
27
|
-
|
|
28
|
-
PKG = nox.get_package_data(here)
|
|
29
|
-
|
|
30
|
-
PYPROJECT = nox.project.load_toml("pyproject.toml")
|
|
31
|
-
PY_VERSIONS = nox.project.python_versions(PYPROJECT)
|
|
32
|
-
PY_DEFAULT = "3.13"
|
|
33
|
-
|
|
34
|
-
# Prevent Python from writing bytecode
|
|
35
|
-
env["PYTHONDONTWRITEBYTECODE"] = "1"
|
|
36
|
-
# env["PKG_INITIAL_BUILD"] = "1"
|
|
37
|
-
|
|
38
|
-
# Helpers & Utils
|
|
39
|
-
|
|
40
|
-
copytree = shutil.copytree
|
|
41
|
-
rmtree = partial(shutil.rmtree, ignore_errors=True)
|
|
42
|
-
|
|
43
|
-
# Sessions
|
|
44
|
-
|
|
45
|
-
@nox.session(python=[PY_DEFAULT], default=False,
|
|
46
|
-
requires=["cleanup"])
|
|
47
|
-
def prepare(session: nox.Session) -> None:
|
|
48
|
-
"""Preparing the repository"""
|
|
49
|
-
cmd = here/".aprep.cmd"
|
|
50
|
-
if cmd.is_file(): session.run(cmd, external=True)
|
|
51
|
-
|
|
52
|
-
@nox.session(python=[PY_DEFAULT], default=False)
|
|
53
|
-
def cleanup(session: nox.Session) -> None:
|
|
54
|
-
"""Cleaning the repository"""
|
|
55
|
-
# no_package = true
|
|
56
|
-
cmd = here/".clean.cmd"
|
|
57
|
-
if cmd.is_file():
|
|
58
|
-
session.run(cmd, stderr=subprocess.DEVNULL, external=True)
|
|
59
|
-
rmtree(here/"build")
|
|
60
|
-
rmtree(here/"dist")
|
|
61
|
-
for item in here.glob("src/*.egg-info"): rmtree(item)
|
|
62
|
-
for item in here.glob("**/__pycache__"): rmtree(item)
|
|
63
|
-
for item in here.glob("**/.mypy_cache"): rmtree(item)
|
|
64
|
-
rmtree(here/".tox")
|
|
65
|
-
rmtree(here/".nox")
|
|
66
|
-
|
|
67
|
-
@nox.session(python=[*PY_VERSIONS, "pypy3.11", "graalpy3.12"])
|
|
68
|
-
def tests(session: nox.Session) -> None:
|
|
69
|
-
"""Running tests"""
|
|
70
|
-
session.install(".", "--group=test")
|
|
71
|
-
session.py("--version")
|
|
72
|
-
session.py("-m", "tests", *session.posargs)
|
|
73
|
-
|
|
74
|
-
@nox.session(python=[PY_DEFAULT])
|
|
75
|
-
def coverage(session: nox.Session) -> None:
|
|
76
|
-
"""Running code coverage analysis"""
|
|
77
|
-
session.install(".", "--group=coverage")
|
|
78
|
-
env_dir = Path(session.virtualenv.location)
|
|
79
|
-
data_file = env_dir/".coverage"
|
|
80
|
-
html_dir = env_dir/".coverage_html"
|
|
81
|
-
session.py("-m", "coverage", "erase", f"--data-file={data_file}")
|
|
82
|
-
session.py("-m", "coverage", "run", f"--data-file={data_file}", "-m", "tests",
|
|
83
|
-
*session.posargs, success_codes=range(0, 256))
|
|
84
|
-
session.py("-m", "coverage", "html", f"--data-file={data_file}", f"--directory={html_dir}",
|
|
85
|
-
success_codes=range(0, 256))
|
|
86
|
-
session.py("-m", "coverage", "report", f"--data-file={data_file}")
|
|
87
|
-
|
|
88
|
-
@nox.session(python=[PY_DEFAULT])
|
|
89
|
-
def docs(session: nox.Session) -> None:
|
|
90
|
-
"""Building documentation and running doc tests"""
|
|
91
|
-
session.install(".", "--group=docs")
|
|
92
|
-
html_dir = here/"build/docs/html"
|
|
93
|
-
session.py("-m", "sphinxlint", "-i", "#arch", "-i", ".nox", "-i", ".tox",
|
|
94
|
-
"-i", "build", "-i", "dist", "-i", ".mypy_cache")
|
|
95
|
-
# session.py("-m", "sphinx.apidoc", "-f", *[session.site_packages/f"{item}/"
|
|
96
|
-
# for item in PKG.TOP_LEVELS])
|
|
97
|
-
session.py("-m", "sphinx.cmd.build", "-W", "-a", "-b", "html", "-E", here/"docs", html_dir)
|
|
98
|
-
session.py("-m", "sphinx.cmd.build", "-W", "-a", "-b", "doctest", here/"docs", html_dir)
|
|
99
|
-
session.py("-m", "sphinx.cmd.build", "-W", "-a", "-b", "linkcheck", here/"docs", html_dir)
|
|
100
|
-
|
|
101
|
-
@nox.session(python=[PY_DEFAULT], default=False,
|
|
102
|
-
requires=["tests", "docs"])
|
|
103
|
-
def build(session: nox.Session) -> None:
|
|
104
|
-
"""Building the package"""
|
|
105
|
-
session.install("--group=build")
|
|
106
|
-
session.py("-m", "check_manifest", "-v")
|
|
107
|
-
session.py("-m", "build")
|
|
108
|
-
# Verify distribution files
|
|
109
|
-
session.py("-m", "twine", "check", "dist/*")
|
|
110
|
-
|
|
111
|
-
@nox.session(python=[PY_DEFAULT], default=False,
|
|
112
|
-
requires=["build"])
|
|
113
|
-
def publish(session: nox.Session) -> None:
|
|
114
|
-
"""Publishing the package and documentation"""
|
|
115
|
-
session.install("--group=publish")
|
|
116
|
-
# Publish on PyPI
|
|
117
|
-
session.py("-m", "twine", "upload", "dist/*")
|
|
118
|
-
# Publish documentation on GitHub Pages
|
|
119
|
-
# checkout gh-pages worktree
|
|
120
|
-
env_dir = Path(session.virtualenv.location)
|
|
121
|
-
gh_pages_dir = env_dir/"gh-pages"
|
|
122
|
-
rmtree(gh_pages_dir)
|
|
123
|
-
session.git("worktree", "prune")
|
|
124
|
-
# session.git("worktree", "add", gh_pages_dir, "gh-pages")
|
|
125
|
-
session.git("worktree", "add", "-B", "gh-pages", gh_pages_dir)
|
|
126
|
-
# clean old docs
|
|
127
|
-
(gh_pages_dir/".nojekyll").touch()
|
|
128
|
-
for fpath in gh_pages_dir.iterdir():
|
|
129
|
-
if fpath.name not in (".git",".nojekyll"):
|
|
130
|
-
if fpath.is_dir():
|
|
131
|
-
rmtree(fpath)
|
|
132
|
-
else:
|
|
133
|
-
fpath.unlink(missing_ok=True)
|
|
134
|
-
# copy new docs
|
|
135
|
-
copytree(here/"build/docs/html", gh_pages_dir, dirs_exist_ok=True)
|
|
136
|
-
# commit + push
|
|
137
|
-
session.git("-C", gh_pages_dir, "add", ".")
|
|
138
|
-
session.git("-C", gh_pages_dir, "commit", "-m", "Update documentation")
|
|
139
|
-
session.git("-C", gh_pages_dir, "push", "--force", "origin", "gh-pages")
|
|
140
|
-
# remove worktree
|
|
141
|
-
session.git("worktree", "remove", "--force", gh_pages_dir)
|
|
142
|
-
rmtree(gh_pages_dir)
|
|
143
|
-
session.git("worktree", "prune")
|
|
144
|
-
|
|
145
|
-
@nox.session(python=[PY_DEFAULT])
|
|
146
|
-
def typing(session: nox.Session) -> None:
|
|
147
|
-
"""Static type checking"""
|
|
148
|
-
session.install(".", "--group=typing")
|
|
149
|
-
session.py("-m", "mypy")
|
|
150
|
-
|
|
151
|
-
@nox.session(python=[PY_DEFAULT])
|
|
152
|
-
def lint(session: nox.Session) -> None:
|
|
153
|
-
"""Checking code style and quality"""
|
|
154
|
-
session.install(".", "--group=lint")
|
|
155
|
-
env_dir = Path(session.virtualenv.location)
|
|
156
|
-
out_file = env_dir/"flake8out.txt"
|
|
157
|
-
session.py("-m", "flake8", "--output-file", out_file, here/"src/")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|