Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 13 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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`.
Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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", "scripts/**/*.py"]

# https://docs.astral.sh/ruff/rules/
[tool.ruff.lint]
Expand Down Expand Up @@ -127,6 +128,7 @@ addopts = [
"--cov-report=html",
"--junit-xml=junit.xml",
]
testpaths = ["tests"]

[tool.coverage.run]
source = ["birdbuddy"]
Expand Down
3 changes: 3 additions & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"pythonVersion": "3.10",
"venvPath": ".",
"venv": "venv",
"exclude": ["**/__pycache__", "**/.*", "build", "dist", "venv"],
"include": ["birdbuddy", "tests", "scripts"],
"reportIncompatibleVariableOverride": false,
"executionEnvironments": [
{
Expand Down