From: Thomas Walker Lynch Date: Mon, 19 May 2025 08:32:44 +0000 (+0000) Subject: skeleton X-Git-Url: https://git.reasoningtechnology.com/style/static/gitweb.js?a=commitdiff_plain;h=4b60b2acde8c8177f0ac14a4cb338c7fbbd020f4;p=Harmony.git skeleton --- 4b60b2acde8c8177f0ac14a4cb338c7fbbd020f4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7c79eb8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# ─── Python Detritus ────────────────────────────────────────────── +__pycache__/ +*.py[cod] +*.pyo +*.pyd + +# pytest cache +.pytest_cache/ + +# Cython / coverage / profiling +*.so +*.gcov +*.gcda +*.gcno + +# IPython junk +.ipynb_checkpoints/ + +# editor backup files (optional) +*~ + +# ─── Virtualenv (just in case someone makes one elsewhere) ──────── +venv/ +.venv/ +env/ +ENV/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4c9ac81 --- /dev/null +++ b/LICENSE @@ -0,0 +1,5 @@ +Copyright (c) 2025 Thomas Walker Lynch. +All rights reserved. + +This source code is made available for inspection only. +No permission is granted to use, copy, modify, or distribute it in any form without explicit written permission. diff --git a/README.md b/README.md new file mode 100644 index 0000000..741a5fa --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Harmony + +**Status:** Source-visible only — not open source. + +This repository contains internal development tools, Python environments, and structured workspaces for role-based computation and testing. It reflects standardized RT project conventions for environment entry, tool layering, and reproducible developer/tester workflows. + +## Licensing + +This project is *not* open source. + +The source code is visible for collaboration, transparency, and historical record only. No permission is granted to use, modify, copy, or redistribute any part of the codebase. + +See the [`LICENSE`](./LICENSE) file for details. + +## Roles + +This repository is structured around the following roles: +- `developer/` — implementation and code testing +- `tester/` — validation and reproducibility +- `tool_shared/` — shared tools, environments, and third-party modules + +Each role is entered via its respective `env_` script. + + diff --git a/developer/python/test_env.py b/developer/python/test_env.py new file mode 100644 index 0000000..d47e8a1 --- /dev/null +++ b/developer/python/test_env.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +import os +import sys + +def print_env_var(name): + value = os.getenv(name) + print(f"{name:<16}: {value if value else ''}") + +def main(): + print("=== Python Environment Test ===") + print(f"Python executable : {sys.executable}") + print(f"Python version : {sys.version}") + print() + + print("=== Harmony Environment Variables ===") + for var in ["ROLE", "REPO_HOME", "PYTHON_HOME", "VIRTUAL_ENV", "ENV"]: + print_env_var(var) + + print() + print("=== Current Working Directory ===") + print(os.getcwd()) + +if __name__ == "__main__": + main() diff --git a/env_developer b/env_developer new file mode 100644 index 0000000..a1c0eda --- /dev/null +++ b/env_developer @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") +if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then + echo "$script_afp:: This script must be sourced, not executed." + exit 1 +fi + +export ROLE=developer +source tool_shared/bespoke🖉/env + +if [[ ":$PATH:" != *":$PYTHON_HOME/bin:"* ]]; then + export PATH="$PYTHON_HOME/bin:$PATH" +fi + +cd $ROLE +export ENV=$ROLE +echo "in environmennt: $ENV" diff --git a/env_tester b/env_tester new file mode 100644 index 0000000..b9c8139 --- /dev/null +++ b/env_tester @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") +if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then + echo "$script_afp:: This script must be sourced, not executed." + exit 1 +fi + +export ROLE=tester +source tool_shared/bespoke🖉/env + +if [[ ":$PATH:" != *":$PYTHON_HOME/bin:"* ]]; then + export PATH="$PYTHON_HOME/bin:$PATH" +fi + +cd $ROLE +export ENV=$ROLE + diff --git a/env_toolsmith b/env_toolsmith new file mode 100644 index 0000000..68fd2d3 --- /dev/null +++ b/env_toolsmith @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") +if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then + echo "$script_afp:: This script must be sourced, not executed." + exit 1 +fi + +export ROLE=toolsmith +source tool_shared/bespoke🖉/env +export ENV=$ROLE + diff --git a/release/git_holder b/release/git_holder new file mode 100644 index 0000000..e69de29 diff --git a/tester/git_holder b/tester/git_holder new file mode 100644 index 0000000..e69de29 diff --git a/tmp/.gitignore b/tmp/.gitignore new file mode 100644 index 0000000..92f5e33 --- /dev/null +++ b/tmp/.gitignore @@ -0,0 +1,5 @@ +# Ignore all files +* + +# But don't ignore the .gitignore file itself +!.gitignore diff --git "a/tool_shared/bespoke\360\237\226\211/env" "b/tool_shared/bespoke\360\237\226\211/env" new file mode 100644 index 0000000..4c0ca3f --- /dev/null +++ "b/tool_shared/bespoke\360\237\226\211/env" @@ -0,0 +1,127 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") +if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then + echo "$script_afp:: This script must be sourced, not executed." + exit 1 +fi + +# without this bash takes non-matching globs literally +shopt -s nullglob + +# -------------------------------------------------------------------------------- +# project definition + +# actual absolute director path for this script file + + script_adp(){ + dirname "$script_afp" + } + +# assume this script is located $REPO_HOME/tools_shared/bespoke and work backwards +# to get $REPO_HOME, etc. + + REPO_HOME=$(dirname "$(dirname "$(script_adp)")") + echo REPO_HOME "$REPO_HOME" + + PROJECT=$(basename "$REPO_HOME") + echo PROJECT "$PROJECT" + + # set the prompt decoration to the name of the project + PROMPT_DECOR=$PROJECT + + export REPO_HOME PROJECT PROMPT_DECOR + +# -------------------------------------------------------------------------------- +# Project wide Tool setup +# + +export VIRTUAL_ENV="$REPO_HOME/tool_shared/third_party/Python" +export PYTHON_HOME="$VIRTUAL_ENV" +unset PYTHONHOME + + +# -------------------------------------------------------------------------------- +# PATH +# precedence: last defined, first discovered + + PATH="$REPO_HOME/tool_shared/third_party/RT-project-share/release/bash:$PATH" + PATH="$REPO_HOME/tool_shared/third_party/RT-project-share/release/amd64:$PATH" + PATH="$REPO_HOME/tool_shared/third_party:$PATH" + PATH="$REPO_HOME/tool_shared/customized:$PATH" + PATH="$REPO_HOME"/tool_shared/bespoke🖉:"$PATH" + + # Remove duplicates + clean_path() { + PATH=$(echo ":$PATH" | awk -v RS=: -v ORS=: '!seen[$0]++' | sed 's/^://; s/:$//') + } + clean_path + export PATH + +# -------------------------------------------------------------------------------- +# the following functions are provided for other scripts to use. +# at the top of files that make use of these functions put the following line: +# script_afp=$(realpath "${BASH_SOURCE[0]}") +# + + ## script's filename + script_fn(){ + basename "$script_afp" + } + + ## script's dirpath relative to $REPO_HOME + script_fp(){ + realpath --relative-to="${REPO_HOME}" "$script_afp" + } + + ## script's dirpath relative to $REPO_HOME + script_dp(){ + dirname "$(script_fp)" + } + + export -f script_adp script_fn script_dp script_fp + +#-------------------------------------------------------------------------------- +# used by release scripts +# + + install_file() { + if [ "$#" -lt 3 ]; then + echo "env::install_file usage: install_file ... " + return 1 + fi + + perms="${@: -1}" # Last argument is permissions + target_dp="${@: -2:1}" # Second-to-last argument is the target directory + sources=("${@:1:$#-2}") # All other arguments are source files + + if [ ! -d "$target_dp" ]; then + echo "env::install_file no install done: target directory '$target_dp' does not exist." + return 1 + fi + + for source_fp in "${sources[@]}"; do + if [ ! -f "$source_fp" ]; then + echo "env::install_file: source file '$source_fp' does not exist." + return 1 + fi + + target_file="$target_dp/$(basename "$source_fp")" + + if ! install -m "$perms" "$source_fp" "$target_file"; then + echo "env::install_file: Failed to install $(basename "$source_fp") to $target_dp" + return 1 + else + echo "env::install_file: installed $(basename "$source_fp") to $target_dp with permissions $perms" + fi + done + } + + export -f install_file + +# -------------------------------------------------------------------------------- +# closing +# + if [[ -z "$ENV" ]]; then + export ENV=$(script_fp) + fi + diff --git "a/tool_shared/bespoke\360\237\226\211/version" "b/tool_shared/bespoke\360\237\226\211/version" new file mode 100755 index 0000000..9d91a98 --- /dev/null +++ "b/tool_shared/bespoke\360\237\226\211/version" @@ -0,0 +1,5 @@ +#!/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +echo "Harmony v0.1 2025-05-19" + diff --git "a/tool_shared/document\360\237\226\211/install_Python.org" "b/tool_shared/document\360\237\226\211/install_Python.org" new file mode 100644 index 0000000..236940a --- /dev/null +++ "b/tool_shared/document\360\237\226\211/install_Python.org" @@ -0,0 +1,75 @@ +#+TITLE: Installing Python in Harmony +#+AUTHOR: Thomas Walker Lynch +#+OPTIONS: toc:2 num:nil + +* Overview + +This document describes how to install a project-local Python environment under: + +#+begin_src bash +tool_shared/third_party/Python +#+end_src + +This environment is shared across the =developer= and =tester= roles and is automatically activated through their respective =env_= scripts. + +* Precondition + +Ensure the following: + +- You are in a POSIX shell with =python3= installed. +- The =python3-venv= package is available (on Debian: =sudo apt install python3-venv=). +- You have sourced the Harmony environment via =env_toolsmith= to initialize =REPO_HOME= and related variables. + +* Step-by-Step Installation + +1. Source the Harmony environment: + #+begin_src bash + source env_toolsmith + #+end_src + +2. Create the virtual environment: + #+begin_src bash + python3 -m venv "$REPO_HOME/tool_shared/third_party/Python" + #+end_src + +3. Activate it temporarily to install required packages: + #+begin_src bash + source "$REPO_HOME/tool_shared/third_party/Python/bin/activate" + pip install --upgrade pip + pip install pytest # Add any shared packages here + deactivate + #+end_src + +4. Rename Python's default activate and deactivate: + Harmony provides its own role-aware environment management. Using Python’s default activation scripts may interfere with prompt logic, PATH order, and role-specific behavior. + + Disable the default scripts by renaming them: + #+begin_src bash + mv "$REPO_HOME/tool_shared/third_party/Python/bin/activate" \ + "$REPO_HOME/tool_shared/third_party/Python/bin/activate_deprecated" + #+end_src + + This ensures that accidental sourcing of Python’s =activate= script won't override Harmony's environment setup. + +5. Verify installation: + #+begin_src bash + ls "$REPO_HOME/tool_shared/third_party/Python/bin/python3" + #+end_src + + The binary should exist and report a working Python interpreter when run. + +* Notes + +- The virtual environment is deliberately named =Python=, not =venv=, to reflect its role as a shared system component. +- Harmony environment scripts define and control =VIRTUAL_ENV=, =PYTHON_HOME=, and =PATH=, making Python activation seamless and uniform. +- There is no need to use Python’s =bin/activate= directly — it is fully replaced by Harmony’s environment logic. + +* Related Files + +- =tool_shared/bespoke🖉/env= +- =tool_shared/bespoke🖉/env_source= +- =env_developer=, =env_tester=, =env_toolsmith= + +* Last Verified + +2025-05-19 :: Activate/deactivate renamed post-install. Requires Harmony environment sourcing prior to execution. diff --git a/tool_shared/third_party/.gitignore b/tool_shared/third_party/.gitignore new file mode 100644 index 0000000..92f5e33 --- /dev/null +++ b/tool_shared/third_party/.gitignore @@ -0,0 +1,5 @@ +# Ignore all files +* + +# But don't ignore the .gitignore file itself +!.gitignore