-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update library tooling to use uv and ruff (#77)
* Switch from poetry to uv * Fix typo * Switch from black to ruff for formatting. * Formatted files using ruff. * Switch to ruff. * Fix ruff error. * Fix ruff error. * Fix lint errors. * Fix line lengths. * Fix line length. * Add ruff flags * Update publish to latest actions.
- Loading branch information
Showing
14 changed files
with
396 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,46 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: ~ | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
env: | ||
DEFAULT_UV: "0.3.0" | ||
|
||
jobs: | ||
check-quality: | ||
strategy: | ||
fail-fast: false | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12" | ||
- name: Check out code from GitHub | ||
uses: actions/[email protected] | ||
|
||
- name: Install poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: 1.2.2 | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
- name: Set up uv | ||
run: curl -LsSf https://astral.sh/uv/${{ env.DEFAULT_UV }}/install.sh | sh | ||
|
||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
- name: "Set up Python" | ||
uses: actions/setup-python@v5 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
python-version-file: "pyproject.toml" | ||
|
||
- name: Install dependencies with poetry | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
- name: Create venv and install | ||
run: uv sync --all-extras --dev | ||
|
||
- name: Run pylint | ||
run: | | ||
source .venv/bin/activate | ||
pylint elkm1_lib | ||
- name: Check formatting | ||
run: uv run ruff format --check | ||
|
||
- name: Run black check | ||
run: | | ||
source .venv/bin/activate | ||
black --check . | ||
- name: Ruff lint/sort/etc checking | ||
run: uv run ruff check --no-fix elkm1_lib | ||
|
||
- name: Run mypy | ||
run: | | ||
source .venv/bin/activate | ||
mypy --show-error-codes --strict elkm1_lib | ||
- name: Run pylint | ||
run: uv run pylint elkm1_lib | ||
|
||
- name: Run isort check | ||
run: | | ||
source .venv/bin/activate | ||
isort --check-only --profile black . | ||
- name: Check typing | ||
run: uv run mypy --show-error-codes --strict elkm1_lib | ||
|
||
- name: Run pytest | ||
run: | | ||
source .venv/bin/activate | ||
poetry install --no-interaction | ||
pytest test | ||
run: uv run pytest test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,20 +13,18 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Check out code from GitHub | ||
uses: actions/[email protected] | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v3 | ||
- name: "Set up Python" | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
python-version-file: "pyproject.toml" | ||
|
||
- name: Install dependencies | ||
- name: Build package | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build package | ||
run: python -m build | ||
python -m build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
"""ElkM1 library""" | ||
|
||
from .elk import Elk | ||
|
||
__all__ = ["Elk"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""Definition of an ElkM1 Keypad.""" | ||
|
||
import datetime as dt | ||
from typing import Optional | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""Definition of an ElkM1 Area""" | ||
|
||
import datetime as dt | ||
import time | ||
from typing import Any, Optional | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""Definition of an ElkM1 Task""" | ||
|
||
from time import time | ||
|
||
from .connection import Connection | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.