lib-cli-exit-tools 1.5.0__tar.gz → 2.0.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.
- lib_cli_exit_tools-2.0.0/.codacy/cli-config.yaml +1 -0
- lib_cli_exit_tools-2.0.0/.codacy/cli.sh +149 -0
- lib_cli_exit_tools-2.0.0/.codacy/codacy.yaml +15 -0
- lib_cli_exit_tools-2.0.0/.codacy/tools-configs/lizard.yaml +50 -0
- lib_cli_exit_tools-2.0.0/.codacy/tools-configs/trivy.yaml +10 -0
- lib_cli_exit_tools-2.0.0/.devcontainer/devcontainer.json +22 -0
- lib_cli_exit_tools-2.0.0/.devcontainer/settings.json +6 -0
- lib_cli_exit_tools-2.0.0/.env.example +11 -0
- lib_cli_exit_tools-2.0.0/.github/dependabot.yml +22 -0
- lib_cli_exit_tools-2.0.0/.github/workflows/ci.yml +162 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/.github/workflows/codeql.yml +4 -5
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/.github/workflows/release.yml +3 -3
- lib_cli_exit_tools-2.0.0/.qlty/qlty.toml +2 -0
- lib_cli_exit_tools-2.0.0/.snyk +5 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/AGENTS.md +12 -10
- lib_cli_exit_tools-2.0.0/AGENTS_README.md +176 -0
- lib_cli_exit_tools-2.0.0/CHANGELOG.md +130 -0
- lib_cli_exit_tools-2.0.0/CONTRIBUTING.md +49 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/DEVELOPMENT.md +25 -27
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/INSTALL.md +7 -29
- lib_cli_exit_tools-2.0.0/Makefile +54 -0
- lib_cli_exit_tools-1.5.0/README.md → lib_cli_exit_tools-2.0.0/PKG-INFO +297 -15
- lib_cli_exit_tools-1.5.0/PKG-INFO → lib_cli_exit_tools-2.0.0/README.md +261 -46
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/codecov.yml +0 -2
- lib_cli_exit_tools-2.0.0/docs/system-design/module_reference.md +226 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/notebooks/Quickstart.ipynb +2 -2
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/pyproject.toml +50 -17
- lib_cli_exit_tools-2.0.0/scripts/__main__.py +7 -0
- lib_cli_exit_tools-2.0.0/scripts/_utils.py +439 -0
- lib_cli_exit_tools-2.0.0/scripts/build.py +39 -0
- lib_cli_exit_tools-2.0.0/scripts/bump.py +32 -0
- lib_cli_exit_tools-2.0.0/scripts/bump_major.py +20 -0
- lib_cli_exit_tools-2.0.0/scripts/bump_minor.py +20 -0
- lib_cli_exit_tools-2.0.0/scripts/bump_patch.py +20 -0
- lib_cli_exit_tools-2.0.0/scripts/bump_version.py +80 -0
- lib_cli_exit_tools-2.0.0/scripts/clean.py +48 -0
- lib_cli_exit_tools-2.0.0/scripts/cli.py +213 -0
- lib_cli_exit_tools-2.0.0/scripts/dev.py +19 -0
- lib_cli_exit_tools-2.0.0/scripts/help.py +41 -0
- lib_cli_exit_tools-2.0.0/scripts/install.py +19 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/scripts/menu.py +36 -126
- lib_cli_exit_tools-2.0.0/scripts/push.py +70 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/scripts/release.py +15 -36
- lib_cli_exit_tools-2.0.0/scripts/run_cli.py +154 -0
- lib_cli_exit_tools-2.0.0/scripts/target_metadata.py +174 -0
- lib_cli_exit_tools-2.0.0/scripts/test.py +541 -0
- lib_cli_exit_tools-2.0.0/scripts/version_current.py +20 -0
- lib_cli_exit_tools-2.0.0/src/lib_cli_exit_tools/__init__.py +47 -0
- lib_cli_exit_tools-2.0.0/src/lib_cli_exit_tools/__init__conf__.py +220 -0
- lib_cli_exit_tools-2.0.0/src/lib_cli_exit_tools/__main__.py +13 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/src/lib_cli_exit_tools/adapters/signals.py +72 -71
- lib_cli_exit_tools-2.0.0/src/lib_cli_exit_tools/application/runner.py +674 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/src/lib_cli_exit_tools/cli.py +75 -48
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/src/lib_cli_exit_tools/core/configuration.py +68 -3
- lib_cli_exit_tools-2.0.0/src/lib_cli_exit_tools/core/exit_codes.py +403 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/src/lib_cli_exit_tools/lib_cli_exit_tools.py +9 -1
- lib_cli_exit_tools-2.0.0/tests/conftest.py +57 -0
- lib_cli_exit_tools-2.0.0/tests/test_adapters_signals.py +65 -0
- lib_cli_exit_tools-2.0.0/tests/test_application_runner.py +385 -0
- lib_cli_exit_tools-2.0.0/tests/test_behaviors.py +99 -0
- lib_cli_exit_tools-2.0.0/tests/test_cli.py +152 -0
- lib_cli_exit_tools-2.0.0/tests/test_core_configuration.py +47 -0
- lib_cli_exit_tools-2.0.0/tests/test_core_exit_codes.py +265 -0
- lib_cli_exit_tools-2.0.0/tests/test_metadata.py +101 -0
- lib_cli_exit_tools-2.0.0/tests/test_module_entry.py +137 -0
- lib_cli_exit_tools-2.0.0/tests/test_scripts.py +233 -0
- lib_cli_exit_tools-2.0.0/tests/test_signals_integration.py +122 -0
- lib_cli_exit_tools-1.5.0/.env.example +0 -18
- lib_cli_exit_tools-1.5.0/.github/workflows/ci.yml +0 -220
- lib_cli_exit_tools-1.5.0/CHANGELOG.md +0 -93
- lib_cli_exit_tools-1.5.0/CONTRIBUTING.md +0 -52
- lib_cli_exit_tools-1.5.0/Makefile +0 -98
- lib_cli_exit_tools-1.5.0/docs/system-design/module_reference.md +0 -246
- lib_cli_exit_tools-1.5.0/notebooks/Quickstart.ipynb.Backup +0 -281
- lib_cli_exit_tools-1.5.0/packaging/README.md +0 -68
- lib_cli_exit_tools-1.5.0/packaging/brew/Formula/lib-cli-exit-tools.rb +0 -31
- lib_cli_exit_tools-1.5.0/packaging/conda/recipe/meta.yaml +0 -46
- lib_cli_exit_tools-1.5.0/packaging/nix/flake.nix +0 -74
- lib_cli_exit_tools-1.5.0/qlty.toml +0 -2
- lib_cli_exit_tools-1.5.0/scripts/_utils.py +0 -386
- lib_cli_exit_tools-1.5.0/scripts/build.py +0 -66
- lib_cli_exit_tools-1.5.0/scripts/bump.py +0 -27
- lib_cli_exit_tools-1.5.0/scripts/bump_major.py +0 -17
- lib_cli_exit_tools-1.5.0/scripts/bump_minor.py +0 -17
- lib_cli_exit_tools-1.5.0/scripts/bump_patch.py +0 -17
- lib_cli_exit_tools-1.5.0/scripts/bump_version.py +0 -553
- lib_cli_exit_tools-1.5.0/scripts/clean.py +0 -47
- lib_cli_exit_tools-1.5.0/scripts/dev.py +0 -18
- lib_cli_exit_tools-1.5.0/scripts/generate_nix_flake.py +0 -191
- lib_cli_exit_tools-1.5.0/scripts/install.py +0 -19
- lib_cli_exit_tools-1.5.0/scripts/push.py +0 -62
- lib_cli_exit_tools-1.5.0/scripts/run_cli.py +0 -26
- lib_cli_exit_tools-1.5.0/scripts/test.py +0 -360
- lib_cli_exit_tools-1.5.0/scripts/version_current.py +0 -22
- lib_cli_exit_tools-1.5.0/src/lib_cli_exit_tools/__init__.py +0 -48
- lib_cli_exit_tools-1.5.0/src/lib_cli_exit_tools/__init__conf__.py +0 -230
- lib_cli_exit_tools-1.5.0/src/lib_cli_exit_tools/__main__.py +0 -11
- lib_cli_exit_tools-1.5.0/src/lib_cli_exit_tools/application/runner.py +0 -324
- lib_cli_exit_tools-1.5.0/src/lib_cli_exit_tools/core/exit_codes.py +0 -149
- lib_cli_exit_tools-1.5.0/tests/adapters/test_signals.py +0 -75
- lib_cli_exit_tools-1.5.0/tests/application/test_runner.py +0 -247
- lib_cli_exit_tools-1.5.0/tests/cli/test_cli_entrypoints.py +0 -118
- lib_cli_exit_tools-1.5.0/tests/conftest.py +0 -36
- lib_cli_exit_tools-1.5.0/tests/core/test_exit_codes.py +0 -151
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/.gitignore +0 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/LICENSE +0 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/scripts/__init__.py +0 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/src/lib_cli_exit_tools/adapters/__init__.py +0 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/src/lib_cli_exit_tools/application/__init__.py +0 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/src/lib_cli_exit_tools/core/__init__.py +0 -0
- {lib_cli_exit_tools-1.5.0 → lib_cli_exit_tools-2.0.0}/src/lib_cli_exit_tools/py.typed +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mode: local
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
set -e +o pipefail
|
|
5
|
+
|
|
6
|
+
# Set up paths first
|
|
7
|
+
bin_name="codacy-cli-v2"
|
|
8
|
+
|
|
9
|
+
# Determine OS-specific paths
|
|
10
|
+
os_name=$(uname)
|
|
11
|
+
arch=$(uname -m)
|
|
12
|
+
|
|
13
|
+
case "$arch" in
|
|
14
|
+
"x86_64")
|
|
15
|
+
arch="amd64"
|
|
16
|
+
;;
|
|
17
|
+
"x86")
|
|
18
|
+
arch="386"
|
|
19
|
+
;;
|
|
20
|
+
"aarch64"|"arm64")
|
|
21
|
+
arch="arm64"
|
|
22
|
+
;;
|
|
23
|
+
esac
|
|
24
|
+
|
|
25
|
+
if [ -z "$CODACY_CLI_V2_TMP_FOLDER" ]; then
|
|
26
|
+
if [ "$(uname)" = "Linux" ]; then
|
|
27
|
+
CODACY_CLI_V2_TMP_FOLDER="$HOME/.cache/codacy/codacy-cli-v2"
|
|
28
|
+
elif [ "$(uname)" = "Darwin" ]; then
|
|
29
|
+
CODACY_CLI_V2_TMP_FOLDER="$HOME/Library/Caches/Codacy/codacy-cli-v2"
|
|
30
|
+
else
|
|
31
|
+
CODACY_CLI_V2_TMP_FOLDER=".codacy-cli-v2"
|
|
32
|
+
fi
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
version_file="$CODACY_CLI_V2_TMP_FOLDER/version.yaml"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
get_version_from_yaml() {
|
|
39
|
+
if [ -f "$version_file" ]; then
|
|
40
|
+
local version=$(grep -o 'version: *"[^"]*"' "$version_file" | cut -d'"' -f2)
|
|
41
|
+
if [ -n "$version" ]; then
|
|
42
|
+
echo "$version"
|
|
43
|
+
return 0
|
|
44
|
+
fi
|
|
45
|
+
fi
|
|
46
|
+
return 1
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get_latest_version() {
|
|
50
|
+
local response
|
|
51
|
+
if [ -n "$GH_TOKEN" ]; then
|
|
52
|
+
response=$(curl -Lq --header "Authorization: Bearer $GH_TOKEN" "https://api.github.com/repos/codacy/codacy-cli-v2/releases/latest" 2>/dev/null)
|
|
53
|
+
else
|
|
54
|
+
response=$(curl -Lq "https://api.github.com/repos/codacy/codacy-cli-v2/releases/latest" 2>/dev/null)
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
handle_rate_limit "$response"
|
|
58
|
+
local version=$(echo "$response" | grep -m 1 tag_name | cut -d'"' -f4)
|
|
59
|
+
echo "$version"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
handle_rate_limit() {
|
|
63
|
+
local response="$1"
|
|
64
|
+
if echo "$response" | grep -q "API rate limit exceeded"; then
|
|
65
|
+
fatal "Error: GitHub API rate limit exceeded. Please try again later"
|
|
66
|
+
fi
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
download_file() {
|
|
70
|
+
local url="$1"
|
|
71
|
+
|
|
72
|
+
echo "Downloading from URL: ${url}"
|
|
73
|
+
if command -v curl > /dev/null 2>&1; then
|
|
74
|
+
curl -# -LS "$url" -O
|
|
75
|
+
elif command -v wget > /dev/null 2>&1; then
|
|
76
|
+
wget "$url"
|
|
77
|
+
else
|
|
78
|
+
fatal "Error: Could not find curl or wget, please install one."
|
|
79
|
+
fi
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
download() {
|
|
83
|
+
local url="$1"
|
|
84
|
+
local output_folder="$2"
|
|
85
|
+
|
|
86
|
+
( cd "$output_folder" && download_file "$url" )
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
download_cli() {
|
|
90
|
+
# OS name lower case
|
|
91
|
+
suffix=$(echo "$os_name" | tr '[:upper:]' '[:lower:]')
|
|
92
|
+
|
|
93
|
+
local bin_folder="$1"
|
|
94
|
+
local bin_path="$2"
|
|
95
|
+
local version="$3"
|
|
96
|
+
|
|
97
|
+
if [ ! -f "$bin_path" ]; then
|
|
98
|
+
echo "📥 Downloading CLI version $version..."
|
|
99
|
+
|
|
100
|
+
remote_file="codacy-cli-v2_${version}_${suffix}_${arch}.tar.gz"
|
|
101
|
+
url="https://github.com/codacy/codacy-cli-v2/releases/download/${version}/${remote_file}"
|
|
102
|
+
|
|
103
|
+
download "$url" "$bin_folder"
|
|
104
|
+
tar xzfv "${bin_folder}/${remote_file}" -C "${bin_folder}"
|
|
105
|
+
fi
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
# Warn if CODACY_CLI_V2_VERSION is set and update is requested
|
|
109
|
+
if [ -n "$CODACY_CLI_V2_VERSION" ] && [ "$1" = "update" ]; then
|
|
110
|
+
echo "⚠️ Warning: Performing update with forced version $CODACY_CLI_V2_VERSION"
|
|
111
|
+
echo " Unset CODACY_CLI_V2_VERSION to use the latest version"
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
# Ensure version.yaml exists and is up to date
|
|
115
|
+
if [ ! -f "$version_file" ] || [ "$1" = "update" ]; then
|
|
116
|
+
echo "ℹ️ Fetching latest version..."
|
|
117
|
+
version=$(get_latest_version)
|
|
118
|
+
mkdir -p "$CODACY_CLI_V2_TMP_FOLDER"
|
|
119
|
+
echo "version: \"$version\"" > "$version_file"
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# Set the version to use
|
|
123
|
+
if [ -n "$CODACY_CLI_V2_VERSION" ]; then
|
|
124
|
+
version="$CODACY_CLI_V2_VERSION"
|
|
125
|
+
else
|
|
126
|
+
version=$(get_version_from_yaml)
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# Set up version-specific paths
|
|
131
|
+
bin_folder="${CODACY_CLI_V2_TMP_FOLDER}/${version}"
|
|
132
|
+
|
|
133
|
+
mkdir -p "$bin_folder"
|
|
134
|
+
bin_path="$bin_folder"/"$bin_name"
|
|
135
|
+
|
|
136
|
+
# Download the tool if not already installed
|
|
137
|
+
download_cli "$bin_folder" "$bin_path" "$version"
|
|
138
|
+
chmod +x "$bin_path"
|
|
139
|
+
|
|
140
|
+
run_command="$bin_path"
|
|
141
|
+
if [ -z "$run_command" ]; then
|
|
142
|
+
fatal "Codacy cli v2 binary could not be found."
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
if [ "$#" -eq 1 ] && [ "$1" = "download" ]; then
|
|
146
|
+
echo "Codacy cli v2 download succeeded"
|
|
147
|
+
else
|
|
148
|
+
eval "$run_command $*"
|
|
149
|
+
fi
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
patterns:
|
|
2
|
+
Lizard_ccn-medium:
|
|
3
|
+
category: Complexity
|
|
4
|
+
description: Checks if the cyclomatic complexity of a function or logic block exceeds the medium threshold (default is 8).
|
|
5
|
+
explanation: |-
|
|
6
|
+
# Medium Cyclomatic Complexity control
|
|
7
|
+
|
|
8
|
+
Check the Cyclomatic Complexity value of a function or logic block. If the threshold is not met, raise a Medium issue. The default threshold is 7.
|
|
9
|
+
id: Lizard_ccn-medium
|
|
10
|
+
level: Warning
|
|
11
|
+
severityLevel: Warning
|
|
12
|
+
threshold: 8
|
|
13
|
+
timeToFix: 10
|
|
14
|
+
title: Enforce Medium Cyclomatic Complexity Threshold
|
|
15
|
+
Lizard_file-nloc-medium:
|
|
16
|
+
category: Complexity
|
|
17
|
+
description: This rule checks if the number of lines of code (excluding comments) in a file exceeds a medium threshold, typically 500 lines.
|
|
18
|
+
explanation: ""
|
|
19
|
+
id: Lizard_file-nloc-medium
|
|
20
|
+
level: Warning
|
|
21
|
+
severityLevel: Warning
|
|
22
|
+
threshold: 500
|
|
23
|
+
timeToFix: 10
|
|
24
|
+
title: Enforce Medium File Length Limit Based on Number of Lines of Code
|
|
25
|
+
Lizard_nloc-medium:
|
|
26
|
+
category: Complexity
|
|
27
|
+
description: Checks if the number of lines of code (excluding comments) in a function exceeds a medium threshold (default 50 lines).
|
|
28
|
+
explanation: |-
|
|
29
|
+
# Medium NLOC control - Number of Lines of Code (without comments)
|
|
30
|
+
|
|
31
|
+
Check the number of lines of code (without comments) in a function. If the threshold is not met, raise a Medium issue. The default threshold is 50.
|
|
32
|
+
id: Lizard_nloc-medium
|
|
33
|
+
level: Warning
|
|
34
|
+
severityLevel: Warning
|
|
35
|
+
threshold: 50
|
|
36
|
+
timeToFix: 10
|
|
37
|
+
title: Enforce Medium Number of Lines of Code (NLOC) Limit
|
|
38
|
+
Lizard_parameter-count-medium:
|
|
39
|
+
category: Complexity
|
|
40
|
+
description: This rule checks the number of parameters passed to a function and raises an issue if it exceeds a medium threshold, which by default is 8 parameters.
|
|
41
|
+
explanation: |-
|
|
42
|
+
# Medium Parameter count control
|
|
43
|
+
|
|
44
|
+
Check the number of parameters sent to a function. If the threshold is not met, raise a Medium issue. The default threshold is 5.
|
|
45
|
+
id: Lizard_parameter-count-medium
|
|
46
|
+
level: Warning
|
|
47
|
+
severityLevel: Warning
|
|
48
|
+
threshold: 8
|
|
49
|
+
timeToFix: 10
|
|
50
|
+
title: Enforce Medium Parameter Count Limit
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"image": "mcr.microsoft.com/devcontainers/python:3.13",
|
|
3
|
+
|
|
4
|
+
"postCreateCommand": "bash -lc '\nPY=/usr/local/bin/python;\n$PY -m pip install -U pip && \\\n$PY -m pip install ipykernel && \\\n$PY -m pip install -e . && \\\n# register kernel using this exact interpreter\n$PY -m ipykernel install --name=python3 --display-name=\"Python 3 (3.13)\" --user && \\\n# patch the notebook to point to the python3 kernelspec (VS Code will bind to /usr/local/bin/python)\n$PY - <<\"PY\"\nimport json, pathlib\np = pathlib.Path(\"notebooks/Quickstart.ipynb\")\nif p.exists():\n nb = json.loads(p.read_text(encoding=\"utf-8\"))\n md = nb.setdefault(\"metadata\", {})\n md[\"kernelspec\"] = {\n \"name\": \"python3\",\n \"display_name\": \"Python 3 (3.13)\",\n \"language\": \"python\"\n }\n md[\"language_info\"] = {\"name\": \"python\"}\n p.write_text(json.dumps(nb, ensure_ascii=False, indent=1), encoding=\"utf-8\")\n print(\"Pinned kernelspec to python3 in\", p)\nelse:\n print(\"Notebook not found:\", p)\nPY'\n",
|
|
5
|
+
|
|
6
|
+
"customizations": {
|
|
7
|
+
"vscode": {
|
|
8
|
+
"extensions": ["ms-toolsai.jupyter", "ms-python.python"],
|
|
9
|
+
"settings": {
|
|
10
|
+
"workbench.startupEditor": "none",
|
|
11
|
+
"jupyter.alwaysTrustNotebooks": true,
|
|
12
|
+
"jupyter.kernelPickerType": "OnlyRecommended",
|
|
13
|
+
"python.defaultInterpreterPath": "/usr/local/bin/python"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"codespaces": {
|
|
17
|
+
"openFiles": ["README.md"]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
"postAttachCommand": "bash -lc 'if [ -f notebooks/Quickstart.ipynb ]; then code -r notebooks/Quickstart.ipynb; fi'"
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Copy to .env and fill values as needed.
|
|
2
|
+
|
|
3
|
+
# Codecov upload token (required for private repos; optional for public repos)
|
|
4
|
+
CODECOV_TOKEN=
|
|
5
|
+
|
|
6
|
+
# PyPI API token for release workflow (.github/workflows/release.yml)
|
|
7
|
+
# Format: pypi-AgENdGVzdC5weXBpLm9yZwIk...
|
|
8
|
+
PYPI_API_TOKEN=
|
|
9
|
+
|
|
10
|
+
# Optional: GitHub token for API-limited tasks (e.g., higher rate limits on dependency audits)
|
|
11
|
+
GITHUB_TOKEN=
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "pip"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "weekly"
|
|
7
|
+
allow:
|
|
8
|
+
- dependency-type: "direct"
|
|
9
|
+
labels:
|
|
10
|
+
- "dependencies"
|
|
11
|
+
commit-message:
|
|
12
|
+
prefix: "deps"
|
|
13
|
+
include: "scope"
|
|
14
|
+
- package-ecosystem: "github-actions"
|
|
15
|
+
directory: "/"
|
|
16
|
+
schedule:
|
|
17
|
+
interval: "weekly"
|
|
18
|
+
labels:
|
|
19
|
+
- "dependencies"
|
|
20
|
+
commit-message:
|
|
21
|
+
prefix: "deps"
|
|
22
|
+
include: "scope"
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, master ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main, master ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Tests (Python ${{ matrix.python }}, ${{ matrix.os }})
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
17
|
+
# Test against Python 3.13 and the latest 3.x available on Actions runners
|
|
18
|
+
python: ["3.13", "3.x"]
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v5
|
|
21
|
+
- uses: actions/setup-python@v6
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python }}
|
|
24
|
+
- name: Extract project metadata
|
|
25
|
+
shell: python
|
|
26
|
+
run: |
|
|
27
|
+
import os
|
|
28
|
+
import tomllib
|
|
29
|
+
from pathlib import Path
|
|
30
|
+
|
|
31
|
+
data = tomllib.loads(Path('pyproject.toml').read_text('utf-8'))
|
|
32
|
+
project = data['project']['name']
|
|
33
|
+
module = project.replace('-', '_')
|
|
34
|
+
dash = project.replace('_', '-')
|
|
35
|
+
scripts = list(data['project'].get('scripts', {}).keys())
|
|
36
|
+
cli_bin = scripts[0] if scripts else dash
|
|
37
|
+
|
|
38
|
+
with open(os.environ['GITHUB_ENV'], 'a', encoding='utf-8') as env:
|
|
39
|
+
env.write(f"PROJECT_NAME={project}\n")
|
|
40
|
+
env.write(f"PACKAGE_MODULE={module}\n")
|
|
41
|
+
env.write(f"CLI_BIN={cli_bin}\n")
|
|
42
|
+
- name: Install make on Windows
|
|
43
|
+
if: runner.os == 'Windows'
|
|
44
|
+
shell: pwsh
|
|
45
|
+
run: |
|
|
46
|
+
choco install -y make
|
|
47
|
+
echo "C:\\ProgramData\\chocolatey\\bin" >> $env:GITHUB_PATH
|
|
48
|
+
- name: Upgrade pip
|
|
49
|
+
shell: bash
|
|
50
|
+
run: python -m pip install --upgrade pip
|
|
51
|
+
|
|
52
|
+
- name: Install dev deps
|
|
53
|
+
shell: bash
|
|
54
|
+
run: |
|
|
55
|
+
pip install -e .[dev]
|
|
56
|
+
|
|
57
|
+
- name: Install Windows Event Log prerequisites
|
|
58
|
+
if: runner.os == 'Windows'
|
|
59
|
+
shell: bash
|
|
60
|
+
run: |
|
|
61
|
+
pip install pywin32
|
|
62
|
+
- name: Run full test suite (lint, types, tests, coverage, codecov)
|
|
63
|
+
shell: bash
|
|
64
|
+
env:
|
|
65
|
+
TEST_VERBOSE: "1"
|
|
66
|
+
run: make test
|
|
67
|
+
- name: Build wheel/sdist
|
|
68
|
+
shell: bash
|
|
69
|
+
run: python -m build
|
|
70
|
+
- name: Verify wheel install in clean env
|
|
71
|
+
shell: bash
|
|
72
|
+
run: |
|
|
73
|
+
python -m venv .venv_wheel
|
|
74
|
+
. .venv_wheel/bin/activate 2>/dev/null || . .venv_wheel/Scripts/activate 2>/dev/null
|
|
75
|
+
pip install dist/*.whl
|
|
76
|
+
"$CLI_BIN" --version 2>/dev/null || python -m "$PACKAGE_MODULE" --version
|
|
77
|
+
|
|
78
|
+
pipx-uv:
|
|
79
|
+
name: pipx/uv verification (ubuntu)
|
|
80
|
+
runs-on: ubuntu-latest
|
|
81
|
+
steps:
|
|
82
|
+
- uses: actions/checkout@v5
|
|
83
|
+
- uses: actions/setup-python@v6
|
|
84
|
+
with:
|
|
85
|
+
python-version: "3.13"
|
|
86
|
+
- name: Extract project metadata
|
|
87
|
+
shell: python
|
|
88
|
+
run: |
|
|
89
|
+
import os
|
|
90
|
+
import tomllib
|
|
91
|
+
from pathlib import Path
|
|
92
|
+
|
|
93
|
+
data = tomllib.loads(Path('pyproject.toml').read_text('utf-8'))
|
|
94
|
+
project = data['project']['name']
|
|
95
|
+
module = project.replace('-', '_')
|
|
96
|
+
dash = project.replace('_', '-')
|
|
97
|
+
scripts = list(data['project'].get('scripts', {}).keys())
|
|
98
|
+
cli_bin = scripts[0] if scripts else dash
|
|
99
|
+
|
|
100
|
+
with open(os.environ['GITHUB_ENV'], 'a', encoding='utf-8') as env:
|
|
101
|
+
env.write(f"PROJECT_NAME={project}\n")
|
|
102
|
+
env.write(f"PACKAGE_MODULE={module}\n")
|
|
103
|
+
env.write(f"CLI_BIN={cli_bin}\n")
|
|
104
|
+
- name: Build wheel
|
|
105
|
+
run: |
|
|
106
|
+
python -m pip install --upgrade pip build
|
|
107
|
+
python -m build
|
|
108
|
+
- name: pipx install from wheel
|
|
109
|
+
run: |
|
|
110
|
+
python -m pip install pipx
|
|
111
|
+
pipx install dist/*.whl
|
|
112
|
+
"$CLI_BIN" --version 2>/dev/null || python -m "$PACKAGE_MODULE" --version
|
|
113
|
+
- name: Install uv
|
|
114
|
+
uses: astral-sh/setup-uv@v7
|
|
115
|
+
with:
|
|
116
|
+
enable-cache: true
|
|
117
|
+
- name: uv tool install
|
|
118
|
+
run: |
|
|
119
|
+
uv tool install .
|
|
120
|
+
"$CLI_BIN" --version 2>/dev/null || python -m "$PACKAGE_MODULE" --version
|
|
121
|
+
|
|
122
|
+
notebooks:
|
|
123
|
+
name: Execute notebooks (ubuntu, Python 3.13)
|
|
124
|
+
runs-on: ubuntu-latest
|
|
125
|
+
steps:
|
|
126
|
+
- uses: actions/checkout@v5
|
|
127
|
+
- uses: actions/setup-python@v6
|
|
128
|
+
with:
|
|
129
|
+
python-version: "3.13"
|
|
130
|
+
- name: Install notebook runner deps
|
|
131
|
+
run: |
|
|
132
|
+
python -m pip install --upgrade pip
|
|
133
|
+
pip install nbclient nbformat ipykernel jupyter_client
|
|
134
|
+
python -m ipykernel install --user --name python3 --display-name "Python 3"
|
|
135
|
+
- name: Execute Quickstart notebook
|
|
136
|
+
env:
|
|
137
|
+
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
|
138
|
+
PIP_NO_INPUT: "1"
|
|
139
|
+
run: |
|
|
140
|
+
python - << 'PY'
|
|
141
|
+
from pathlib import Path
|
|
142
|
+
|
|
143
|
+
import nbformat
|
|
144
|
+
from nbclient import NotebookClient
|
|
145
|
+
|
|
146
|
+
nb_path = Path('notebooks/Quickstart.ipynb')
|
|
147
|
+
if not nb_path.exists():
|
|
148
|
+
raise SystemExit(f"Notebook not found: {nb_path}")
|
|
149
|
+
|
|
150
|
+
notebook = nbformat.read(nb_path, as_version=4)
|
|
151
|
+
client = NotebookClient(
|
|
152
|
+
notebook,
|
|
153
|
+
timeout=900,
|
|
154
|
+
kernel_name='python3',
|
|
155
|
+
allow_errors=False,
|
|
156
|
+
)
|
|
157
|
+
client.execute()
|
|
158
|
+
|
|
159
|
+
out_path = Path('notebooks/Quickstart-executed.ipynb')
|
|
160
|
+
nbformat.write(notebook, out_path)
|
|
161
|
+
print(f"Executed notebook written to: {out_path}")
|
|
162
|
+
PY
|
|
@@ -23,18 +23,17 @@ jobs:
|
|
|
23
23
|
|
|
24
24
|
steps:
|
|
25
25
|
- name: Checkout repository
|
|
26
|
-
uses: actions/checkout@
|
|
26
|
+
uses: actions/checkout@v5
|
|
27
27
|
|
|
28
28
|
- name: Initialize CodeQL
|
|
29
|
-
uses: github/codeql-action/init@
|
|
29
|
+
uses: github/codeql-action/init@v4
|
|
30
30
|
with:
|
|
31
31
|
languages: ${{ matrix.language }}
|
|
32
32
|
|
|
33
33
|
- name: Autobuild
|
|
34
|
-
uses: github/codeql-action/autobuild@
|
|
34
|
+
uses: github/codeql-action/autobuild@v4
|
|
35
35
|
|
|
36
36
|
- name: Perform CodeQL Analysis
|
|
37
|
-
uses: github/codeql-action/analyze@
|
|
37
|
+
uses: github/codeql-action/analyze@v4
|
|
38
38
|
with:
|
|
39
39
|
category: "/language:${{ matrix.language }}"
|
|
40
|
-
|
|
@@ -14,7 +14,7 @@ jobs:
|
|
|
14
14
|
permissions:
|
|
15
15
|
contents: read
|
|
16
16
|
steps:
|
|
17
|
-
- uses: actions/checkout@
|
|
17
|
+
- uses: actions/checkout@v5
|
|
18
18
|
- name: Verify PyPI token is set
|
|
19
19
|
run: |
|
|
20
20
|
if [ -z "${{ secrets.PYPI_API_TOKEN }}" ]; then
|
|
@@ -22,9 +22,9 @@ jobs:
|
|
|
22
22
|
echo "See: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions"
|
|
23
23
|
exit 1
|
|
24
24
|
fi
|
|
25
|
-
- uses: actions/setup-python@
|
|
25
|
+
- uses: actions/setup-python@v6
|
|
26
26
|
with:
|
|
27
|
-
python-version: '3.
|
|
27
|
+
python-version: '3.13'
|
|
28
28
|
- name: Build artifacts
|
|
29
29
|
run: |
|
|
30
30
|
python -m pip install --upgrade pip build
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## On session start
|
|
4
4
|
|
|
5
|
+
whenever You wait for user input or finished, execute "paplay /usr/share/sounds/codex/ready.wav"
|
|
6
|
+
whenever You have a question, execute "paplay /usr/share/sounds/codex/ready.wav"
|
|
7
|
+
whenever You have an error, execute "paplay /usr/share/sounds/codex/error.wav"
|
|
8
|
+
|
|
5
9
|
Review the system prompt files in `/media/srv-main/softdev/*/projects/softwarestack/systemprompts` and keep their guidance in working memory:
|
|
6
10
|
|
|
7
11
|
- core_programming_solid.md
|
|
@@ -16,6 +20,7 @@ Review the system prompt files in `/media/srv-main/softdev/*/projects/softwarest
|
|
|
16
20
|
- python_jupyter_notebooks.md
|
|
17
21
|
- python_testing.md
|
|
18
22
|
|
|
23
|
+
|
|
19
24
|
always apply those Rules :
|
|
20
25
|
|
|
21
26
|
- core_programming_solid.md
|
|
@@ -40,14 +45,13 @@ when writing or refracturing Python scripts, apply those Rules :
|
|
|
40
45
|
|
|
41
46
|
- `src/lib_cli_exit_tools/`: Python package.
|
|
42
47
|
- `scripts/`: shared automation (build/test/release) reused from scaffold.
|
|
43
|
-
- `
|
|
44
|
-
- `tests/`: placeholder suite skipping until logging features exist.
|
|
48
|
+
- `tests/`: behaviour/spec integration suite covering CLI, metadata, and automation workflows.
|
|
45
49
|
|
|
46
50
|
### Versioning & Releases
|
|
47
51
|
|
|
48
52
|
- Single source of truth for the package version is `pyproject.toml` (`[project].version`).
|
|
49
53
|
- Runtime code reads metadata via `importlib.metadata`; do not duplicate the version in code files.
|
|
50
|
-
- On a version bump, update only `pyproject.toml` and the `CHANGELOG.md` entry;
|
|
54
|
+
- On a version bump, update only `pyproject.toml` and the `CHANGELOG.md` entry; runtime code should continue to read the version via `importlib.metadata` (no separate `__init__conf__` file).
|
|
51
55
|
- Tag releases `vX.Y.Z` and push tags; CI will build artifacts and publish when configured.
|
|
52
56
|
|
|
53
57
|
### Common Make Targets (Alphabetical)
|
|
@@ -55,7 +59,7 @@ when writing or refracturing Python scripts, apply those Rules :
|
|
|
55
59
|
|
|
56
60
|
| Target | One-line description |
|
|
57
61
|
|-------------------|--------------------------------------------------------------------------------|
|
|
58
|
-
| `build` | Build wheel/sdist
|
|
62
|
+
| `build` | Build wheel/sdist; validates the Python artifacts locally. |
|
|
59
63
|
| `bump` | Bump version (VERSION=X.Y.Z or PART=major\|minor\|patch) and update changelog. |
|
|
60
64
|
| `bump-major` | Increment major version ((X+1).0.0). |
|
|
61
65
|
| `bump-minor` | Increment minor version (X.Y.Z → X.(Y+1).0). |
|
|
@@ -66,13 +70,14 @@ when writing or refracturing Python scripts, apply those Rules :
|
|
|
66
70
|
| `install` | Editable install. |
|
|
67
71
|
| `menu` | Interactive TUI menu (make menu). |
|
|
68
72
|
| `push` | Commit changes once and push to GitHub (no CI monitoring). |
|
|
69
|
-
| `release` | Tag vX.Y.Z, push,
|
|
73
|
+
| `release` | Tag vX.Y.Z, push, and run the release helper (PyPI upload when configured). |
|
|
70
74
|
| `run` | Run module entry (`python -m ... --help`). |
|
|
71
75
|
| `test` | Lint, format, type-check, run tests with coverage, upload to Codecov. |
|
|
72
76
|
| `version-current` | Print current version from `pyproject.toml`. |
|
|
73
77
|
|
|
74
78
|
|
|
75
79
|
## Coding Style & Naming Conventions
|
|
80
|
+
- apply python_clean_code.md
|
|
76
81
|
|
|
77
82
|
## Commit & Pull Request Guidelines
|
|
78
83
|
|
|
@@ -88,23 +93,20 @@ when writing or refracturing Python scripts, apply those Rules :
|
|
|
88
93
|
## Translations (App UI Strings)
|
|
89
94
|
|
|
90
95
|
## Changes in WEB Documentation
|
|
91
|
-
|
|
92
96
|
- when asked to update documentation - only do that in the english docs under /website/docs because other languages will be translated automatically,
|
|
93
97
|
unless stated otherwise by the user. In doubt - ask the user
|
|
94
98
|
|
|
95
99
|
## Changes in APP Strings
|
|
96
|
-
|
|
97
100
|
- when i18 strings are changed, only to that in sources/\_locales/en because other languages will be translated automatically,
|
|
98
101
|
unless stated otherwise by the user. In doubt - ask the user
|
|
99
102
|
|
|
100
103
|
## commit/push/GitHub policy
|
|
101
|
-
|
|
102
104
|
- run "make test" before any push to avoid lint/test breakage.
|
|
103
105
|
- after push, monitor errors in the github actions and try to correct the errors
|
|
104
106
|
|
|
105
|
-
---
|
|
107
|
+
---
|
|
106
108
|
|
|
107
|
-
# ONLY ON USER REQEST !!!! :
|
|
109
|
+
# ONLY ON USER REQEST !!!! :
|
|
108
110
|
|
|
109
111
|
# 📘 Documentation Review & Enhancement Prompt
|
|
110
112
|
|