diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5c083fc..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,11 +21,12 @@ jobs: - uses: pre-commit/action@v3.0.1 build-python: + name: ๐Ÿ Python ${{ matrix.python-version }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: - python-version: ["3.8", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 @@ -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 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/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..14b1016 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", @@ -39,14 +37,28 @@ root = ".." local_scheme = "no-local-version" fallback_version = "0.0.0" -# 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", + "setuptools-scm>=6.2", +] + [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=\"..\")}')"