Skip to content

Commit

Permalink
Switch to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
eifinger committed Aug 25, 2024
1 parent 052857e commit de0ac21
Show file tree
Hide file tree
Showing 8 changed files with 2,173 additions and 465 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,19 @@ jobs:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- uses: eifinger/setup-rye@v4
id: setup-rye
- uses: eifinger/setup-uv@v1
id: setup-uv
with:
enable-cache: true
cache-prefix: ${{ matrix.python-version }}
- name: Pin python-version ${{ matrix.python-version }}
run: rye pin ${{ matrix.python-version }}
- name: Install dependencies
if: steps.setup-rye.outputs.cache-hit != 'true'
run: |
rye sync
cache-suffix: ${{ matrix.python-version }}
- name: Cache pre-commit
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.cache/pre-commit
key: pre-commit-|${{ matrix.python-version }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Lint
run: |
rye run pre-commit run --all-files
uv run --frozen --python ${{ matrix.python-version }} pre-commit run --all-files
env:
SKIP: no-commit-to-branch
- name: Lint GitHub Actions
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/permissions_advisor.yml

This file was deleted.

40 changes: 20 additions & 20 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,53 +17,53 @@ repos:
name: ✅ Format using ruff
types: [python]
language: system
entry: rye run ruff format
entry: ruff format
- id: ruff
name: ✅ Lint using ruff
types: [python]
language: system
entry: rye run ruff check
entry: ruff check
args: [--fix, --exit-non-zero-on-fix]
- id: check-ast
name: 🐍 Check Python AST
language: system
types: [python]
entry: rye run check-ast
entry: check-ast
- id: check-case-conflict
name: 🔠 Check for case conflicts
language: system
entry: rye run check-case-conflict
entry: check-case-conflict
- id: check-docstring-first
name: ℹ️ Check docstring is first
language: system
types: [python]
entry: rye run check-docstring-first
entry: check-docstring-first
- id: check-executables-have-shebangs
name: 🧐 Check that executables have shebangs
language: system
types: [text, executable]
entry: rye run check-executables-have-shebangs
entry: check-executables-have-shebangs
stages: [commit, push, manual]
- id: check-json
name: { Check JSON files
language: system
types: [json]
entry: rye run check-json
entry: check-json
- id: check-merge-conflict
name: 💥 Check for merge conflicts
language: system
types: [text]
entry: rye run check-merge-conflict
entry: check-merge-conflict
- id: check-symlinks
name: 🔗 Check for broken symlinks
language: system
types: [symlink]
entry: rye run check-symlinks
entry: check-symlinks
- id: check-toml
name: ✅ Check TOML files
language: system
types: [toml]
entry: rye run check-toml
entry: check-toml
- id: check-xml
name: ✅ Check XML files
entry: check-xml
Expand All @@ -73,7 +73,7 @@ repos:
name: ✅ Check YAML files
language: system
types: [yaml]
entry: rye run check-yaml
entry: check-yaml
- id: codespell
name: ✅ Check code for common misspellings
language: system
Expand All @@ -82,48 +82,48 @@ repos:
(?x)^(
.lock
)$
entry: rye run codespell --ignore-words=.codespell
entry: codespell --ignore-words=.codespell
- id: debug-statements
name: 🪵 Debug Statements and imports (Python)
language: system
types: [python]
entry: rye run debug-statement-hook
entry: debug-statement-hook
- id: detect-private-key
name: 🕵️ Detect Private Keys
language: system
types: [text]
entry: rye run detect-private-key
entry: detect-private-key
- id: end-of-file-fixer
name: ⮐ Fix End of Files
language: system
types: [text]
entry: rye run end-of-file-fixer
entry: end-of-file-fixer
stages: [commit, push, manual]
- id: fix-byte-order-marker
name: 🚏 Fix UTF-8 byte order marker
language: system
types: [text]
entry: rye run fix-byte-order-marker
entry: fix-byte-order-marker
- id: mypy
name: 🆎 Static type checking using mypy
language: system
types: [python]
entry: rye run mypy
entry: mypy
require_serial: true
- id: pytest
name: 🧪 Running tests and test coverage with pytest
language: system
types: [python]
entry: rye run pytest
entry: pytest
pass_filenames: false
- id: trailing-whitespace
name: ✄ Trim Trailing Whitespace
language: system
types: [text]
entry: rye run trailing-whitespace-fixer
entry: trailing-whitespace-fixer
stages: [commit, push, manual]
- id: yamllint
name: 🎗 Check YAML files with yamllint
language: system
types: [yaml]
entry: rye run yamllint
entry: yamllint
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12.0
3.12
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,10 @@ dependencies = [
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["custom_components/weenect"]

[tool.rye]
managed = true
[tool.uv]
dev-dependencies = [
"codespell>=2.3.0",
"mypy>=1.11.1",
Expand Down
Loading

0 comments on commit de0ac21

Please sign in to comment.