| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1ab08f4 commit 038b699
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,12 +1,12 @@ | |||
| 1 | 1 | --- | |
| 2 | 2 | name: Setup Environment | |
| 3 | - description: Install requested pipx dependencies, configure the system python, and install uv and the package dependencies | ||
| 3 | + description: Install uv, configure the system python, and the package dependencies | ||
| 4 | 4 | ||
| 5 | 5 | inputs: | |
| 6 | 6 | uv-install-options: | |
| 7 | 7 | default: "" | |
| 8 | 8 | uv-version: | |
| 9 | - default: 0.4.5 | ||
| 9 | + default: 0.4.16 | ||
| 10 | 10 | python-version: | |
| 11 | 11 | required: true | |
| 12 | 12 | cache-pre-commit: | |
@@ -17,66 +17,29 @@ inputs: | |||
| 17 | 17 | runs: | |
| 18 | 18 | using: composite | |
| 19 | 19 | steps: | |
| 20 | - - uses: "actions/setup-python@v5" | ||
| 20 | + - name: Install uv | ||
| 21 | + uses: astral-sh/setup-uv@v3 | ||
| 22 | + with: | ||
| 23 | + enable-cache: true | ||
| 24 | + | ||
| 25 | + - name: "Setup python" | ||
| 26 | + uses: "actions/setup-python@v5" | ||
| 21 | 27 | id: setup-python | |
| 22 | 28 | with: | |
| 23 | 29 | python-version: "${{ inputs.python-version }}" | |
| 24 | 30 | allow-prereleases: true | |
| 25 | 31 | ||
| 26 | - - name: Setup pipx environment Variables | ||
| 27 | - id: pipx-env-setup | ||
| 28 | - # pipx default home and bin dir are not writable by the cache action | ||
| 29 | - # so override them here and add the bin dir to PATH for later steps. | ||
| 30 | - # This also ensures the pipx cache only contains uv | ||
| 31 | - run: | | ||
| 32 | - SEP="${{ !startsWith(runner.os, 'windows') && '/' || '\\' }}" | ||
| 33 | - PIPX_CACHE="${{ github.workspace }}${SEP}pipx_cache" | ||
| 34 | - echo "pipx-cache-path=${PIPX_CACHE}" >> $GITHUB_OUTPUT | ||
| 35 | - echo "pipx-version=$(pipx --version)" >> $GITHUB_OUTPUT | ||
| 36 | - echo "PIPX_HOME=${PIPX_CACHE}${SEP}home" >> $GITHUB_ENV | ||
| 37 | - echo "PIPX_BIN_DIR=${PIPX_CACHE}${SEP}bin" >> $GITHUB_ENV | ||
| 38 | - echo "PIPX_MAN_DIR=${PIPX_CACHE}${SEP}man" >> $GITHUB_ENV | ||
| 39 | - echo "${PIPX_CACHE}${SEP}bin" >> $GITHUB_PATH | ||
| 40 | - shell: bash | ||
| 41 | - | ||
| 42 | - - name: Pipx cache | ||
| 43 | - id: pipx-cache | ||
| 44 | - uses: actions/cache@v4 | ||
| 45 | - with: | ||
| 46 | - path: ${{ steps.pipx-env-setup.outputs.pipx-cache-path }} | ||
| 47 | - key: cache-${{ inputs.cache-version }}-${{ runner.os }}-${{ runner.arch }}-python-${{ inputs.python-version }}-${{ steps.setup-python.outputs.python-version }}-pipx-${{ steps.pipx-env-setup.outputs.pipx-version }}-uv-${{ inputs.uv-version }} | ||
| 48 | - | ||
| 49 | - - name: Install uv | ||
| 50 | - if: steps.pipx-cache.outputs.cache-hit != 'true' | ||
| 51 | - id: install-uv | ||
| 52 | - shell: bash | ||
| 53 | - run: |- | ||
| 54 | - pipx install uv==${{ inputs.uv-version }} --python "${{ steps.setup-python.outputs.python-path }}" | ||
| 55 | - | ||
| 56 | - - name: Read uv cache location | ||
| 57 | - id: uv-cache-location | ||
| 58 | - shell: bash | ||
| 59 | - run: |- | ||
| 60 | - echo "uv-cache-location=$(uv cache dir)" >> $GITHUB_OUTPUT | ||
| 61 | - | ||
| 62 | - - uses: actions/cache@v4 | ||
| 63 | - name: uv cache | ||
| 64 | - with: | ||
| 65 | - path: | | ||
| 66 | - ${{ steps.uv-cache-location.outputs.uv-cache-location }} | ||
| 67 | - key: cache-${{ inputs.cache-version }}-${{ runner.os }}-${{ runner.arch }}-python-${{ steps.setup-python.outputs.python-version }}-uv-${{ inputs.uv-version }}-${{ hashFiles('uv.lock') }}-options-${{ inputs.uv-install-options }} | ||
| 68 | - | ||
| 69 | - - name: "uv install" | ||
| 32 | + - name: "Install project" | ||
| 70 | 33 | shell: bash | |
| 71 | 34 | run: | | |
| 72 | - uv sync --python "${{ steps.setup-python.outputs.python-path }}" ${{ inputs.uv-install-options }} | ||
| 35 | + uv sync ${{ inputs.uv-install-options }} | ||
| 73 | 36 | ||
| 74 | 37 | - name: Read pre-commit version | |
| 75 | 38 | if: inputs.cache-pre-commit == 'true' | |
| 76 | 39 | id: pre-commit-version | |
| 77 | 40 | shell: bash | |
| 78 | 41 | run: >- | |
| 79 | - echo "pre-commit-version=$(uv run pre-commit -- -V | awk '{print $2}')" >> $GITHUB_OUTPUT | ||
| 42 | + echo "pre-commit-version=$(uv run pre-commit -V | awk '{print $2}')" >> $GITHUB_OUTPUT | ||
| 80 | 43 | ||
| 81 | 44 | - uses: actions/cache@v4 | |
| 82 | 45 | if: inputs.cache-pre-commit == 'true' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ on: | |||
| 8 | 8 | workflow_dispatch: # to allow manual re-runs | |
| 9 | 9 | ||
| 10 | 10 | env: | |
| 11 | - UV_VERSION: 0.4.5 | ||
| 11 | + UV_VERSION: 0.4.16 | ||
| 12 | 12 | ||
| 13 | 13 | jobs: | |
| 14 | 14 | linting: | |
@@ -20,39 +20,19 @@ jobs: | |||
| 20 | 20 | python-version: ["3.12"] | |
| 21 | 21 | ||
| 22 | 22 | steps: | |
| 23 | - - uses: "actions/checkout@v4" | ||
| 23 | + - name: "Checkout source files" | ||
| 24 | + uses: "actions/checkout@v4" | ||
| 24 | 25 | - name: Setup environment | |
| 25 | 26 | uses: ./.github/actions/setup | |
| 26 | 27 | with: | |
| 27 | 28 | python-version: ${{ matrix.python-version }} | |
| 28 | 29 | cache-pre-commit: true | |
| 29 | 30 | uv-version: ${{ env.UV_VERSION }} | |
| 30 | 31 | uv-install-options: "--all-extras" | |
| 31 | - - name: "Check supported device md files are up to date" | ||
| 32 | - run: | | ||
| 33 | - uv run pre-commit run generate-supported --all-files | ||
| 34 | - - name: "Linting and code formating (ruff)" | ||
| 35 | - run: | | ||
| 36 | - uv run pre-commit run ruff --all-files | ||
| 37 | - - name: "Typing checks (mypy)" | ||
| 38 | - run: | | ||
| 39 | - source .venv/bin/activate | ||
| 40 | - pre-commit run mypy --all-files | ||
| 41 | - - name: "Run trailing-whitespace" | ||
| 42 | - run: | | ||
| 43 | - uv run pre-commit run trailing-whitespace --all-files | ||
| 44 | - - name: "Run end-of-file-fixer" | ||
| 45 | - run: | | ||
| 46 | - uv run pre-commit run end-of-file-fixer --all-files | ||
| 47 | - - name: "Run check-docstring-first" | ||
| 48 | - run: | | ||
| 49 | - uv run pre-commit run check-docstring-first --all-files | ||
| 50 | - - name: "Run debug-statements" | ||
| 51 | - run: | | ||
| 52 | - uv run pre-commit run debug-statements --all-files | ||
| 53 | - - name: "Run check-ast" | ||
| 32 | + | ||
| 33 | + - name: "Run pre-commit checks" | ||
| 54 | 34 | run: | | |
| 55 | - uv run pre-commit run check-ast --all-files | ||
| 35 | + uv run pre-commit run --all-files --verbose | ||
| 56 | 36 | ||
| 57 | 37 | ||
| 58 | 38 | tests: | |
@@ -83,6 +63,13 @@ jobs: | |||
| 83 | 63 | - os: ubuntu-latest | |
| 84 | 64 | python-version: "3.10" | |
| 85 | 65 | extras: true | |
| 66 | + # Exclude pypy on windows due to significant performance issues | ||
| 67 | + # running pytest requires ~12 min instead of 2 min on other platforms | ||
| 68 | + - os: windows-latest | ||
| 69 | + python-version: "pypy-3.9" | ||
| 70 | + - os: windows-latest | ||
| 71 | + python-version: "pypy-3.10" | ||
| 72 | + | ||
| 86 | 73 | ||
| 87 | 74 | steps: | |
| 88 | 75 | - uses: "actions/checkout@v4" | |
@@ -95,11 +82,11 @@ jobs: | |||
| 95 | 82 | - name: "Run tests (no coverage)" | |
| 96 | 83 | if: ${{ startsWith(matrix.python-version, 'pypy') }} | |
| 97 | 84 | run: | | |
| 98 | - uv run pytest | ||
| 85 | + uv run pytest -n auto | ||
| 99 | 86 | - name: "Run tests (with coverage)" | |
| 100 | 87 | if: ${{ !startsWith(matrix.python-version, 'pypy') }} | |
| 101 | 88 | run: | | |
| 102 | - uv run pytest --cov kasa --cov-report xml | ||
| 89 | + uv run pytest -n auto --cov kasa --cov-report xml | ||
| 103 | 90 | - name: "Upload coverage to Codecov" | |
| 104 | 91 | if: ${{ !startsWith(matrix.python-version, 'pypy') }} | |
| 105 | 92 | uses: "codecov/codecov-action@v4" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,8 @@ on: | |||
| 4 | 4 | types: [published] | |
| 5 | 5 | ||
| 6 | 6 | env: | |
| 7 | - UV_VERSION: 0.4.5 | ||
| 7 | + UV_VERSION: 0.4.16 | ||
| 8 | + PYTHON_VERSION: 3.12 | ||
| 8 | 9 | ||
| 9 | 10 | jobs: | |
| 10 | 11 | build-n-publish: | |
@@ -14,16 +15,19 @@ jobs: | |||
| 14 | 15 | id-token: write | |
| 15 | 16 | ||
| 16 | 17 | steps: | |
| 17 | - - uses: actions/checkout@master | ||
| 18 | + - name: Checkout source files | ||
| 19 | + uses: actions/checkout@v4 | ||
| 20 | + | ||
| 21 | + - name: Install uv | ||
| 22 | + uses: astral-sh/setup-uv@v3 | ||
| 23 | + | ||
| 18 | 24 | - name: Setup python | |
| 19 | 25 | uses: actions/setup-python@v4 | |
| 20 | 26 | with: | |
| 21 | - python-version: "3.x" | ||
| 27 | + python-version: ${{ env.PYTHON_VERSION }} | ||
| 22 | 28 | ||
| 23 | - - name: Install uv | ||
| 24 | - run: |- | ||
| 25 | - pipx install uv==${{ env.UV_VERSION }} --python "${{ steps.setup-python.outputs.python-path }}" | ||
| 26 | 29 | - name: Build a binary wheel and a source tarball | |
| 27 | 30 | run: uv build | |
| 31 | + | ||
| 28 | 32 | - name: Publish release on pypi | |
| 29 | 33 | uses: pypa/gh-action-pypi-publish@release/v1 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ repos: | |||
| 2 | 2 | ||
| 3 | 3 | - repo: https://github.com/astral-sh/uv-pre-commit | |
| 4 | 4 | # uv version. | |
| 5 | - rev: 0.4.5 | ||
| 5 | + rev: 0.4.16 | ||
| 6 | 6 | hooks: | |
| 7 | 7 | # Update the uv lockfile | |
| 8 | 8 | - id: uv-lock | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,7 +32,7 @@ def _get_subclasses(of_class): | |||
| 32 | 32 | and module.__package__ != "kasa.interfaces" | |
| 33 | 33 | ): | |
| 34 | 34 | subclasses.add((module.__package__ + "." + name, obj)) | |
| 35 | - return subclasses | ||
| 35 | + return sorted(subclasses) | ||
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | 38 | device_classes = pytest.mark.parametrize( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -481,7 +481,7 @@ def _get_subclasses(of_class): | |||
| 481 | 481 | and name != "_deprecated_TPLinkSmartHomeProtocol" | |
| 482 | 482 | ): | |
| 483 | 483 | subclasses.add((name, obj)) | |
| 484 | - return subclasses | ||
| 484 | + return sorted(subclasses) | ||
| 485 | 485 | ||
| 486 | 486 | ||
| 487 | 487 | @pytest.mark.parametrize( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,7 +55,8 @@ dev-dependencies = [ | |||
| 55 | 55 | "coverage[toml]", | |
| 56 | 56 | "pytest-timeout~=2.0", | |
| 57 | 57 | "pytest-freezer~=0.4", | |
| 58 | - "mypy~=1.0" | ||
| 58 | + "mypy~=1.0", | ||
| 59 | + "pytest-xdist>=3.6.1", | ||
| 59 | 60 | ] | |
| 60 | 61 | ||
| 61 | 62 | ||
@@ -105,6 +106,7 @@ markers = [ | |||
| 105 | 106 | "requires_dummy: test requires dummy data to pass, skipped on real devices", | |
| 106 | 107 | ] | |
| 107 | 108 | asyncio_mode = "auto" | |
| 109 | + asyncio_default_fixture_loop_scope = "function" | ||
| 108 | 110 | timeout = 10 | |
| 109 | 111 | ||
| 110 | 112 | [tool.doc8] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments