Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: refresh settings and workflow #146

Merged
merged 3 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -17,16 +16,18 @@ 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 .
# (Enable this step once we have unit tests)
# - name: Test with pytest
# run: pytest -v

- name: Test with pytest
run: pytest -v --ignore=purrr .
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Add "test" once we have unit tests
all: deps format lint # test
all: deps lint format test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason for changing the order between lint and format?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It turns out that import sorting happens in the lint step, we I'm allowing the formatter to react to that. Other than that the order doesn't really matter either way.

deps:
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

format: deps
Expand All @@ -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
22 changes: 22 additions & 0 deletions pyproject.toml
daabr marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -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"]
daabr marked this conversation as resolved.
Show resolved Hide resolved
ignore = ["D213", "S113", "S311", "S314", "S4"]
# TODO: BLE, D100, S113
daabr marked this conversation as resolved.
Show resolved Hide resolved
# 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"
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pytest ~= 8.2
ruff ~= 0.5
pytest
ruff
Loading