From ed4b0157a763416e4328814b7ab22730a8985113 Mon Sep 17 00:00:00 2001 From: Nick Sullivan Date: Thu, 27 Nov 2025 10:20:37 -0600 Subject: [PATCH 1/5] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrade=20Python=20min?= =?UTF-8?q?imum=20version=20to=203.10=20and=20modernize=20build=20system?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Drop Python 3.8-3.9 support (both EOL) - Set minimum Python version to 3.10 - Modernize pyproject.toml with optional dependencies (test, dev) - Add tox.ini for multi-version testing (3.10, 3.11, 3.12, 3.13) - Create GitHub Actions workflow for testing across Python versions - Update PyPI publish workflow to latest actions (v4, v5) - Fix setuptools_scm tag regex to handle both 'v*' and 'releases/v*' patterns - Update license format to SPDX string (setuptools 77+ requirement) - Add Development section to README with testing instructions for both tox and uv ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/pypi-publish.yml | 9 +-- .github/workflows/python-test.yml | 98 ++++++++++++++++++++++++++++++ python/README.md | 50 +++++++++++++++ python/pyproject.toml | 22 +++++-- python/tox.ini | 23 +++++++ 5 files changed, 190 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/python-test.yml create mode 100644 python/tox.ini diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index bcbf636..f1eb270 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -11,17 +11,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Required for setuptools_scm to determine version from Git tags - - name: Debug Git tags - run: | - echo "Current tag: ${GITHUB_REF#refs/tags/}" - git tag -l - - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.13" diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml new file mode 100644 index 0000000..18d72bd --- /dev/null +++ b/.github/workflows/python-test.yml @@ -0,0 +1,98 @@ +name: Python Tests + +on: + push: + branches: [ main ] + paths: + - 'python/**' + - 'prompts/**' + - '.github/workflows/python-test.yml' + pull_request: + branches: [ main ] + paths: + - 'python/**' + - 'prompts/**' + - '.github/workflows/python-test.yml' + +jobs: + test: + name: Test Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required for setuptools_scm + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + working-directory: ./python + run: | + python -m pip install --upgrade pip + pip install -e ".[test]" + + - name: Run tests + working-directory: ./python + run: pytest + + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install dependencies + working-directory: ./python + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Run ruff + working-directory: ./python + run: ruff check . + + build: + name: Build package + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required for setuptools_scm + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build setuptools_scm + + - name: Build package + working-directory: ./python + run: | + python -m build + echo "Built packages:" + ls -la dist/ + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: python-package + path: python/dist/* diff --git a/python/README.md b/python/README.md index 1119438..106163f 100644 --- a/python/README.md +++ b/python/README.md @@ -114,6 +114,56 @@ terse_prompt = get_prompt(detail_level="terse") Longer system prompts will consume more tokens and may slightly increase latency (typically by 10-50ms depending on model and prompt length). For high-throughput applications where every millisecond counts, consider using the concise or terse versions, which still preserve the core principles while minimizing token usage and processing time. +## Development + +### Requirements + +- Python 3.10 or higher +- pip + +### Testing Across Multiple Python Versions + +This package supports Python 3.10, 3.11, 3.12, and 3.13. To test across versions locally: + +**Using tox (traditional approach):** +```bash +cd python +pip install tox +tox # Test all Python versions +tox -e py313 # Test specific version +tox -e lint # Run linting +``` + +**Using uv (modern, faster approach):** +```bash +pip install uv +cd python + +# Test on specific Python version +uv run --python 3.10 pytest +uv run --python 3.11 pytest +uv run --python 3.13 pytest + +# Install dev dependencies +uv pip install -e ".[dev]" +``` + +### Running Tests + +```bash +cd python +pip install -e ".[test]" +pytest +``` + +### Building the Package + +```bash +cd python +pip install -e ".[dev]" +python -m build +``` + ## Contributing Contributions are welcome! Please feel free to submit a Pull Request or open an issue on the [GitHub repository](https://github.com/technickai/heart-centered-prompts). diff --git a/python/pyproject.toml b/python/pyproject.toml index cb24c3a..6a1ba5b 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -10,19 +10,17 @@ readme = "README.md" authors = [ {name = "TechnickAI"} ] -license = { text = "MIT" } +license = "MIT" classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.8" +requires-python = ">=3.10" keywords = [ "AI", "prompts", @@ -38,15 +36,29 @@ keywords = [ root = ".." local_scheme = "no-local-version" fallback_version = "0.0.0" +tag_regex = "^(?:releases/)?v(?P[vV]?\\d+(?:\\.\\d+)*(?:[._-]?(?:a|alpha|b|beta|rc|pre|preview)\\d*)?(?:\\+[a-zA-Z0-9.]+)?)$" -# Ensure setuptools_scm is invoked for dynamic versioning [tool.setuptools] packages = {find = {}} +zip-safe = false + +[tool.setuptools.package-data] +heart_centered_prompts = ["prompts/*/*.txt"] [project.urls] Homepage = "https://github.com/technickai/heart-centered-prompts" "Bug Tracker" = "https://github.com/technickai/heart-centered-prompts/issues" +[project.optional-dependencies] +test = [ + "pytest>=8.0.0", +] +dev = [ + "pytest>=8.0.0", + "ruff>=0.8.0", + "build>=1.0.0", +] + [tool.black] line-length = 120 target-version = ["py313"] diff --git a/python/tox.ini b/python/tox.ini new file mode 100644 index 0000000..af88c62 --- /dev/null +++ b/python/tox.ini @@ -0,0 +1,23 @@ +[tox] +envlist = py3{10,11,12,13} +isolated_build = True +skip_missing_interpreters = True + +[testenv] +description = Run tests with pytest +extras = test +commands = + pytest {posargs} + +[testenv:lint] +description = Run linting with ruff +extras = dev +commands = + ruff check . + +[testenv:build] +description = Build package and verify +extras = dev +commands = + python -m build + python -c "from setuptools_scm import get_version; print(f'Version: {get_version(root=\"..\")}')" From c1b21d9426ba9ff970ef72d57fb0e970e7b5bbe3 Mon Sep 17 00:00:00 2001 From: Nick Sullivan Date: Thu, 27 Nov 2025 12:35:24 -0600 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=94=A7=20Fix=20build.yaml=20to=20use?= =?UTF-8?q?=20Python=203.10=20instead=20of=203.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5c083fc..120e623 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.13"] + python-version: ["3.10", "3.13"] steps: - uses: actions/checkout@v4 From 3b0a5809f54e0ce9c418ae1ac5be660cc0e8c43a Mon Sep 17 00:00:00 2001 From: Nick Sullivan Date: Thu, 27 Nov 2025 12:41:41 -0600 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=94=A7=20Consolidate=20CI=20workflows?= =?UTF-8?q?=20-=20expand=20build.yaml=20to=20test=20all=20Python=20version?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove redundant python-test.yml workflow - Expand build.yaml matrix to test Python 3.10, 3.11, 3.12, 3.13 - Keeps all functionality in one comprehensive 'Build and Test' workflow - Pre-commit, Python tests with coverage, and TypeScript jobs all in one place ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/build.yaml | 2 +- .github/workflows/python-test.yml | 98 ------------------------------- 2 files changed, 1 insertion(+), 99 deletions(-) delete mode 100644 .github/workflows/python-test.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 120e623..6570463 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml deleted file mode 100644 index 18d72bd..0000000 --- a/.github/workflows/python-test.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: Python Tests - -on: - push: - branches: [ main ] - paths: - - 'python/**' - - 'prompts/**' - - '.github/workflows/python-test.yml' - pull_request: - branches: [ main ] - paths: - - 'python/**' - - 'prompts/**' - - '.github/workflows/python-test.yml' - -jobs: - test: - name: Test Python ${{ matrix.python-version }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.10", "3.11", "3.12", "3.13"] - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Required for setuptools_scm - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - working-directory: ./python - run: | - python -m pip install --upgrade pip - pip install -e ".[test]" - - - name: Run tests - working-directory: ./python - run: pytest - - lint: - name: Lint - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.13" - - - name: Install dependencies - working-directory: ./python - run: | - python -m pip install --upgrade pip - pip install -e ".[dev]" - - - name: Run ruff - working-directory: ./python - run: ruff check . - - build: - name: Build package - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Required for setuptools_scm - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.13" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build setuptools_scm - - - name: Build package - working-directory: ./python - run: | - python -m build - echo "Built packages:" - ls -la dist/ - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: python-package - path: python/dist/* From 2fd59c48b5cd78bda5bf10e00c291f9ee16e12f8 Mon Sep 17 00:00:00 2001 From: Nick Sullivan Date: Thu, 27 Nov 2025 12:42:48 -0600 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9C=A8=20Add=20clear=20emoji-enhanced=20?= =?UTF-8?q?job=20names=20to=20build=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Job names now clearly indicate what they do: - โœจ Code Quality (Pre-commit) - ๐Ÿ Python 3.10/3.11/3.12/3.13 - ๐Ÿ’Ž TypeScript Lint & Format - ๐Ÿงช TypeScript Tests - ๐Ÿ“ฆ TypeScript Build Makes CI status much easier to scan at a glance! ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/build.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6570463..a276be2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,6 +9,7 @@ on: jobs: pre-commit: + name: โœจ Code Quality (Pre-commit) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -20,6 +21,7 @@ jobs: - uses: pre-commit/action@v3.0.1 build-python: + name: ๐Ÿ Python ${{ matrix.python-version }} runs-on: ubuntu-latest strategy: fail-fast: false @@ -85,7 +87,7 @@ jobs: if-no-files-found: error typescript-quality: - name: TypeScript Code Quality + name: ๐Ÿ’Ž TypeScript Lint & Format runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -124,7 +126,7 @@ jobs: pnpm type-check typescript-test: - name: TypeScript Tests + name: ๐Ÿงช TypeScript Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -158,7 +160,7 @@ jobs: pnpm test typescript-build: - name: TypeScript Build + name: ๐Ÿ“ฆ TypeScript Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 82d68235c0c6b37fac7137fd9aebc9a703d256cd Mon Sep 17 00:00:00 2001 From: Nick Sullivan Date: Thu, 27 Nov 2025 12:45:33 -0600 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=94=A7=20Fix=20Cursor=20bot=20issues:?= =?UTF-8?q?=20add=20setuptools-scm=20to=20dev=20deps,=20remove=20custom=20?= =?UTF-8?q?tag=20regex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add setuptools-scm>=6.2 to dev dependencies (fixes tox build environment) - Remove overly complex custom tag_regex - use setuptools_scm defaults - Deleted problematic releases/v0.3.2 tag (use v* convention only) - Simpler is better - let setuptools_scm handle all PEP 440 formats (dev, post, rc, etc.) Fixes Cursor bot reviews on PR #5 ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- python/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index 6a1ba5b..14b1016 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -36,7 +36,6 @@ keywords = [ root = ".." local_scheme = "no-local-version" fallback_version = "0.0.0" -tag_regex = "^(?:releases/)?v(?P[vV]?\\d+(?:\\.\\d+)*(?:[._-]?(?:a|alpha|b|beta|rc|pre|preview)\\d*)?(?:\\+[a-zA-Z0-9.]+)?)$" [tool.setuptools] packages = {find = {}} @@ -57,6 +56,7 @@ dev = [ "pytest>=8.0.0", "ruff>=0.8.0", "build>=1.0.0", + "setuptools-scm>=6.2", ] [tool.black]