From ed90511b5fce6e83d8bf0c7a948618865155a541 Mon Sep 17 00:00:00 2001 From: Joe Hansche Date: Sun, 26 Jul 2026 18:29:18 -0400 Subject: [PATCH 1/2] Rewrite Makefile to support older versions `make` 3.82 is when `ONESHELL` was introduced, but the default version installed in macos (as of Tahoe 26) is 3.81. As a result the ONESHELL directives are ignored, and the `venv/bin/activate` inclusion is ineffective. There are 2 ways to work around that: 1. single shell, using `. venv/bin/activate && cmd1 && cmd2`, with backslashes for line continuation 2. keep shell commands separate, and invoke venv/bin/___ directly Both approaches work (verified locally), but the venv/bin approach looks better, and removes an easy foot-gun --- Makefile | 44 +++++++++++++------------------------------- pyproject.toml | 2 ++ pyrightconfig.json | 3 +++ 3 files changed, 18 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index 4bbb84c..aac32e2 100644 --- a/Makefile +++ b/Makefile @@ -1,39 +1,30 @@ -SHELL = /bin/bash +SHELL = /bin/bash -xe # Create the venv with the interpreter pinned in .python-version and install # the dev/test/publish toolchain from the [dev] extra. .PHONY: deps -.ONESHELL: deps: - set -e @echo "Setting up the Python environment..." python3 -m venv venv - . venv/bin/activate - pip install -U pip - pip install -e '.[dev]' + venv/bin/pip install -U pip + venv/bin/pip install -e '.[dev]' @echo "Dependencies installed." # Auto-fix formatting and lint issues. .PHONY: format -.ONESHELL: format: - set -e - . venv/bin/activate - ruff format - ruff check --fix + venv/bin/ruff format + venv/bin/ruff check --fix # Full gate: format check, lint, type check, and the entire test suite. .PHONY: test -.ONESHELL: test: @echo "Running format check, lint, type check, and tests..." - set -e - . venv/bin/activate - ruff check - ruff format --check --diff + venv/bin/ruff check + venv/bin/ruff format --check --diff npx -y markdownlint-cli2 "*.md" - pyright --venvpath . --warnings - python -m pytest + venv/bin/pyright --warnings + venv/bin/pytest tests/ @echo "All checks passed." # Alias for `make test`. @@ -42,29 +33,20 @@ check: test # Refresh the committed GraphQL schema fixture from the live API. .PHONY: schema -.ONESHELL: schema: - set -e - . venv/bin/activate - python scripts/dump_schema.py + venv/bin/python scripts/dump_schema.py # Build the sdist + wheel into dist/. .PHONY: build -.ONESHELL: build: - set -e - . venv/bin/activate rm -rf dist - python -m build + venv/bin/python -m build # Build then upload to PyPI (requires credentials/token). .PHONY: publish -.ONESHELL: publish: build - set -e - . venv/bin/activate - twine check dist/* - twine upload dist/* + venv/bin/twine check dist/* + venv/bin/twine upload dist/* .PHONY: clean clean: diff --git a/pyproject.toml b/pyproject.toml index 7a0a39e..0550fdf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,7 @@ birdbuddy = ["py.typed"] # https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length line-length = 88 target-version = "py310" +include = ["birdbuddy/**/*.py", "tests/**/*.py"] # https://docs.astral.sh/ruff/rules/ [tool.ruff.lint] @@ -127,6 +128,7 @@ addopts = [ "--cov-report=html", "--junit-xml=junit.xml", ] +testpaths = ["tests"] [tool.coverage.run] source = ["birdbuddy"] diff --git a/pyrightconfig.json b/pyrightconfig.json index 9a16973..7cd30fb 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -1,6 +1,9 @@ { "pythonVersion": "3.10", + "venvPath": ".", + "venv": "venv", "exclude": ["**/__pycache__", "**/.*", "build", "dist", "venv"], + "include": ["birdbuddy", "tests", "scripts"], "reportIncompatibleVariableOverride": false, "executionEnvironments": [ { From 407a835b44c06e8e4dcf077b5b74ceda6adf1ee5 Mon Sep 17 00:00:00 2001 From: Joe Hansche Date: Sun, 26 Jul 2026 18:42:28 -0400 Subject: [PATCH 2/2] Add scripts to ruff includes --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0550fdf..6e07350 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ birdbuddy = ["py.typed"] # https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length line-length = 88 target-version = "py310" -include = ["birdbuddy/**/*.py", "tests/**/*.py"] +include = ["birdbuddy/**/*.py", "tests/**/*.py", "scripts/**/*.py"] # https://docs.astral.sh/ruff/rules/ [tool.ruff.lint]