git-repokit 0.9.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- git_repokit-0.9.10.dist-info/METADATA +422 -0
- git_repokit-0.9.10.dist-info/RECORD +174 -0
- git_repokit-0.9.10.dist-info/WHEEL +5 -0
- git_repokit-0.9.10.dist-info/entry_points.txt +2 -0
- git_repokit-0.9.10.dist-info/licenses/LICENSE +9 -0
- git_repokit-0.9.10.dist-info/top_level.txt +1 -0
- repokit/__init__.py +8 -0
- repokit/__main__.py +12 -0
- repokit/__version__.py +4 -0
- repokit/_vendor/__init__.py +0 -0
- repokit/_vendor/ailib/__init__.py +1 -0
- repokit/_vendor/ailib/analyzer.py +177 -0
- repokit/_vendor/ailib/backend.py +95 -0
- repokit/_vendor/ailib/cache.py +97 -0
- repokit/_vendor/ailib/parsers.py +52 -0
- repokit/_vendor/ailib/transports/__init__.py +16 -0
- repokit/_vendor/ailib/transports/cli.py +312 -0
- repokit/_vendor/ailib/transports/openai_compat.py +383 -0
- repokit/_vendor/ailib/transports/prompt_file.py +41 -0
- repokit/_vendor/ailib/types.py +224 -0
- repokit/auth_integration.py +244 -0
- repokit/badges.py +183 -0
- repokit/branch_utils.py +364 -0
- repokit/cli.py +2997 -0
- repokit/common_kit.py +202 -0
- repokit/config.py +686 -0
- repokit/defaults.py +220 -0
- repokit/directory_analyzer.py +1244 -0
- repokit/directory_profiles.py +423 -0
- repokit/git_config.py +370 -0
- repokit/github_create.py +142 -0
- repokit/github_setup.py +248 -0
- repokit/guardrails.py +707 -0
- repokit/history_cleaner.py +449 -0
- repokit/history_protection.py +434 -0
- repokit/hooks/pre-commit-guardrails +122 -0
- repokit/hooks/pre-commit-template +28 -0
- repokit/layers.py +510 -0
- repokit/licenses/0bsd.txt +14 -0
- repokit/licenses/LICENSES.md +27 -0
- repokit/licenses/__init__.py +142 -0
- repokit/licenses/agpl-3.0.txt +661 -0
- repokit/licenses/all-rights-reserved.txt +10 -0
- repokit/licenses/apache-2.0.txt +201 -0
- repokit/licenses/bsd-2-clause.txt +24 -0
- repokit/licenses/bsd-3-clause.txt +28 -0
- repokit/licenses/bsl-1.0.txt +23 -0
- repokit/licenses/cc-by-4.0.txt +395 -0
- repokit/licenses/cc-by-sa-4.0.txt +427 -0
- repokit/licenses/cc0-1.0.txt +121 -0
- repokit/licenses/epl-2.0.txt +277 -0
- repokit/licenses/gpl-2.0.txt +339 -0
- repokit/licenses/gpl-3.0.txt +674 -0
- repokit/licenses/isc.txt +15 -0
- repokit/licenses/lgpl-2.1.txt +504 -0
- repokit/licenses/lgpl-3.0.txt +165 -0
- repokit/licenses/mit.txt +21 -0
- repokit/licenses/mpl-2.0.txt +373 -0
- repokit/licenses/unlicense.txt +24 -0
- repokit/readme_blocks.py +112 -0
- repokit/remote_integration.py +627 -0
- repokit/repo_manager.py +2796 -0
- repokit/template_engine.py +391 -0
- repokit/templates/ai/claude/CLAUDE-nested.md.template +25 -0
- repokit/templates/ai/claude/CLAUDE.md.template +98 -0
- repokit/templates/ai/claude/instructions/step1_context_rebuilder.md +33 -0
- repokit/templates/ai/claude/instructions/step2_dev_workflow_process.md +67 -0
- repokit/templates/ai/claude/instructions/step3_context_bridge.md +52 -0
- repokit/templates/common/CHANGELOG.md.template +15 -0
- repokit/templates/common/CONTRIBUTING.md.template +31 -0
- repokit/templates/common/README.md.template +30 -0
- repokit/templates/common/gitattributes.template +17 -0
- repokit/templates/common/gitignore.template +141 -0
- repokit/templates/extras/FUNDING.yml.template +13 -0
- repokit/templates/extras/ROADMAP.md.template +17 -0
- repokit/templates/extras/dependabot.yml.template +22 -0
- repokit/templates/extras/one-offs-README.md.template +28 -0
- repokit/templates/extras/platform-support.md.template +11 -0
- repokit/templates/extras/pull_request_template.md.template +25 -0
- repokit/templates/extras/release-template.md.template +34 -0
- repokit/templates/extras/settings.json.template +11 -0
- repokit/templates/extras/stale.yml.template +14 -0
- repokit/templates/github/CODEOWNERS.template +11 -0
- repokit/templates/github/ISSUE_TEMPLATE/bug-report.md.template +29 -0
- repokit/templates/github/ISSUE_TEMPLATE/feature-request.md.template +19 -0
- repokit/templates/github/issues/notes.md.template +18 -0
- repokit/templates/github/issues/roadmap.md.template +15 -0
- repokit/templates/hooks/pre-commit.template +64 -0
- repokit/templates/layers/archetypes/any/claude-plugin/.claude-plugin/marketplace.json +20 -0
- repokit/templates/layers/archetypes/any/claude-plugin/plugin/.claude-plugin/plugin.json +15 -0
- repokit/templates/layers/archetypes/any/claude-plugin/plugin/README.md +28 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/.github/workflows/ci-c-cpp.yml +24 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/.repokit-common.toml.rkappend +4 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/.vscode/launch.json +29 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/.vscode/tasks.json +26 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/CMakeLists.txt +47 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/CMakePresets.json +23 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/cmake/GenerateStamp.cmake +45 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/src/main.cpp +27 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/tests/test_version.cpp +20 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/vcpkg.json +5 -0
- repokit/templates/layers/archetypes/c-cpp/minimal/.vscode/launch.json +27 -0
- repokit/templates/layers/archetypes/c-cpp/minimal/Makefile +10 -0
- repokit/templates/layers/archetypes/c-cpp/minimal/build.bat +7 -0
- repokit/templates/layers/archetypes/c-cpp/minimal/src/__RK_SNAKE__.c +26 -0
- repokit/templates/layers/archetypes/c-cpp/msbuild/.vscode/launch.json +17 -0
- repokit/templates/layers/archetypes/c-cpp/msbuild/.vscode/tasks.json +20 -0
- repokit/templates/layers/archetypes/c-cpp/msbuild/__RK_PROJECT__.sln +19 -0
- repokit/templates/layers/archetypes/c-cpp/msbuild/__RK_PROJECT__.vcxproj +41 -0
- repokit/templates/layers/archetypes/c-cpp/msbuild/src/main.cpp +26 -0
- repokit/templates/layers/archetypes/js-ts/claude-plugin/.repokit-common.toml +28 -0
- repokit/templates/layers/archetypes/js-ts/claude-plugin/.vscode/launch.json +34 -0
- repokit/templates/layers/archetypes/js-ts/claude-plugin/plugin/hooks/hooks.json +15 -0
- repokit/templates/layers/archetypes/js-ts/claude-plugin/plugin/hooks/scripts/session-start.mjs +23 -0
- repokit/templates/layers/archetypes/js-ts/claude-plugin/plugin/tests/manifest.test.js +30 -0
- repokit/templates/layers/archetypes/js-ts/node/.repokit-common.toml.rkappend +6 -0
- repokit/templates/layers/archetypes/js-ts/node/package.json +13 -0
- repokit/templates/layers/archetypes/js-ts/node-package/.github/workflows/release.yml +39 -0
- repokit/templates/layers/archetypes/js-ts/node-package/package.json +32 -0
- repokit/templates/layers/archetypes/js-ts/node-package/src/index.ts +13 -0
- repokit/templates/layers/archetypes/js-ts/node-package/tests/index.test.ts +11 -0
- repokit/templates/layers/archetypes/js-ts/script/.vscode/launch.json +34 -0
- repokit/templates/layers/archetypes/js-ts/script/__RK_PROJECT__.js +37 -0
- repokit/templates/layers/archetypes/js-ts/script/tests/version.test.js +26 -0
- repokit/templates/layers/archetypes/js-ts/ts/package.json +18 -0
- repokit/templates/layers/archetypes/js-ts/ts/tsconfig.json +15 -0
- repokit/templates/layers/archetypes/python/claude-plugin/.github/workflows/ci-python.yml +44 -0
- repokit/templates/layers/archetypes/python/claude-plugin/.repokit-common.toml +21 -0
- repokit/templates/layers/archetypes/python/claude-plugin/.vscode/launch.json +33 -0
- repokit/templates/layers/archetypes/python/claude-plugin/VERSION +1 -0
- repokit/templates/layers/archetypes/python/claude-plugin/plugin/hooks/hooks.json +15 -0
- repokit/templates/layers/archetypes/python/claude-plugin/plugin/hooks/scripts/run-hook.mjs +42 -0
- repokit/templates/layers/archetypes/python/claude-plugin/plugin/hooks/scripts/session_start.py +31 -0
- repokit/templates/layers/archetypes/python/claude-plugin/plugin/tests/test_manifest.py +42 -0
- repokit/templates/layers/archetypes/python/pypi/.github/workflows/release.yml +63 -0
- repokit/templates/layers/archetypes/python/pypi/.vscode/launch.json +43 -0
- repokit/templates/layers/archetypes/python/pypi/__RK_SNAKE__/__init__.py +5 -0
- repokit/templates/layers/archetypes/python/pypi/__RK_SNAKE__/__main__.py +6 -0
- repokit/templates/layers/archetypes/python/pypi/__RK_SNAKE__/_version.py +96 -0
- repokit/templates/layers/archetypes/python/pypi/__RK_SNAKE__/cli.py +18 -0
- repokit/templates/layers/archetypes/python/pypi/pyproject.toml +71 -0
- repokit/templates/layers/archetypes/python/pypi/tests/conftest.py +11 -0
- repokit/templates/layers/archetypes/python/pypi/tests/test_version.py +50 -0
- repokit/templates/layers/archetypes/python/script/.github/workflows/ci-python.yml +43 -0
- repokit/templates/layers/archetypes/python/script/.repokit-common.toml +14 -0
- repokit/templates/layers/archetypes/python/script/.vscode/launch.json +33 -0
- repokit/templates/layers/archetypes/python/script/VERSION +1 -0
- repokit/templates/layers/archetypes/python/script/__RK_PROJECT__.py +40 -0
- repokit/templates/layers/archetypes/python/script/tests/test_version.py +25 -0
- repokit/templates/layers/archetypes/python/setuppy/requirements.txt +8 -0
- repokit/templates/layers/archetypes/python/setuppy/setup.py +23 -0
- repokit/templates/layers/languages/c-cpp/.gitignore.rkappend +20 -0
- repokit/templates/layers/languages/c-cpp/.repokit-common.toml +7 -0
- repokit/templates/layers/languages/c-cpp/include/__RK_SNAKE__/version.h +20 -0
- repokit/templates/layers/languages/c-cpp/src/app.rc +25 -0
- repokit/templates/layers/languages/js-ts/.editorconfig +15 -0
- repokit/templates/layers/languages/js-ts/.github/workflows/ci-js-ts.yml +41 -0
- repokit/templates/layers/languages/js-ts/.gitignore.rkappend +13 -0
- repokit/templates/layers/languages/js-ts/.repokit-common.toml +19 -0
- repokit/templates/layers/languages/js-ts/.vscode/launch.json +24 -0
- repokit/templates/layers/languages/js-ts/VERSION +1 -0
- repokit/templates/layers/languages/python/.github/workflows/ci-python.yml +76 -0
- repokit/templates/layers/languages/python/.gitignore.rkappend +15 -0
- repokit/templates/layers/languages/python/.vscode/launch.json +33 -0
- repokit/templates/layers/manifest.toml +302 -0
- repokit/templates/vault/CLAUDE.md +29 -0
- repokit/templates/vault/claude/_maps/MOC-project.md +15 -0
- repokit/templates/vault/claude/_oracle/backlinks.md +3 -0
- repokit/templates/vault/claude/_oracle/concepts.md +12 -0
- repokit/templates/vault/claude/_oracle/manifest.md +10 -0
- repokit/templates/vault/claude/_todo/ACTIVE-WORK.md +18 -0
- repokit/templates/vault/claude/_todo/OPEN-LOOPS.md +14 -0
- repokit/utils.py +316 -0
- repokit/vault.py +248 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
# 77: the PEP 639 licence fields (an SPDX `license` string and `license-files`)
|
|
3
|
+
requires = ["setuptools>=77", "wheel"]
|
|
4
|
+
build-backend = "setuptools.build_meta"
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "__RK_PROJECT__"
|
|
8
|
+
dynamic = ["version"]
|
|
9
|
+
description = "__RK_DESCRIPTION__"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
__RK_LICENSE_FIELD__
|
|
12
|
+
__RK_LICENSE_FILES__
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
|
+
authors = [
|
|
15
|
+
{name = "__RK_AUTHOR__", email = "__RK_EMAIL__"},
|
|
16
|
+
]
|
|
17
|
+
keywords = [__RK_KEYWORDS__]
|
|
18
|
+
# No `License ::` classifier: setuptools 77+ refuses one beside a licence
|
|
19
|
+
# expression (measured 2026-10-25); the `license` field above says it.
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
22
|
+
"Environment :: Console",
|
|
23
|
+
"Intended Audience :: Developers",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
30
|
+
"Topic :: Utilities",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
dependencies = []
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = [
|
|
37
|
+
"pytest>=7.0.0",
|
|
38
|
+
"pytest-cov>=4.0.0",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://github.com/__RK_ORG__/__RK_PROJECT__"
|
|
43
|
+
Repository = "https://github.com/__RK_ORG__/__RK_PROJECT__"
|
|
44
|
+
Issues = "https://github.com/__RK_ORG__/__RK_PROJECT__/issues"
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
__RK_PROJECT__ = "__RK_SNAKE__.cli:main"
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.dynamic]
|
|
50
|
+
version = {attr = "__RK_SNAKE__._version.PIP_VERSION"}
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.packages.find]
|
|
53
|
+
where = ["."]
|
|
54
|
+
include = ["__RK_SNAKE__", "__RK_SNAKE__.*"]
|
|
55
|
+
|
|
56
|
+
[tool.pytest.ini_options]
|
|
57
|
+
testpaths = ["tests"]
|
|
58
|
+
# The package imports from the project root without an install: the vendored
|
|
59
|
+
# pre-push hook runs `python -P -m pytest`, which keeps the root off sys.path,
|
|
60
|
+
# and the first push (`repokit create --github`) comes before any pip install.
|
|
61
|
+
pythonpath = ["."]
|
|
62
|
+
python_files = "test_*.py"
|
|
63
|
+
python_functions = "test_*"
|
|
64
|
+
python_classes = "Test*"
|
|
65
|
+
|
|
66
|
+
[tool.repokit-common]
|
|
67
|
+
version-source = "__RK_SNAKE__/_version.py"
|
|
68
|
+
changelog = "CHANGELOG.md"
|
|
69
|
+
repo-url = "https://github.com/__RK_ORG__/__RK_PROJECT__"
|
|
70
|
+
tag-prefix = "v"
|
|
71
|
+
private-patterns = ["private/", "local/", ".env"]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Shared test fixtures for __RK_PROJECT__."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@pytest.fixture
|
|
7
|
+
def tmp_project(tmp_path):
|
|
8
|
+
"""A temporary project directory for a test to work in."""
|
|
9
|
+
project_dir = tmp_path / "test_project"
|
|
10
|
+
project_dir.mkdir()
|
|
11
|
+
return project_dir
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Tests for the version module."""
|
|
2
|
+
|
|
3
|
+
from __RK_SNAKE__._version import (
|
|
4
|
+
MAJOR, MINOR, PATCH, PHASE, PROJECT_PHASE,
|
|
5
|
+
get_version, get_base_version, get_display_version, get_pip_version,
|
|
6
|
+
__app_name__,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_app_name():
|
|
11
|
+
assert __app_name__ == "__RK_PROJECT__"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_version_components():
|
|
15
|
+
assert isinstance(MAJOR, int)
|
|
16
|
+
assert isinstance(MINOR, int)
|
|
17
|
+
assert isinstance(PATCH, int)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_phase_valid():
|
|
21
|
+
"""PHASE is empty (a stable release) or a string like 'alpha', 'beta', 'rc1'."""
|
|
22
|
+
assert isinstance(PHASE, str)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_get_version_returns_string():
|
|
26
|
+
v = get_version()
|
|
27
|
+
assert isinstance(v, str)
|
|
28
|
+
assert len(v) > 0
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_base_version_format():
|
|
32
|
+
base = get_base_version()
|
|
33
|
+
assert base.startswith(f"{MAJOR}.{MINOR}.{PATCH}")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_display_version_includes_project_phase():
|
|
37
|
+
display = get_display_version()
|
|
38
|
+
if PROJECT_PHASE and PROJECT_PHASE != "stable":
|
|
39
|
+
assert PROJECT_PHASE.upper() in display
|
|
40
|
+
else:
|
|
41
|
+
assert display == get_base_version()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_pip_version_pep440():
|
|
45
|
+
pip_v = get_pip_version()
|
|
46
|
+
assert "-" not in pip_v
|
|
47
|
+
if PHASE:
|
|
48
|
+
assert any(c.isalpha() for c in pip_v.split(".")[-1])
|
|
49
|
+
else:
|
|
50
|
+
assert all(c.isdigit() or c == "." for c in pip_v)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: CI (Python script)
|
|
2
|
+
|
|
3
|
+
# A plain script: no package to install, no wheel to build. Every top-level
|
|
4
|
+
# .py file must compile and answer --version; tests/ runs when it exists.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ main ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ main ]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
os: [ubuntu-latest, windows-latest]
|
|
19
|
+
python-version: ['3.9', '3.11', '3.12']
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v7
|
|
23
|
+
|
|
24
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
25
|
+
uses: actions/setup-python@v7
|
|
26
|
+
with:
|
|
27
|
+
python-version: ${{ matrix.python-version }}
|
|
28
|
+
|
|
29
|
+
- name: Compile and answer --version
|
|
30
|
+
shell: bash
|
|
31
|
+
run: |
|
|
32
|
+
python -m py_compile *.py
|
|
33
|
+
for f in *.py; do python "$f" --version; done
|
|
34
|
+
|
|
35
|
+
- name: Run tests
|
|
36
|
+
shell: bash
|
|
37
|
+
run: |
|
|
38
|
+
if [ -d tests ]; then
|
|
39
|
+
python -m pip install --upgrade pip pytest
|
|
40
|
+
python -m pytest tests/ -v
|
|
41
|
+
else
|
|
42
|
+
echo "no tests/ folder; nothing to run"
|
|
43
|
+
fi
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# git-repokit-common settings for __RK_PROJECT__.
|
|
2
|
+
#
|
|
3
|
+
# A plain script has no pyproject.toml, so the vendored tooling at
|
|
4
|
+
# scripts/repokit-common/ reads its settings from this file instead. The
|
|
5
|
+
# version lives in VERSION (one line); the hooks keep it, CHANGELOG.md and
|
|
6
|
+
# the tags in step.
|
|
7
|
+
|
|
8
|
+
[tool.repokit-common]
|
|
9
|
+
version-source = "VERSION"
|
|
10
|
+
changelog = "CHANGELOG.md"
|
|
11
|
+
repo-url = "https://github.com/__RK_ORG__/__RK_PROJECT__"
|
|
12
|
+
tag-prefix = "v"
|
|
13
|
+
languages = ["python"]
|
|
14
|
+
private-patterns = ["private/", "local/", ".env"]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "__RK_PROJECT__.py --version",
|
|
6
|
+
"type": "debugpy",
|
|
7
|
+
"request": "launch",
|
|
8
|
+
"program": "${workspaceFolder}/__RK_PROJECT__.py",
|
|
9
|
+
"args": ["--version"],
|
|
10
|
+
"cwd": "${workspaceFolder}",
|
|
11
|
+
"console": "integratedTerminal",
|
|
12
|
+
"justMyCode": false
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "Python: current file",
|
|
16
|
+
"type": "debugpy",
|
|
17
|
+
"request": "launch",
|
|
18
|
+
"program": "${file}",
|
|
19
|
+
"console": "integratedTerminal",
|
|
20
|
+
"justMyCode": false
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "pytest: tests",
|
|
24
|
+
"type": "debugpy",
|
|
25
|
+
"request": "launch",
|
|
26
|
+
"module": "pytest",
|
|
27
|
+
"args": ["tests", "-q"],
|
|
28
|
+
"cwd": "${workspaceFolder}",
|
|
29
|
+
"console": "integratedTerminal",
|
|
30
|
+
"justMyCode": false
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.0
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""__RK_DESCRIPTION__
|
|
3
|
+
|
|
4
|
+
A plain script: one file, run directly, no packaging. The version lives in
|
|
5
|
+
the VERSION file beside this module (git-repokit-common's version tool keeps
|
|
6
|
+
it, the CHANGELOG and the tags in step).
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import sys
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
HERE = Path(__file__).resolve().parent
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def read_version() -> str:
|
|
17
|
+
"""The content of VERSION beside this file, or a marker when it is missing."""
|
|
18
|
+
try:
|
|
19
|
+
return (HERE / "VERSION").read_text(encoding="utf-8").strip() or "0.0.0+unknown"
|
|
20
|
+
except OSError:
|
|
21
|
+
return "0.0.0+unknown"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
25
|
+
parser = argparse.ArgumentParser(prog="__RK_PROJECT__", description=__doc__.strip().splitlines()[0])
|
|
26
|
+
parser.add_argument("--version", action="version", version=read_version())
|
|
27
|
+
parser.add_argument("-v", "--verbose", action="store_true", help="say more while working")
|
|
28
|
+
return parser
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def main(argv=None) -> int:
|
|
32
|
+
args = build_parser().parse_args(argv)
|
|
33
|
+
if args.verbose:
|
|
34
|
+
print(f"__RK_PROJECT__ {read_version()} starting")
|
|
35
|
+
print("Hello from __RK_PROJECT__. Replace this with the script's work.")
|
|
36
|
+
return 0
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
if __name__ == "__main__":
|
|
40
|
+
sys.exit(main())
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""The script answers --version with the VERSION file's content, and --help exits 0."""
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
8
|
+
SCRIPT = ROOT / "__RK_PROJECT__.py"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def run(*args):
|
|
12
|
+
return subprocess.run([sys.executable, str(SCRIPT), *args], cwd=str(ROOT),
|
|
13
|
+
capture_output=True, text=True, encoding="utf-8")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_version_matches_the_version_file():
|
|
17
|
+
r = run("--version")
|
|
18
|
+
assert r.returncode == 0, r.stderr
|
|
19
|
+
assert r.stdout.strip() == (ROOT / "VERSION").read_text(encoding="utf-8").strip()
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_help_exits_cleanly():
|
|
23
|
+
r = run("--help")
|
|
24
|
+
assert r.returncode == 0, r.stderr
|
|
25
|
+
assert "__RK_PROJECT__" in r.stdout
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="__RK_PROJECT__",
|
|
5
|
+
version="0.1.1",
|
|
6
|
+
description="__RK_DESCRIPTION__",
|
|
7
|
+
author="__RK_AUTHOR__",
|
|
8
|
+
author_email="__RK_EMAIL__",
|
|
9
|
+
packages=find_packages(),
|
|
10
|
+
install_requires=[
|
|
11
|
+
# Add your dependencies here
|
|
12
|
+
],
|
|
13
|
+
classifiers=[
|
|
14
|
+
"Development Status :: 3 - Alpha",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.6",
|
|
18
|
+
"Programming Language :: Python :: 3.7",
|
|
19
|
+
"Programming Language :: Python :: 3.8",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
],
|
|
22
|
+
python_requires=">=3.6",
|
|
23
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#ifndef __RK_MACRO___VERSION_H
|
|
2
|
+
#define __RK_MACRO___VERSION_H
|
|
3
|
+
|
|
4
|
+
/* The single source of the version. Edit it with repokit-common's
|
|
5
|
+
* sync-versions.py (--bump, --set, --phase, --pre-num); CMake, the .rc file
|
|
6
|
+
* and the code read it. Only #define lines: the resource compiler includes
|
|
7
|
+
* this file too.
|
|
8
|
+
* PHASE per-MINOR feature-set maturity: "" (stable), "alpha", "beta", "rc1"
|
|
9
|
+
* PRE_RELEASE_NUM the PEP 440 counter behind alpha/beta (a1, b2); the tool writes it
|
|
10
|
+
* PROJECT_PHASE project-wide maturity: "" or "stable", "prealpha", "alpha", "beta";
|
|
11
|
+
* edited by hand, shown by --version, never changed by the tool */
|
|
12
|
+
#define __RK_MACRO___VERSION_MAJOR 0
|
|
13
|
+
#define __RK_MACRO___VERSION_MINOR 1
|
|
14
|
+
#define __RK_MACRO___VERSION_PATCH 0
|
|
15
|
+
#define __RK_MACRO___VERSION_PHASE ""
|
|
16
|
+
#define __RK_MACRO___VERSION_PRE_RELEASE_NUM 1
|
|
17
|
+
#define __RK_MACRO___PROJECT_PHASE ""
|
|
18
|
+
#define __RK_MACRO___VERSION_STRING "0.1.0"
|
|
19
|
+
|
|
20
|
+
#endif
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Windows version resource. Every number and string comes from version.h,
|
|
2
|
+
// so a bump never edits this file (and its encoding never matters).
|
|
3
|
+
#include "__RK_SNAKE__/version.h"
|
|
4
|
+
|
|
5
|
+
1 VERSIONINFO
|
|
6
|
+
FILEVERSION __RK_MACRO___VERSION_MAJOR,__RK_MACRO___VERSION_MINOR,__RK_MACRO___VERSION_PATCH,0
|
|
7
|
+
PRODUCTVERSION __RK_MACRO___VERSION_MAJOR,__RK_MACRO___VERSION_MINOR,__RK_MACRO___VERSION_PATCH,0
|
|
8
|
+
FILEOS 0x40004L
|
|
9
|
+
FILETYPE 0x1L
|
|
10
|
+
BEGIN
|
|
11
|
+
BLOCK "StringFileInfo"
|
|
12
|
+
BEGIN
|
|
13
|
+
BLOCK "040904b0"
|
|
14
|
+
BEGIN
|
|
15
|
+
VALUE "FileDescription", "__RK_DESCRIPTION__"
|
|
16
|
+
VALUE "FileVersion", __RK_MACRO___VERSION_STRING
|
|
17
|
+
VALUE "ProductName", "__RK_PROJECT__"
|
|
18
|
+
VALUE "ProductVersion", __RK_MACRO___VERSION_STRING
|
|
19
|
+
END
|
|
20
|
+
END
|
|
21
|
+
BLOCK "VarFileInfo"
|
|
22
|
+
BEGIN
|
|
23
|
+
VALUE "Translation", 0x409, 1200
|
|
24
|
+
END
|
|
25
|
+
END
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: CI (JavaScript/TypeScript)
|
|
2
|
+
|
|
3
|
+
# Installs with the lockfile when there is one, type-checks when there is a
|
|
4
|
+
# tsconfig.json, and runs the package's test script when it defines one.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ main ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ main ]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
os: [ubuntu-latest, windows-latest]
|
|
19
|
+
node-version: ['20', '22']
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v7
|
|
23
|
+
|
|
24
|
+
- name: Set up Node ${{ matrix.node-version }}
|
|
25
|
+
uses: actions/setup-node@v7
|
|
26
|
+
with:
|
|
27
|
+
node-version: ${{ matrix.node-version }}
|
|
28
|
+
|
|
29
|
+
- name: Install
|
|
30
|
+
shell: bash
|
|
31
|
+
run: |
|
|
32
|
+
if [ -f package-lock.json ]; then npm ci; else npm install; fi
|
|
33
|
+
|
|
34
|
+
- name: Type-check
|
|
35
|
+
shell: bash
|
|
36
|
+
run: |
|
|
37
|
+
if [ -f tsconfig.json ]; then npx tsc --noEmit -p .; else echo "no tsconfig.json; skipped"; fi
|
|
38
|
+
|
|
39
|
+
- name: Test
|
|
40
|
+
shell: bash
|
|
41
|
+
run: npm test --if-present
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# git-repokit-common settings for __RK_PROJECT__.
|
|
2
|
+
#
|
|
3
|
+
# A JavaScript/TypeScript project keeps its version in package.json; the
|
|
4
|
+
# vendored tooling at scripts/repokit-common/ treats the plain VERSION file as
|
|
5
|
+
# the source and package.json (and any other manifest a layer adds) as a
|
|
6
|
+
# target it keeps in step, so one bump moves every copy. The product
|
|
7
|
+
# languages are not listed here on purpose: the hooks detect them from the
|
|
8
|
+
# root (package.json -> javascript, tsconfig.json -> typescript).
|
|
9
|
+
|
|
10
|
+
[tool.repokit-common]
|
|
11
|
+
version-source = "VERSION"
|
|
12
|
+
changelog = "CHANGELOG.md"
|
|
13
|
+
repo-url = "https://github.com/__RK_ORG__/__RK_PROJECT__"
|
|
14
|
+
tag-prefix = "v"
|
|
15
|
+
private-patterns = ["private/", "local/", ".env"]
|
|
16
|
+
# What a push runs: npm test, once the dependencies are installed (a fresh
|
|
17
|
+
# create has none, and a TypeScript test needs tsc). Without this the hook's
|
|
18
|
+
# default test step looks for Python tests and runs nothing here.
|
|
19
|
+
test-command = "if [ -d node_modules ] || ! grep -q devDependencies package.json; then npm test; else echo dependencies not installed: run npm install and the push will run npm test; fi"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "node: current file",
|
|
6
|
+
"type": "node",
|
|
7
|
+
"request": "launch",
|
|
8
|
+
"program": "${file}",
|
|
9
|
+
"cwd": "${workspaceFolder}",
|
|
10
|
+
"console": "integratedTerminal",
|
|
11
|
+
"skipFiles": ["<node_internals>/**"]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "npm test",
|
|
15
|
+
"type": "node",
|
|
16
|
+
"request": "launch",
|
|
17
|
+
"runtimeExecutable": "npm",
|
|
18
|
+
"runtimeArgs": ["test"],
|
|
19
|
+
"cwd": "${workspaceFolder}",
|
|
20
|
+
"console": "integratedTerminal",
|
|
21
|
+
"skipFiles": ["<node_internals>/**"]
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.0
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: CI (Python)
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: windows-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ['3.10', '3.11', '3.12', '3.13']
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v7
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v7
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Cache dependencies
|
|
25
|
+
uses: actions/cache@v6
|
|
26
|
+
with:
|
|
27
|
+
path: ~\AppData\Local\pip\Cache
|
|
28
|
+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml', '**/setup.py', '**/requirements.txt') }}
|
|
29
|
+
restore-keys: |
|
|
30
|
+
${{ runner.os }}-pip-
|
|
31
|
+
|
|
32
|
+
- name: Install the project
|
|
33
|
+
shell: bash
|
|
34
|
+
run: |
|
|
35
|
+
python -m pip install --upgrade pip setuptools wheel
|
|
36
|
+
if [ -f pyproject.toml ]; then pip install -e ".[dev]" || pip install -e .; fi
|
|
37
|
+
if [ -f setup.py ] && [ ! -f pyproject.toml ]; then pip install -e .; fi
|
|
38
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
39
|
+
pip install pytest
|
|
40
|
+
|
|
41
|
+
- name: Lint with flake8
|
|
42
|
+
shell: bash
|
|
43
|
+
run: |
|
|
44
|
+
pip install flake8
|
|
45
|
+
# The package directory: the first top-level folder holding __init__.py
|
|
46
|
+
PKG_DIR=$(python -c "import pathlib; dirs=[d for d in pathlib.Path('.').iterdir() if d.is_dir() and (d / '__init__.py').exists() and not d.name.startswith('.')]; print(dirs[0] if dirs else '.')")
|
|
47
|
+
echo "Linting: $PKG_DIR"
|
|
48
|
+
# Syntax errors and undefined names stop the build
|
|
49
|
+
flake8 "$PKG_DIR"/ --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
50
|
+
# Everything else is reported, never fatal
|
|
51
|
+
flake8 "$PKG_DIR"/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
52
|
+
continue-on-error: true
|
|
53
|
+
|
|
54
|
+
- name: Run tests
|
|
55
|
+
shell: bash
|
|
56
|
+
run: |
|
|
57
|
+
python -m pytest tests/ -v
|
|
58
|
+
|
|
59
|
+
build:
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
needs: test
|
|
62
|
+
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/checkout@v7
|
|
65
|
+
|
|
66
|
+
- name: Set up Python 3.11
|
|
67
|
+
uses: actions/setup-python@v7
|
|
68
|
+
with:
|
|
69
|
+
python-version: '3.11'
|
|
70
|
+
|
|
71
|
+
- name: Build the package
|
|
72
|
+
run: |
|
|
73
|
+
python -m pip install --upgrade pip
|
|
74
|
+
pip install build wheel twine
|
|
75
|
+
python -m build
|
|
76
|
+
twine check dist/*
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "Python: current file",
|
|
6
|
+
"type": "debugpy",
|
|
7
|
+
"request": "launch",
|
|
8
|
+
"program": "${file}",
|
|
9
|
+
"console": "integratedTerminal",
|
|
10
|
+
"justMyCode": false
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "pytest: tests",
|
|
14
|
+
"type": "debugpy",
|
|
15
|
+
"request": "launch",
|
|
16
|
+
"module": "pytest",
|
|
17
|
+
"args": ["tests", "-q"],
|
|
18
|
+
"cwd": "${workspaceFolder}",
|
|
19
|
+
"console": "integratedTerminal",
|
|
20
|
+
"justMyCode": false
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "pytest: current file",
|
|
24
|
+
"type": "debugpy",
|
|
25
|
+
"request": "launch",
|
|
26
|
+
"module": "pytest",
|
|
27
|
+
"args": ["${file}", "-q"],
|
|
28
|
+
"cwd": "${workspaceFolder}",
|
|
29
|
+
"console": "integratedTerminal",
|
|
30
|
+
"justMyCode": false
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|