diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b10d1b0..46130f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,3 @@ -# Continuous Integration workflow. For more information see: # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python # https://docs.astral.sh/ruff/integrations/#github-actions @@ -17,20 +16,24 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" cache: pip + - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt + - name: Lint & format with ruff run: | ruff check --output-format github . ruff format --check . + + - name: Test with pytest + run: pytest -v --ignore=purrr . + - name: Verify README.md is up to date run: | + # If this check fails, run "python update_projects_table.py", and add "README.md" to this PR. python update_projects_table.py git diff --name-only --exit-code README.md - # (Enable this step once we have unit tests) - # - name: Test with pytest - # run: pytest -v diff --git a/Makefile b/Makefile index c17e293..8a6245f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -# Add "test" once we have unit tests -all: deps format lint # test +all: deps lint format test deps: + python -m pip install --upgrade pip python -m pip install -r requirements.txt format: deps @@ -11,6 +11,6 @@ lint: deps ruff check --fix --output-format full . test: deps - pytest -v + pytest -v --ignore=purrr . .PHONY: all deps format lint test diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3872c45 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[tool.ruff] +src = ["./**"] +target-version = "py312" + +[tool.ruff.lint] +# https://docs.astral.sh/ruff/rules/ +extend-select = ["B", "C4", "D101", "D2", "D3", "DTZ", "E5", "I", "N", "PTH", "Q", "S", "UP", "W"] +ignore = ["D213", "S113", "S311", "S314", "S4"] +# TODO: BLE, D100, S113 +# MAYBE: D4, ANN, S314, FBT, CPY, TRY + +[tool.ruff.lint.isort] +force-sort-within-sections = true +lines-after-imports = 2 +order-by-type = false +known-third-party = ["discord", "github"] + +force-single-line = true +single-line-exclusions = ["autokitteh.atlassian", "autokitteh.google", "datetime", "typing"] + +[tool.ruff.lint.pydocstyle] +convention = "google" diff --git a/requirements.txt b/requirements.txt index e8e7661..71cc539 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -pytest ~= 8.2 -ruff ~= 0.5 +pytest +ruff